Version Description
Download this release
Release Info
Developer | podpirate |
Plugin | WordPress ReCaptcha Integration |
Version | 0.9.0 |
Comparing to | |
See all releases |
Version 0.9.0
- .svnignore +4 -0
- css/recaptcha-options.css +46 -0
- images/grecaptcha-theme-dark.png +0 -0
- images/grecaptcha-theme-light.png +0 -0
- images/recaptcha-theme-blackglass.png +0 -0
- images/recaptcha-theme-clean.png +0 -0
- images/recaptcha-theme-red.png +0 -0
- images/recaptcha-theme-white.png +0 -0
- inc/contact_form_7_recaptcha.php +78 -0
- inc/ninja_forms_field_recaptcha.php +81 -0
- inc/recaptcha-options.php +294 -0
- js/recaptcha-options.js +11 -0
- js/wpcf7.js +12 -0
- languages/wp-recaptcha-integration-de_DE.mo +0 -0
- languages/wp-recaptcha-integration-de_DE.po +275 -0
- languages/wp-recaptcha-integration-pt_BR.mo +0 -0
- languages/wp-recaptcha-integration-pt_BR.po +198 -0
- readme.txt +84 -0
- recaptchalib.php +277 -0
- screenshot-1.png +0 -0
- screenshot-2.png +0 -0
- screenshot-3.png +0 -0
- wp-recaptcha-integration.php +291 -0
.svnignore
ADDED
@@ -0,0 +1,4 @@
|
|
|
|
|
|
|
|
|
1 |
+
.git
|
2 |
+
.gitignore
|
3 |
+
mkzip.sh
|
4 |
+
README.md
|
css/recaptcha-options.css
ADDED
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
.recaptcha-select-theme .theme-item {
|
2 |
+
display:inline-block;
|
3 |
+
}
|
4 |
+
.recaptcha-select-theme label {
|
5 |
+
display:inline-block;
|
6 |
+
margin:1em;
|
7 |
+
padding:1em;
|
8 |
+
background-color:transparent;
|
9 |
+
border-radius:10px;
|
10 |
+
max-width:200px;
|
11 |
+
}
|
12 |
+
.recaptcha-select-theme input[type="radio"] {
|
13 |
+
display:none;
|
14 |
+
}
|
15 |
+
.recaptcha-select-theme input[type="radio"]:checked + label {
|
16 |
+
background-color:#0074A2;
|
17 |
+
color:#fff;
|
18 |
+
box-shadow: rgba(0,0,0,.3) 0 0 15px 5px;
|
19 |
+
}
|
20 |
+
.recaptcha-select-theme .title {
|
21 |
+
display:block;
|
22 |
+
font-weight:600;
|
23 |
+
text-align:center;
|
24 |
+
padding-bottom:0.5em;
|
25 |
+
}
|
26 |
+
.recaptcha-select-theme .visual,
|
27 |
+
.recaptcha-select-theme img {
|
28 |
+
width:100%;
|
29 |
+
height:auto;
|
30 |
+
}
|
31 |
+
.recaptcha-select-theme .visual {
|
32 |
+
display:block;
|
33 |
+
-moz-box-sizing:border-box;
|
34 |
+
box-sizing:border-box;
|
35 |
+
background-color:#888;
|
36 |
+
color:#fff;
|
37 |
+
font-weight:bold;
|
38 |
+
padding:1em;
|
39 |
+
text-align:center;
|
40 |
+
border-radius:10px;
|
41 |
+
border:5px dashed #444;
|
42 |
+
}
|
43 |
+
.recaptcha-select-theme.flavor-grecaptcha .flavor-recaptcha,
|
44 |
+
.recaptcha-select-theme.flavor-recaptcha .flavor-grecaptcha {
|
45 |
+
display:none;
|
46 |
+
}
|
images/grecaptcha-theme-dark.png
ADDED
Binary file
|
images/grecaptcha-theme-light.png
ADDED
Binary file
|
images/recaptcha-theme-blackglass.png
ADDED
Binary file
|
images/recaptcha-theme-clean.png
ADDED
Binary file
|
images/recaptcha-theme-red.png
ADDED
Binary file
|
images/recaptcha-theme-white.png
ADDED
Binary file
|
inc/contact_form_7_recaptcha.php
ADDED
@@ -0,0 +1,78 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
function wpcf7_add_shortcode_recaptcha() {
|
4 |
+
wpcf7_add_shortcode(
|
5 |
+
array( 'recaptcha','recaptcha*'),
|
6 |
+
'wpcf7_recaptcha_shortcode_handler', true );
|
7 |
+
}
|
8 |
+
add_action( 'wpcf7_init', 'wpcf7_add_shortcode_recaptcha' );
|
9 |
+
|
10 |
+
|
11 |
+
function wpcf7_recaptcha_shortcode_handler( $tag ) {
|
12 |
+
if ( ! WordPress_reCaptcha::instance()->is_required() )
|
13 |
+
return apply_filters( 'recaptcha_disabled_html' ,'');
|
14 |
+
$tag = new WPCF7_Shortcode( $tag );
|
15 |
+
if ( empty( $tag->name ) )
|
16 |
+
return '';
|
17 |
+
|
18 |
+
$recaptcha_html = WordPress_reCaptcha::instance()->recaptcha_html();
|
19 |
+
$validation_error = wpcf7_get_validation_error( $tag->name );
|
20 |
+
|
21 |
+
$html = sprintf(
|
22 |
+
'<span class="wpcf7-form-control-wrap %1$s">%2$s %3$s</span>',
|
23 |
+
$tag->name, $recaptcha_html, $validation_error );
|
24 |
+
|
25 |
+
return $html;
|
26 |
+
}
|
27 |
+
|
28 |
+
function wpcf7_recaptcha_enqueue_script() {
|
29 |
+
wp_enqueue_script('wpcf7-recaptcha-integration',plugins_url('/js/wpcf7.js',dirname(__FILE__)),array('contact-form-7'));
|
30 |
+
}
|
31 |
+
add_action('wp_enqueue_scripts','wpcf7_recaptcha_enqueue_script');
|
32 |
+
|
33 |
+
function wpcf7_add_tag_generator_recaptcha() {
|
34 |
+
if ( ! function_exists( 'wpcf7_add_tag_generator' ) )
|
35 |
+
return;
|
36 |
+
wpcf7_add_tag_generator( 'recaptcha', __( 'reCAPTCHA', 'wp-recaptcha-integration' ),
|
37 |
+
'wpcf7-tg-pane-recaptcha', 'wpcf7_recaptcha_settings_callback' );
|
38 |
+
}
|
39 |
+
add_action( 'admin_init', 'wpcf7_add_tag_generator_recaptcha', 45 );
|
40 |
+
|
41 |
+
|
42 |
+
function wpcf7_recaptcha_settings_callback( $contact_form ) {
|
43 |
+
$type = 'recaptcha';
|
44 |
+
|
45 |
+
?>
|
46 |
+
<div id="wpcf7-tg-pane-<?php echo $type; ?>" class="hidden">
|
47 |
+
<form action="">
|
48 |
+
<table>
|
49 |
+
<tr><td><input type="checkbox" checked="checked" disabled="disabled" name="required" onclick="return false" /> <?php echo esc_html( __( 'Required field?', 'contact-form-7' ) ); ?></td></tr>
|
50 |
+
<tr><td><?php echo esc_html( __( 'Name', 'contact-form-7' ) ); ?><br /><input type="text" name="name" class="tg-name oneline" /></td><td></td></tr>
|
51 |
+
</table>
|
52 |
+
<div class="tg-tag">
|
53 |
+
<?php echo esc_html( __( "Copy this code and paste it into the form left.", 'contact-form-7' ) ); ?><br />
|
54 |
+
<input type="text" name="<?php echo $type; ?>" class="tag wp-ui-text-highlight code" readonly="readonly" onfocus="this.select()" />
|
55 |
+
</div>
|
56 |
+
</form>
|
57 |
+
</div>
|
58 |
+
<?php
|
59 |
+
}
|
60 |
+
|
61 |
+
|
62 |
+
|
63 |
+
|
64 |
+
function wpcf7_recaptcha_validation_filter( $result, $tag ) {
|
65 |
+
if ( ! WordPress_reCaptcha::instance()->is_required() )
|
66 |
+
return $result;
|
67 |
+
|
68 |
+
$tag = new WPCF7_Shortcode( $tag );
|
69 |
+
$name = $tag->name;
|
70 |
+
|
71 |
+
if ( ! WordPress_reCaptcha::instance()->recaptcha_check() ) {
|
72 |
+
$result['valid'] = false;
|
73 |
+
$result['reason'][$name] = __("The Captcha didn’t verify.",'wp-recaptcha-integration');
|
74 |
+
}
|
75 |
+
return $result;
|
76 |
+
}
|
77 |
+
add_filter( 'wpcf7_validate_recaptcha', 'wpcf7_recaptcha_validation_filter', 10, 2 );
|
78 |
+
add_filter( 'wpcf7_validate_recaptcha*', 'wpcf7_recaptcha_validation_filter', 10, 2 );
|
inc/ninja_forms_field_recaptcha.php
ADDED
@@ -0,0 +1,81 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
|
4 |
+
|
5 |
+
function ninja_forms_register_field_recaptcha(){
|
6 |
+
$args = array(
|
7 |
+
'name' => __( 'reCAPTCHA', 'wp-recaptcha-integration' ),
|
8 |
+
'edit_function' => '',
|
9 |
+
'display_function' => 'ninja_forms_field_recaptcha_display',
|
10 |
+
'group' => 'standard_fields',
|
11 |
+
'edit_label' => true,
|
12 |
+
'edit_label_pos' => true,
|
13 |
+
'edit_req' => false,
|
14 |
+
'edit_custom_class' => false,
|
15 |
+
'edit_help' => true,
|
16 |
+
'edit_meta' => false,
|
17 |
+
'sidebar' => 'template_fields',
|
18 |
+
'display_label' => true,
|
19 |
+
'edit_conditional' => false,
|
20 |
+
'conditional' => array(
|
21 |
+
'value' => array(
|
22 |
+
'type' => 'text',
|
23 |
+
),
|
24 |
+
),
|
25 |
+
'pre_process' => 'ninja_forms_field_recaptcha_pre_process',
|
26 |
+
'process_field' => false,
|
27 |
+
'limit' => 1,
|
28 |
+
'edit_options' => array(
|
29 |
+
),
|
30 |
+
'req' => true,
|
31 |
+
);
|
32 |
+
|
33 |
+
ninja_forms_register_field('_recaptcha', $args);
|
34 |
+
}
|
35 |
+
if ( function_exists('ninja_forms_register_field') ) {
|
36 |
+
add_action('init', 'ninja_forms_register_field_recaptcha');
|
37 |
+
add_action('wp_footer','ninja_forms_recaptcha_script');
|
38 |
+
add_filter('ninja_forms_field','ninja_forms_recaptcha_field_data',10,2);
|
39 |
+
}
|
40 |
+
|
41 |
+
function ninja_forms_recaptcha_field_data( $data, $field_id ) {
|
42 |
+
$field_row = ninja_forms_get_field_by_id($field_id);
|
43 |
+
if ( $field_row['type'] == '_recaptcha' )
|
44 |
+
$data['show_field'] = WordPress_reCaptcha::instance()->is_required();
|
45 |
+
return $data;
|
46 |
+
}
|
47 |
+
|
48 |
+
function ninja_forms_recaptcha_script($id) {
|
49 |
+
// print script
|
50 |
+
$html = '<script type="text/javascript">
|
51 |
+
jQuery(document).on("submitResponse.default", function(e, response){
|
52 |
+
Recaptcha.reload();
|
53 |
+
});
|
54 |
+
</script>';
|
55 |
+
echo $html;
|
56 |
+
}
|
57 |
+
|
58 |
+
function ninja_forms_field_recaptcha_display($field_id, $data){
|
59 |
+
if ( WordPress_reCaptcha::instance()->is_required() )
|
60 |
+
WordPress_reCaptcha::instance()->print_recaptcha_html();
|
61 |
+
else
|
62 |
+
echo apply_filters( 'recaptcha_disabled_html' ,'');
|
63 |
+
}
|
64 |
+
|
65 |
+
function ninja_forms_field_recaptcha_pre_process( $field_id, $user_value ){
|
66 |
+
global $ninja_forms_processing;
|
67 |
+
$recaptcha_error = __("<strong>Error:</strong> the Captcha didn’t verify.",'wp-recaptcha-integration');
|
68 |
+
|
69 |
+
$field_row = ninja_forms_get_field_by_id($field_id);
|
70 |
+
$field_data = $field_row['data'];
|
71 |
+
$form_row = ninja_forms_get_form_by_field_id($field_id);
|
72 |
+
$form_id = $form_row['id'];
|
73 |
+
|
74 |
+
|
75 |
+
$require_recaptcha = WordPress_reCaptcha::instance()->is_required();
|
76 |
+
|
77 |
+
if ( $ninja_forms_processing->get_action() != 'save' && $ninja_forms_processing->get_action() != 'mp_save' && $require_recaptcha && ! WordPress_reCaptcha::instance()->recaptcha_check() ){
|
78 |
+
$ninja_forms_processing->add_error('recaptcha-general', $recaptcha_error, 'general');
|
79 |
+
$ninja_forms_processing->add_error('recaptcha-'.$field_id, $recaptcha_error, $field_id);
|
80 |
+
}
|
81 |
+
}
|
inc/recaptcha-options.php
ADDED
@@ -0,0 +1,294 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
|
4 |
+
|
5 |
+
class WordPress_reCaptcha_Options {
|
6 |
+
private $enter_api_key;
|
7 |
+
/**
|
8 |
+
* Holding the singleton instance
|
9 |
+
*/
|
10 |
+
private static $_instance = null;
|
11 |
+
|
12 |
+
/**
|
13 |
+
* @return WordPress_reCaptcha_Options The options manager instance
|
14 |
+
*/
|
15 |
+
public static function instance(){
|
16 |
+
if ( is_null( self::$_instance ) )
|
17 |
+
self::$_instance = new self();
|
18 |
+
return self::$_instance;
|
19 |
+
}
|
20 |
+
|
21 |
+
/**
|
22 |
+
* Prevent from creating more than one instance
|
23 |
+
*/
|
24 |
+
private function __clone() {
|
25 |
+
}
|
26 |
+
/**
|
27 |
+
* Prevent from creating more than one instance
|
28 |
+
*/
|
29 |
+
private function __construct() {
|
30 |
+
add_action('admin_init', array(&$this,'admin_init') );
|
31 |
+
add_action('admin_menu', array(&$this,'add_options_page') );
|
32 |
+
}
|
33 |
+
function api_key_notice() {
|
34 |
+
?><div class="notice error above-h1"><p><?php
|
35 |
+
printf(
|
36 |
+
__( '<strong>reCaptcha needs your attention:</strong> To make it work You need to enter an api key. <br />You can do so at the <a href="%s">reCaptcha settings page</a>.' , 'wp-recaptcha-integration' ),
|
37 |
+
admin_url( add_query_arg( 'page' , 'recaptcha' , 'options-general.php' ) )
|
38 |
+
);
|
39 |
+
?></p></div><?php
|
40 |
+
}
|
41 |
+
function admin_init( ) {
|
42 |
+
|
43 |
+
$has_api_key = WordPress_reCaptcha::instance()->has_api_key();
|
44 |
+
if ( ! $has_api_key && current_user_can( 'manage_options' ) ) {
|
45 |
+
add_action('admin_notices',array( &$this , 'api_key_notice'));
|
46 |
+
}
|
47 |
+
|
48 |
+
$this->enter_api_key = ! $has_api_key || ( isset($_REQUEST['action']) && $_REQUEST['action'] == 'recaptcha-api-key' && isset($_REQUEST['_wpnonce']) && $nonce_valid = wp_verify_nonce($_REQUEST['_wpnonce'],$_REQUEST['action']) );
|
49 |
+
if ( $this->enter_api_key ) {
|
50 |
+
register_setting( 'recaptcha_options', 'recaptcha_publickey' );
|
51 |
+
register_setting( 'recaptcha_options', 'recaptcha_privatekey' );
|
52 |
+
add_settings_field('recaptcha_publickey', __('Public Key','wp-recaptcha-integration'), array(&$this,'input_text'), 'recaptcha', 'recaptcha_apikey' , array('name'=>'recaptcha_publickey') );
|
53 |
+
add_settings_field('recaptcha_privatekey', __('Private Key','wp-recaptcha-integration'), array(&$this,'input_text'), 'recaptcha', 'recaptcha_apikey', array('name'=>'recaptcha_privatekey'));
|
54 |
+
add_settings_section('recaptcha_apikey', __( 'Connecting' , 'wp-recaptcha-integration' ), array(&$this,'explain_apikey'), 'recaptcha');
|
55 |
+
if ( $has_api_key ) {
|
56 |
+
add_settings_field('cancel', '' , array(&$this,'cancel_enter_api_key'), 'recaptcha', 'recaptcha_apikey' );
|
57 |
+
}
|
58 |
+
} else if ( @$nonce_valid === false) {
|
59 |
+
wp_die('Security Check');
|
60 |
+
} else {
|
61 |
+
add_settings_section('recaptcha_apikey', __( 'Connecting' , 'wp-recaptcha-integration' ), array(&$this,'explain_apikey'), 'recaptcha');
|
62 |
+
}
|
63 |
+
|
64 |
+
if ( $has_api_key ) {
|
65 |
+
register_setting( 'recaptcha_options', 'recaptcha_flavor' , array( &$this , 'sanitize_flavor' ) );
|
66 |
+
register_setting( 'recaptcha_options', 'recaptcha_theme' , array( &$this , 'sanitize_theme' ) );
|
67 |
+
register_setting( 'recaptcha_options', 'recaptcha_enable_comments' , 'intval');
|
68 |
+
register_setting( 'recaptcha_options', 'recaptcha_enable_signup', 'intval' );
|
69 |
+
register_setting( 'recaptcha_options', 'recaptcha_enable_login' , 'intval');
|
70 |
+
register_setting( 'recaptcha_options', 'recaptcha_enable_lostpw' , 'intval');
|
71 |
+
register_setting( 'recaptcha_options', 'recaptcha_disable_for_known_users' , 'intval');
|
72 |
+
|
73 |
+
add_settings_section('recaptcha_options', __( 'Features' , 'wp-recaptcha-integration' ), '__return_false', 'recaptcha');
|
74 |
+
|
75 |
+
add_settings_field('recaptcha_flavor', __('Flavor','wp-recaptcha-integration'),
|
76 |
+
array(&$this,'input_radio'), 'recaptcha', 'recaptcha_options',
|
77 |
+
array(
|
78 |
+
'name' => 'recaptcha_flavor',
|
79 |
+
'items' => array(
|
80 |
+
array(
|
81 |
+
'value' => 'grecaptcha',
|
82 |
+
'label' => __( 'No Captcha where you just click a button' , 'wp-recaptcha-integration' ),
|
83 |
+
),
|
84 |
+
array(
|
85 |
+
'value' => 'recaptcha',
|
86 |
+
'label' => __( 'Old style reCAPTCHA where you type some cryptic text' , 'wp-recaptcha-integration' ),
|
87 |
+
),
|
88 |
+
),
|
89 |
+
) );
|
90 |
+
|
91 |
+
add_settings_field('recaptcha_theme', __('Theme','wp-recaptcha-integration'), array(&$this,'select_theme'), 'recaptcha', 'recaptcha_options');
|
92 |
+
|
93 |
+
|
94 |
+
add_settings_field('recaptcha_enable_comments', __('Protect Comments','wp-recaptcha-integration'),
|
95 |
+
array(&$this,'input_checkbox'), 'recaptcha', 'recaptcha_options' ,
|
96 |
+
array('name'=>'recaptcha_enable_comments','label'=>__( 'Protect comment forms with recaptcha.' ,'wp-recaptcha-integration' ) )
|
97 |
+
);
|
98 |
+
|
99 |
+
add_settings_field('recaptcha_enable_signup', __('Protect Signup','wp-recaptcha-integration'),
|
100 |
+
array(&$this,'input_checkbox'), 'recaptcha', 'recaptcha_options',
|
101 |
+
array('name'=>'recaptcha_enable_signup','label'=>__( 'Protect signup form with recaptcha.','wp-recaptcha-integration' ) )
|
102 |
+
);
|
103 |
+
|
104 |
+
add_settings_field('recaptcha_enable_login', __('Protect Login','wp-recaptcha-integration'),
|
105 |
+
array(&$this,'input_checkbox'), 'recaptcha', 'recaptcha_options' ,
|
106 |
+
array('name'=>'recaptcha_enable_login','label'=>__( 'Protect Login form with recaptcha.','wp-recaptcha-integration' ))
|
107 |
+
);
|
108 |
+
|
109 |
+
add_settings_field('recaptcha_enable_lostpw', __('Protect Lost Password','wp-recaptcha-integration'),
|
110 |
+
array(&$this,'input_checkbox'), 'recaptcha', 'recaptcha_options' ,
|
111 |
+
array('name'=>'recaptcha_enable_lostpw','label'=>__( 'Protect Lost Password form with recaptcha.','wp-recaptcha-integration' ))
|
112 |
+
);
|
113 |
+
|
114 |
+
add_settings_field('recaptcha_disable_for_known_users', __('Disable for known users','wp-recaptcha-integration'),
|
115 |
+
array(&$this,'input_checkbox'), 'recaptcha', 'recaptcha_options' ,
|
116 |
+
array('name'=>'recaptcha_disable_for_known_users','label'=>__( 'Disable reCaptcha verification for logged in users.','wp-recaptcha-integration' ))
|
117 |
+
);
|
118 |
+
|
119 |
+
if ( ! get_option( 'recaptcha_publickey' ) || ! get_option( 'recaptcha_privatekey' ) )
|
120 |
+
add_settings_error('recaptcha',1,__('Please configure the public and private key. <a href="http://www.google.com/recaptcha/whyrecaptcha">What are you trying to tell me?</a>','wp-recaptcha-integration'),'updated');
|
121 |
+
}
|
122 |
+
}
|
123 |
+
|
124 |
+
public function explain_apikey( ) {
|
125 |
+
if ( $this->enter_api_key ) {
|
126 |
+
?><p class="description"><?php
|
127 |
+
$info_url = 'https://developers.google.com/recaptcha/intro';
|
128 |
+
$admin_url = 'https://www.google.com/recaptcha/admin';
|
129 |
+
printf(
|
130 |
+
__( 'Please register your blog through the <a href="%s">Google reCAPTCHA admin page</a> and enter the public and private key in the fields below. <a href="%s">What is this all about</a>', 'wp-recaptcha-integration' ) ,
|
131 |
+
$admin_url , $info_url
|
132 |
+
);
|
133 |
+
?></p><?php
|
134 |
+
} else {
|
135 |
+
?><p class="description"><?php
|
136 |
+
_e( 'You already entered an API Key. Use the button below to enter it again.','wp-recaptcha-integration');
|
137 |
+
?></p><?php
|
138 |
+
$action = 'recaptcha-api-key';
|
139 |
+
$nonce = wp_create_nonce( $action );
|
140 |
+
$url = add_query_arg( array('_wpnonce' => $nonce , 'action' => $action ) );
|
141 |
+
?><p class="submit"><?php
|
142 |
+
?><a class="button" href="<?php echo $url ?>"><?php _e('New API Key' , 'wp-recaptcha-integration') ?></a><?php
|
143 |
+
?></p><?php
|
144 |
+
|
145 |
+
}
|
146 |
+
}
|
147 |
+
public function cancel_enter_api_key(){
|
148 |
+
$url = remove_query_arg( array('_wpnonce' , 'action' , 'settings-updated' ) );
|
149 |
+
?><a class="button" href="<?php echo $url ?>"><?php _e( 'Cancel' ) ?></a><?php
|
150 |
+
}
|
151 |
+
|
152 |
+
public function input_radio( $args ) {
|
153 |
+
extract($args); // name, items
|
154 |
+
$option = get_option( $name );
|
155 |
+
foreach ( $items as $item ) {
|
156 |
+
extract( $item ); // value, label
|
157 |
+
?><label for="<?php echo "$name-$value" ?>"><?php
|
158 |
+
?><input id="<?php echo "$name-$value" ?>" type="radio" name="<?php echo $name ?>" value="<?php echo $value ?>" <?php checked($value,$option,true) ?> />
|
159 |
+
<?php
|
160 |
+
echo $label;
|
161 |
+
?></label><br /><?php
|
162 |
+
}
|
163 |
+
}
|
164 |
+
|
165 |
+
public function input_checkbox($args) {
|
166 |
+
extract($args);
|
167 |
+
$value = get_option( $name );
|
168 |
+
?><label for="<?php echo $name ?>"><?php
|
169 |
+
?><input id="<?php echo $name ?>" type="checkbox" name="<?php echo $name ?>" value="1" <?php checked($value,1,true) ?> />
|
170 |
+
<?php
|
171 |
+
echo $label;
|
172 |
+
?></label><?php
|
173 |
+
}
|
174 |
+
public function input_text( $args ) {
|
175 |
+
extract( $args );
|
176 |
+
$value = get_option( $name );
|
177 |
+
?><input type="text" class="regular-text ltr" name="<?php echo $name ?>" value="<?php //echo $value ?>" /><?php
|
178 |
+
}
|
179 |
+
|
180 |
+
public function select_theme() {
|
181 |
+
$option_name = 'recaptcha_theme';
|
182 |
+
|
183 |
+
$themes = array(
|
184 |
+
'light' => array(
|
185 |
+
'label' => __('Light','wp-recaptcha-integration') ,
|
186 |
+
'flavor' => 'grecaptcha',
|
187 |
+
),
|
188 |
+
'dark' => array(
|
189 |
+
'label' => __('Dark','wp-recaptcha-integration') ,
|
190 |
+
'flavor' => 'grecaptcha',
|
191 |
+
),
|
192 |
+
|
193 |
+
'red' => array(
|
194 |
+
'label' => __('Red','wp-recaptcha-integration') ,
|
195 |
+
'flavor' => 'recaptcha',
|
196 |
+
),
|
197 |
+
'white' => array(
|
198 |
+
'label' => __('White','wp-recaptcha-integration') ,
|
199 |
+
'flavor' => 'recaptcha',
|
200 |
+
),
|
201 |
+
'blackglass' => array(
|
202 |
+
'label' => __('Black Glass','wp-recaptcha-integration') ,
|
203 |
+
'flavor' => 'recaptcha',
|
204 |
+
),
|
205 |
+
'clean' => array(
|
206 |
+
'label' => __('Clean','wp-recaptcha-integration') ,
|
207 |
+
'flavor' => 'recaptcha',
|
208 |
+
),
|
209 |
+
'custom' => array(
|
210 |
+
'label' => __('Custom','wp-recaptcha-integration') ,
|
211 |
+
'flavor' => 'recaptcha',
|
212 |
+
),
|
213 |
+
);
|
214 |
+
|
215 |
+
$option_theme = get_option($option_name);
|
216 |
+
$option_flavor = get_option( 'recaptcha_flavor' );
|
217 |
+
|
218 |
+
?><div class="recaptcha-select-theme flavor-<?php echo $option_flavor ?>"><?php
|
219 |
+
|
220 |
+
foreach ( $themes as $value => $theme ) {
|
221 |
+
extract( $theme ); // label, flavor
|
222 |
+
?><div class="theme-item flavor-<?php echo $flavor ?>"><?php
|
223 |
+
?><input <?php checked($value,$option_theme,true); ?> id="<?php echo "$option_name-$value" ?>" type="radio" name="<?php echo $option_name ?>" value="<?php echo $value ?>" /><?php
|
224 |
+
?><label for="<?php echo "$option_name-$value" ?>"><?php
|
225 |
+
?><span class="title"><?php
|
226 |
+
echo $label;
|
227 |
+
?></span><?php
|
228 |
+
if ( $value == 'custom' ) {
|
229 |
+
?><span class="visual"><?php
|
230 |
+
_e( 'Unstyled HTML to apply your own Stylesheets.' , 'wp-recaptcha-integration' );
|
231 |
+
?></span><?php
|
232 |
+
} else {
|
233 |
+
$src = plugins_url( "images/{$flavor}-theme-{$value}.png" , dirname(__FILE__));
|
234 |
+
printf( '<img src="%s" alt="%s" />' , $src , $label );
|
235 |
+
}
|
236 |
+
?></label><?php
|
237 |
+
?></div><?php
|
238 |
+
|
239 |
+
}
|
240 |
+
?></div><?php
|
241 |
+
?></div><?php
|
242 |
+
}
|
243 |
+
public function add_options_page() {
|
244 |
+
$page_slug = add_options_page(
|
245 |
+
__('ReCaptcha','wp-recaptcha-integration'), __('ReCaptcha','wp-recaptcha-integration'),
|
246 |
+
'manage_options', 'recaptcha',
|
247 |
+
array(&$this,'render_options_page')
|
248 |
+
);
|
249 |
+
add_action( "load-$page_slug" , array( &$this , 'enqueue_styles' ) );
|
250 |
+
}
|
251 |
+
public function enqueue_styles() {
|
252 |
+
wp_enqueue_style( 'recaptcha-options' , plugins_url( "css/recaptcha-options.css" , dirname(__FILE__)) );
|
253 |
+
wp_enqueue_script( 'recaptcha-options' , plugins_url( "js/recaptcha-options.js" , dirname(__FILE__)) , array( 'jquery' ) );
|
254 |
+
remove_action('admin_notices',array( &$this , 'api_key_notice'));
|
255 |
+
}
|
256 |
+
public function render_options_page() {
|
257 |
+
?><div class="wrap"><?php
|
258 |
+
?><h2><?php /*icon*/
|
259 |
+
_e('Settings');
|
260 |
+
echo ' › ';
|
261 |
+
_e( 'ReCaptcha' , 'wp-recaptcha-integration' );
|
262 |
+
?></h2><?php
|
263 |
+
/* ?><p><?php _e( '...' , 'googlefont' ); ?></p><?php */
|
264 |
+
?><form action="options.php" method="post"><?php
|
265 |
+
settings_fields( 'recaptcha_options' );
|
266 |
+
do_settings_sections( 'recaptcha' );
|
267 |
+
?><input name="submit" class="button button-primary" type="submit" value="<?php esc_attr_e('Save Changes'); ?>" /><?php
|
268 |
+
?></form><?php
|
269 |
+
?></div><?php
|
270 |
+
}
|
271 |
+
public function sanitize_flavor( $flavor ) {
|
272 |
+
if ( in_array($flavor,array('recaptcha','grecaptcha')) )
|
273 |
+
return $flavor;
|
274 |
+
return 'grecaptcha';
|
275 |
+
}
|
276 |
+
public function sanitize_theme( $theme ) {
|
277 |
+
$themes_available = array(
|
278 |
+
'recaptcha' => array( 'white','red','blackglass','clean','custom' ),
|
279 |
+
'grecaptcha' => array( 'light','dark' ),
|
280 |
+
);
|
281 |
+
$flavor = get_option('recaptcha_flavor');
|
282 |
+
|
283 |
+
if ( isset($themes_available[$flavor] ) && in_array($theme,$themes_available[$flavor]) )
|
284 |
+
return $theme;
|
285 |
+
else if ( isset($themes_available[$flavor] ) )
|
286 |
+
return $themes_available[$flavor][0];
|
287 |
+
return 'light';
|
288 |
+
}
|
289 |
+
|
290 |
+
}
|
291 |
+
|
292 |
+
|
293 |
+
WordPress_reCaptcha_Options::instance();
|
294 |
+
|
js/recaptcha-options.js
ADDED
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
(function($){
|
2 |
+
$(document).ready(function(){
|
3 |
+
$('[name="recaptcha_flavor"]:checked').trigger('click');
|
4 |
+
});
|
5 |
+
$(document).on('click','[name="recaptcha_flavor"]',function(){
|
6 |
+
$('.recaptcha-select-theme')
|
7 |
+
.removeClass('flavor-recaptcha')
|
8 |
+
.removeClass('flavor-grecaptcha')
|
9 |
+
.addClass('flavor-'+$(this).val());
|
10 |
+
});
|
11 |
+
})(jQuery);
|
js/wpcf7.js
ADDED
@@ -0,0 +1,12 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/* *
|
2 |
+
* Override Contact form 7 Ajax success callback.
|
3 |
+
*/
|
4 |
+
(function($){
|
5 |
+
var wpcf7AjaxSuccess = $.wpcf7AjaxSuccess;
|
6 |
+
$.wpcf7AjaxSuccess = function(data) {
|
7 |
+
wpcf7AjaxSuccess.apply( this , arguments );
|
8 |
+
// reload recaptcha on invalid form.
|
9 |
+
if ( data.invalids && Recaptcha )
|
10 |
+
Recaptcha.reload();
|
11 |
+
}
|
12 |
+
})(jQuery);
|
languages/wp-recaptcha-integration-de_DE.mo
ADDED
Binary file
|
languages/wp-recaptcha-integration-de_DE.po
ADDED
@@ -0,0 +1,275 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
msgid ""
|
2 |
+
msgstr ""
|
3 |
+
"Project-Id-Version: WordPress reCaptcha Integration v0.9.0\n"
|
4 |
+
"Report-Msgid-Bugs-To: \n"
|
5 |
+
"POT-Creation-Date: \n"
|
6 |
+
"PO-Revision-Date: 2014-12-19 18:17:10+0000\n"
|
7 |
+
"Last-Translator: admin <joern@flyingletters.com>\n"
|
8 |
+
"Language-Team: \n"
|
9 |
+
"MIME-Version: 1.0\n"
|
10 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
+
"Content-Transfer-Encoding: 8bit\n"
|
12 |
+
"Plural-Forms: nplurals=2; plural=n != 1;\n"
|
13 |
+
"X-Generator: Loco - https://localise.biz/\n"
|
14 |
+
"X-Poedit-Language: German\n"
|
15 |
+
"X-Poedit-Country: GERMANY\n"
|
16 |
+
"X-Poedit-SourceCharset: utf-8\n"
|
17 |
+
"X-Poedit-KeywordsList: __;_e;__ngettext:1,2;_n:1,2;__ngettext_noop:1,2;_n_noop:1,2;_c,_nc:4c,1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2;\n"
|
18 |
+
"X-Poedit-Basepath: ../\n"
|
19 |
+
"X-Poedit-Bookmarks: \n"
|
20 |
+
"X-Poedit-SearchPath-0: .\n"
|
21 |
+
"X-Textdomain-Support: yes"
|
22 |
+
|
23 |
+
#: inc/ninja_forms_field_recaptcha.php:67
|
24 |
+
#: wp-recaptcha-integration.php:118
|
25 |
+
#: wp-recaptcha-integration.php:125
|
26 |
+
#@ wp-recaptcha-integration
|
27 |
+
msgid "<strong>Error:</strong> the Captcha didn’t verify."
|
28 |
+
msgstr "<strong>Fehler:</strong> Sicherheitstest nicht bestanden"
|
29 |
+
|
30 |
+
#: wp-recaptcha-integration.php:160
|
31 |
+
#@ wp-recaptcha-integration
|
32 |
+
msgid "Sorry, the Captcha didn’t verify."
|
33 |
+
msgstr "Tut uns leid, aber Sie haben den Sicherheitstest nicht bestanden."
|
34 |
+
|
35 |
+
#: wp-recaptcha-integration.php:200
|
36 |
+
#@ wp-recaptcha-integration
|
37 |
+
msgid "Incorrect please try again"
|
38 |
+
msgstr "Falsch. Bitte noch einmal versuchen"
|
39 |
+
|
40 |
+
#: wp-recaptcha-integration.php:202
|
41 |
+
#@ wp-recaptcha-integration
|
42 |
+
msgid "Enter the words above:"
|
43 |
+
msgstr "Geben Sie die Wörten oben ein."
|
44 |
+
|
45 |
+
#: wp-recaptcha-integration.php:203
|
46 |
+
#@ wp-recaptcha-integration
|
47 |
+
msgid "Enter the numbers you hear:"
|
48 |
+
msgstr "Geben Sie die Zahlen ein, die Sie hören:"
|
49 |
+
|
50 |
+
#: wp-recaptcha-integration.php:207
|
51 |
+
#@ wp-recaptcha-integration
|
52 |
+
msgid "Get another CAPTCHA"
|
53 |
+
msgstr "Anderes CAPTCHA."
|
54 |
+
|
55 |
+
#: wp-recaptcha-integration.php:208
|
56 |
+
#@ wp-recaptcha-integration
|
57 |
+
msgid "Get an audio CAPTCHA"
|
58 |
+
msgstr "Audio CAPTCHA"
|
59 |
+
|
60 |
+
#: wp-recaptcha-integration.php:209
|
61 |
+
#@ wp-recaptcha-integration
|
62 |
+
msgid "Get an image CAPTCHA"
|
63 |
+
msgstr "Bild CAPTCHA"
|
64 |
+
|
65 |
+
#: inc/contact_form_7_recaptcha.php:36
|
66 |
+
#: inc/ninja_forms_field_recaptcha.php:7
|
67 |
+
#@ wp-recaptcha-integration
|
68 |
+
msgid "reCAPTCHA"
|
69 |
+
msgstr "reCAPTCHA"
|
70 |
+
|
71 |
+
#: inc/contact_form_7_recaptcha.php:49
|
72 |
+
#@ contact-form-7
|
73 |
+
msgid "Required field?"
|
74 |
+
msgstr ""
|
75 |
+
|
76 |
+
#: inc/contact_form_7_recaptcha.php:50
|
77 |
+
#@ contact-form-7
|
78 |
+
msgid "Name"
|
79 |
+
msgstr ""
|
80 |
+
|
81 |
+
#: inc/contact_form_7_recaptcha.php:53
|
82 |
+
#@ contact-form-7
|
83 |
+
msgid "Copy this code and paste it into the form left."
|
84 |
+
msgstr ""
|
85 |
+
|
86 |
+
#: inc/contact_form_7_recaptcha.php:73
|
87 |
+
#@ wp-recaptcha-integration
|
88 |
+
msgid "The Captcha didn’t verify."
|
89 |
+
msgstr "Sicherheitstest nicht bestanden"
|
90 |
+
|
91 |
+
#: inc/recaptcha-options.php:36
|
92 |
+
#, php-format
|
93 |
+
#@ wp-recaptcha-integration
|
94 |
+
msgid "<strong>reCaptcha needs your attention:</strong> To make it work You need to enter an api key. <br />You can do so at the <a href=\"%s\">reCaptcha settings page</a>."
|
95 |
+
msgstr ""
|
96 |
+
"<strong>reCaptcha \n"
|
97 |
+
"braucht Deine Aufmerksamkeit:</strong> Damit das reCaptch funktioniert, mußt Du einen API-Schlüssel eintragen. <br />Zu den <a \n"
|
98 |
+
"href=\"%s\">reCaptcha Einstellungen</a>."
|
99 |
+
|
100 |
+
#: inc/recaptcha-options.php:52
|
101 |
+
#@ wp-recaptcha-integration
|
102 |
+
msgid "Public Key"
|
103 |
+
msgstr "Public Key"
|
104 |
+
|
105 |
+
#: inc/recaptcha-options.php:53
|
106 |
+
#@ wp-recaptcha-integration
|
107 |
+
msgid "Private Key"
|
108 |
+
msgstr "Private Key"
|
109 |
+
|
110 |
+
#: inc/recaptcha-options.php:54
|
111 |
+
#: inc/recaptcha-options.php:61
|
112 |
+
#@ wp-recaptcha-integration
|
113 |
+
msgid "Connecting"
|
114 |
+
msgstr "Verbindung"
|
115 |
+
|
116 |
+
#: inc/recaptcha-options.php:73
|
117 |
+
#@ wp-recaptcha-integration
|
118 |
+
msgid "Features"
|
119 |
+
msgstr "Funktionen"
|
120 |
+
|
121 |
+
#: inc/recaptcha-options.php:75
|
122 |
+
#@ wp-recaptcha-integration
|
123 |
+
msgid "Flavor"
|
124 |
+
msgstr "Geschmacksrichtung"
|
125 |
+
|
126 |
+
#: inc/recaptcha-options.php:86
|
127 |
+
#@ wp-recaptcha-integration
|
128 |
+
msgid "Old style reCAPTCHA where you type some cryptic text"
|
129 |
+
msgstr "Klassisch, man muß kryptische Wörter eingeben"
|
130 |
+
|
131 |
+
#: inc/recaptcha-options.php:91
|
132 |
+
#@ wp-recaptcha-integration
|
133 |
+
msgid "Theme"
|
134 |
+
msgstr "Theme"
|
135 |
+
|
136 |
+
#: inc/recaptcha-options.php:94
|
137 |
+
#@ wp-recaptcha-integration
|
138 |
+
msgid "Protect Comments"
|
139 |
+
msgstr "Kommentare schützen"
|
140 |
+
|
141 |
+
#: inc/recaptcha-options.php:96
|
142 |
+
#@ wp-recaptcha-integration
|
143 |
+
msgid "Protect comment forms with recaptcha."
|
144 |
+
msgstr "Das Kommentarformular mit einem reCaptcha schützen"
|
145 |
+
|
146 |
+
#: inc/recaptcha-options.php:99
|
147 |
+
#@ wp-recaptcha-integration
|
148 |
+
msgid "Protect Signup"
|
149 |
+
msgstr "Registrierung schützen"
|
150 |
+
|
151 |
+
#: inc/recaptcha-options.php:101
|
152 |
+
#@ wp-recaptcha-integration
|
153 |
+
msgid "Protect signup form with recaptcha."
|
154 |
+
msgstr "Die Registrierung mit einem reCaptcha schützen."
|
155 |
+
|
156 |
+
#: inc/recaptcha-options.php:104
|
157 |
+
#@ wp-recaptcha-integration
|
158 |
+
msgid "Protect Login"
|
159 |
+
msgstr "Login schützen"
|
160 |
+
|
161 |
+
#: inc/recaptcha-options.php:106
|
162 |
+
#@ wp-recaptcha-integration
|
163 |
+
msgid "Protect Login form with recaptcha."
|
164 |
+
msgstr "Das Anmeldeformular mit einem reCaptcha schützen"
|
165 |
+
|
166 |
+
#: inc/recaptcha-options.php:114
|
167 |
+
#@ wp-recaptcha-integration
|
168 |
+
msgid "Disable for known users"
|
169 |
+
msgstr "Abschalten bei bekannten Benutzern"
|
170 |
+
|
171 |
+
#: inc/recaptcha-options.php:116
|
172 |
+
#@ wp-recaptcha-integration
|
173 |
+
msgid "Disable reCaptcha verification for logged in users."
|
174 |
+
msgstr "Die reCaptcha-Verifizierung für eingeloggte Benutzer deaktivieren"
|
175 |
+
|
176 |
+
#: inc/recaptcha-options.php:120
|
177 |
+
#@ wp-recaptcha-integration
|
178 |
+
msgid "Please configure the public and private key. <a href=\"http://www.google.com/recaptcha/whyrecaptcha\">What are you trying to tell me?</a>"
|
179 |
+
msgstr "Bitte konfigurieren Sie den privaten und den Öffentlichen Schlüssel (private & public key). <a href=\"http://www.google.com/recaptcha/whyrecaptcha\">Was willst Du mir damit zu sagen?</a>"
|
180 |
+
|
181 |
+
#: inc/recaptcha-options.php:130
|
182 |
+
#, php-format
|
183 |
+
#@ wp-recaptcha-integration
|
184 |
+
msgid "Please register your blog through the <a href=\"%s\">Google reCAPTCHA admin page</a> and enter the public and private key in the fields below. <a href=\"%s\">What is this all about</a>"
|
185 |
+
msgstr ""
|
186 |
+
"Bitte registriere Deinen Blog auf der <a href=\"%s\">Google reCAPTCHA Admin Seite</a> \n"
|
187 |
+
"und trage unten den öffentlichen und privaten Schüssel ein. <a \n"
|
188 |
+
"href=\"%s\">Was erzählst Du mir da?</a>"
|
189 |
+
|
190 |
+
#: inc/recaptcha-options.php:136
|
191 |
+
#@ wp-recaptcha-integration
|
192 |
+
msgid "You already entered an API Key. Use the button below to enter it again."
|
193 |
+
msgstr "Du hast schon einen API-Schlüssel eingetragen. Klick den Button unten, um es nochmal zu tun."
|
194 |
+
|
195 |
+
#: inc/recaptcha-options.php:142
|
196 |
+
#@ wp-recaptcha-integration
|
197 |
+
msgid "New API Key"
|
198 |
+
msgstr "Neuer API-Schlüssel"
|
199 |
+
|
200 |
+
#: inc/recaptcha-options.php:149
|
201 |
+
#@ default
|
202 |
+
msgid "Cancel"
|
203 |
+
msgstr ""
|
204 |
+
|
205 |
+
#: inc/recaptcha-options.php:185
|
206 |
+
#@ wp-recaptcha-integration
|
207 |
+
msgid "Light"
|
208 |
+
msgstr "Hell"
|
209 |
+
|
210 |
+
#: inc/recaptcha-options.php:189
|
211 |
+
#@ wp-recaptcha-integration
|
212 |
+
msgid "Dark"
|
213 |
+
msgstr "Dunkel"
|
214 |
+
|
215 |
+
#: inc/recaptcha-options.php:194
|
216 |
+
#@ wp-recaptcha-integration
|
217 |
+
msgid "Red"
|
218 |
+
msgstr "Rot"
|
219 |
+
|
220 |
+
#: inc/recaptcha-options.php:198
|
221 |
+
#@ wp-recaptcha-integration
|
222 |
+
msgid "White"
|
223 |
+
msgstr "Weiß"
|
224 |
+
|
225 |
+
#: inc/recaptcha-options.php:202
|
226 |
+
#@ wp-recaptcha-integration
|
227 |
+
msgid "Black Glass"
|
228 |
+
msgstr "Schwarzes Glas"
|
229 |
+
|
230 |
+
#: inc/recaptcha-options.php:206
|
231 |
+
#@ wp-recaptcha-integration
|
232 |
+
msgid "Clean"
|
233 |
+
msgstr "Clean"
|
234 |
+
|
235 |
+
#: inc/recaptcha-options.php:210
|
236 |
+
#@ wp-recaptcha-integration
|
237 |
+
msgid "Custom"
|
238 |
+
msgstr "Eigenes"
|
239 |
+
|
240 |
+
#: inc/recaptcha-options.php:230
|
241 |
+
#@ wp-recaptcha-integration
|
242 |
+
msgid "Unstyled HTML to apply your own Stylesheets."
|
243 |
+
msgstr "Pures HTML für Deine eigenen Stylessheets"
|
244 |
+
|
245 |
+
#: inc/recaptcha-options.php:245
|
246 |
+
#: inc/recaptcha-options.php:261
|
247 |
+
#@ wp-recaptcha-integration
|
248 |
+
msgid "ReCaptcha"
|
249 |
+
msgstr "ReCaptcha"
|
250 |
+
|
251 |
+
#: inc/recaptcha-options.php:259
|
252 |
+
#@ default
|
253 |
+
msgid "Settings"
|
254 |
+
msgstr ""
|
255 |
+
|
256 |
+
#: inc/recaptcha-options.php:267
|
257 |
+
#@ default
|
258 |
+
msgid "Save Changes"
|
259 |
+
msgstr ""
|
260 |
+
|
261 |
+
#: inc/recaptcha-options.php:82
|
262 |
+
#@ wp-recaptcha-integration
|
263 |
+
msgid "No Captcha where you just click a button"
|
264 |
+
msgstr "No Captcha. Einfach Checkbox anklicken."
|
265 |
+
|
266 |
+
#: inc/recaptcha-options.php:109
|
267 |
+
#@ wp-recaptcha-integration
|
268 |
+
msgid "Protect Lost Password"
|
269 |
+
msgstr "Passwort verloren schützen"
|
270 |
+
|
271 |
+
#: inc/recaptcha-options.php:111
|
272 |
+
#@ wp-recaptcha-integration
|
273 |
+
msgid "Protect Lost Password form with recaptcha."
|
274 |
+
msgstr "Das Passwort Verloren Formular mit einem reCaptcha schützen"
|
275 |
+
|
languages/wp-recaptcha-integration-pt_BR.mo
ADDED
Binary file
|
languages/wp-recaptcha-integration-pt_BR.po
ADDED
@@ -0,0 +1,198 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
msgid ""
|
2 |
+
msgstr ""
|
3 |
+
"Project-Id-Version: WordPress reCaptcha Integration\n"
|
4 |
+
"Report-Msgid-Bugs-To: \n"
|
5 |
+
"POT-Creation-Date: \n"
|
6 |
+
"PO-Revision-Date: 2014-11-16 19:55-0300\n"
|
7 |
+
"Last-Translator: Vinicius R T Ferraz <contato@viniciusferraz.com>\n"
|
8 |
+
"Language-Team: \n"
|
9 |
+
"MIME-Version: 1.0\n"
|
10 |
+
"Content-Type: text/plain; charset=UTF-8\n"
|
11 |
+
"Content-Transfer-Encoding: 8bit\n"
|
12 |
+
"Plural-Forms: nplurals=2; plural=n != 1;\n"
|
13 |
+
"X-Generator: Poedit 1.5.4\n"
|
14 |
+
"X-Poedit-SourceCharset: UTF-8\n"
|
15 |
+
"X-Poedit-KeywordsList: __;_e;__ngettext:1,2;_n:1,2;__ngettext_noop:1,2;"
|
16 |
+
"_n_noop:1,2;_c,_nc:4c,1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2\n"
|
17 |
+
"X-Poedit-Basepath: ../\n"
|
18 |
+
"X-Textdomain-Support: yes\n"
|
19 |
+
"Language: pt_BR\n"
|
20 |
+
"X-Poedit-SearchPath-0: .\n"
|
21 |
+
|
22 |
+
# @ ninja-forms
|
23 |
+
#: inc/ninja_forms_field_recaptcha.php:7
|
24 |
+
msgid "reCAPTCHA"
|
25 |
+
msgstr ""
|
26 |
+
|
27 |
+
# @ recaptcha
|
28 |
+
#: inc/ninja_forms_field_recaptcha.php:84 wp-recaptcha-integration.php:75
|
29 |
+
#: wp-recaptcha-integration.php:82
|
30 |
+
msgid "<strong>Error:</strong> the Captcha didn’t verify."
|
31 |
+
msgstr "<strong>Erro:</strong> o Captcha digitado está incorreto."
|
32 |
+
|
33 |
+
# @ recaptcha
|
34 |
+
#: inc/recaptcha-options.php:27 inc/recaptcha-options.php:97
|
35 |
+
msgid "ReCaptcha Settings"
|
36 |
+
msgstr "Configurações do ReCaptcha"
|
37 |
+
|
38 |
+
# @ recaptcha
|
39 |
+
#: inc/recaptcha-options.php:28
|
40 |
+
msgid "ReCaptcha Modules"
|
41 |
+
msgstr "Módulo ReCaptcha"
|
42 |
+
|
43 |
+
# @ recaptcha
|
44 |
+
#: inc/recaptcha-options.php:30
|
45 |
+
msgid "Public Key"
|
46 |
+
msgstr "Chave pública (Public Key)"
|
47 |
+
|
48 |
+
# @ recaptcha
|
49 |
+
#: inc/recaptcha-options.php:31
|
50 |
+
msgid "Private Key"
|
51 |
+
msgstr "Chave privada (Private Key)"
|
52 |
+
|
53 |
+
# @ recaptcha
|
54 |
+
#: inc/recaptcha-options.php:32
|
55 |
+
msgid "Theme"
|
56 |
+
msgstr "Tema"
|
57 |
+
|
58 |
+
# @ recaptcha
|
59 |
+
#: inc/recaptcha-options.php:35
|
60 |
+
msgid "Protect Comments"
|
61 |
+
msgstr "Proteger Comentários"
|
62 |
+
|
63 |
+
# @ recaptcha
|
64 |
+
#: inc/recaptcha-options.php:37
|
65 |
+
msgid "Protect comment forms with recaptcha."
|
66 |
+
msgstr "Protege o formulário dos comentários com o reCAPTCHA."
|
67 |
+
|
68 |
+
# @ recaptcha
|
69 |
+
#: inc/recaptcha-options.php:40
|
70 |
+
msgid "Protect Signup"
|
71 |
+
msgstr "Proteger Cadastro"
|
72 |
+
|
73 |
+
# @ recaptcha
|
74 |
+
#: inc/recaptcha-options.php:42
|
75 |
+
msgid "Protect signup form with recaptcha."
|
76 |
+
msgstr "Protege o formulário de cadastro de usuários com o reCAPTCHA."
|
77 |
+
|
78 |
+
# @ recaptcha
|
79 |
+
#: inc/recaptcha-options.php:45
|
80 |
+
msgid "Protect Login"
|
81 |
+
msgstr "Proteger Login"
|
82 |
+
|
83 |
+
# @ recaptcha
|
84 |
+
#: inc/recaptcha-options.php:47
|
85 |
+
msgid "Protect Login form with recaptcha."
|
86 |
+
msgstr "Protege o formulário de login com o reCAPTCHA."
|
87 |
+
|
88 |
+
# @ recaptcha
|
89 |
+
#: inc/recaptcha-options.php:50
|
90 |
+
msgid "Disable for known users"
|
91 |
+
msgstr "Desabilitar para usuários logados."
|
92 |
+
|
93 |
+
# @ recaptcha
|
94 |
+
#: inc/recaptcha-options.php:52
|
95 |
+
msgid "Disable reCaptcha verification for logged in users."
|
96 |
+
msgstr "Se o usuário estiver logado, não exigir o reCAPTCHA nos formulários."
|
97 |
+
|
98 |
+
# @ recaptcha
|
99 |
+
#: inc/recaptcha-options.php:56
|
100 |
+
msgid ""
|
101 |
+
"Please configure the public and private key. <a href=\"http://www.google.com/"
|
102 |
+
"recaptcha/whyrecaptcha\">What are you trying to tell me?</a>"
|
103 |
+
msgstr ""
|
104 |
+
"Por favor, configure as chaves pública (Public Key) e privada (Private Key). "
|
105 |
+
"<a href=\"http://www.google.com/recaptcha/whyrecaptcha\">O que isso "
|
106 |
+
"significa?</a>"
|
107 |
+
|
108 |
+
# @ recaptcha
|
109 |
+
#: inc/recaptcha-options.php:61
|
110 |
+
msgid ""
|
111 |
+
"Please enter the public and private key that you got from <a href=\"http://"
|
112 |
+
"www.google.com/recaptcha\">Google raCAPTCHA</a>."
|
113 |
+
msgstr ""
|
114 |
+
"Por favor, entre com as chaves pública (Public Key) e privada (Private Key) "
|
115 |
+
"fornecidos pelo <a href=\"http://www.google.com/recaptcha\">Google "
|
116 |
+
"raCAPTCHA</a>."
|
117 |
+
|
118 |
+
# @ recaptcha
|
119 |
+
#: inc/recaptcha-options.php:82
|
120 |
+
msgid "Red"
|
121 |
+
msgstr "Vermelho"
|
122 |
+
|
123 |
+
# @ recaptcha
|
124 |
+
#: inc/recaptcha-options.php:83
|
125 |
+
msgid "White"
|
126 |
+
msgstr "Branco"
|
127 |
+
|
128 |
+
# @ recaptcha
|
129 |
+
#: inc/recaptcha-options.php:84
|
130 |
+
msgid "Black Glass"
|
131 |
+
msgstr "Escuro"
|
132 |
+
|
133 |
+
# @ recaptcha
|
134 |
+
#: inc/recaptcha-options.php:85
|
135 |
+
msgid "Clean"
|
136 |
+
msgstr "Clean"
|
137 |
+
|
138 |
+
# @ recaptcha
|
139 |
+
#: inc/recaptcha-options.php:97 inc/recaptcha-options.php:107
|
140 |
+
msgid "ReCaptcha"
|
141 |
+
msgstr "ReCaptcha"
|
142 |
+
|
143 |
+
# @ default
|
144 |
+
#: inc/recaptcha-options.php:105
|
145 |
+
msgid "Settings"
|
146 |
+
msgstr "Configurações"
|
147 |
+
|
148 |
+
# @ default
|
149 |
+
#: inc/recaptcha-options.php:113
|
150 |
+
msgid "Save Changes"
|
151 |
+
msgstr "Salvar Configurações"
|
152 |
+
|
153 |
+
# @ recaptcha
|
154 |
+
#. translators: plugin header field 'Name'
|
155 |
+
#: wp-recaptcha-integration.php:0
|
156 |
+
msgid "WordPress reCaptcha Integration"
|
157 |
+
msgstr ""
|
158 |
+
|
159 |
+
# @ recaptcha
|
160 |
+
#. translators: plugin header field 'PluginURI'
|
161 |
+
#: wp-recaptcha-integration.php:0
|
162 |
+
msgid "https://github.com/mcguffin/wp-recaptcha-integration"
|
163 |
+
msgstr ""
|
164 |
+
|
165 |
+
# @ recaptcha
|
166 |
+
#. translators: plugin header field 'Description'
|
167 |
+
#: wp-recaptcha-integration.php:0
|
168 |
+
msgid ""
|
169 |
+
"Integrate reCaptcha in Your blog. Provides of the box integration for "
|
170 |
+
"Signup, login and comment forms as well as a plugin API for your own "
|
171 |
+
"integrations."
|
172 |
+
msgstr ""
|
173 |
+
"Integre o reCaptcha com o seu blog. Inclui integração com cadastro, login e "
|
174 |
+
"comentários, bem como uma API para você desenvolver suas próprias "
|
175 |
+
"integrações."
|
176 |
+
|
177 |
+
# @ recaptcha
|
178 |
+
#. translators: plugin header field 'Author'
|
179 |
+
#: wp-recaptcha-integration.php:0
|
180 |
+
msgid "Jörn Lund"
|
181 |
+
msgstr ""
|
182 |
+
|
183 |
+
# @ recaptcha
|
184 |
+
#. translators: plugin header field 'AuthorURI'
|
185 |
+
#: wp-recaptcha-integration.php:0
|
186 |
+
msgid "https://github.com/mcguffin/"
|
187 |
+
msgstr ""
|
188 |
+
|
189 |
+
# @ recaptcha
|
190 |
+
#. translators: plugin header field 'Version'
|
191 |
+
#: wp-recaptcha-integration.php:0
|
192 |
+
msgid "0.0.3"
|
193 |
+
msgstr ""
|
194 |
+
|
195 |
+
# @ recaptcha
|
196 |
+
#: wp-recaptcha-integration.php:96
|
197 |
+
msgid "Sorry, the Captcha didn’t verify."
|
198 |
+
msgstr "Desculpe, o CAPTCHA digitado está incorreto."
|
readme.txt
ADDED
@@ -0,0 +1,84 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
=== WordPress ReCaptcha Integration ===
|
2 |
+
Contributors: podpirate
|
3 |
+
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=F8NKC6TCASUXE
|
4 |
+
Tags: security, captcha, recaptcha,
|
5 |
+
Requires at least: 3.8
|
6 |
+
Tested up to: 4.1
|
7 |
+
Stable tag: trunk
|
8 |
+
License: GPLv2 or later
|
9 |
+
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
+
|
11 |
+
reCaptcha for login, signup, comment forms, Ninja Forms and Contact Form 7.
|
12 |
+
|
13 |
+
== Description ==
|
14 |
+
|
15 |
+
Integrate reCaptcha in your blog. Supports new style recaptcha. Provides of the box integration
|
16 |
+
for signup, login, comment forms, Ninja Forms and contact form 7 as well as a plugin API for
|
17 |
+
your own integrations.
|
18 |
+
|
19 |
+
= Features: =
|
20 |
+
- Secures login, signup and comments with a recaptcha.
|
21 |
+
- Supports old as well as new reCaptcha.
|
22 |
+
- [Ninja Forms](http://ninjaforms.com/) integration
|
23 |
+
- [Contact Form 7](https://wordpress.org/plugins/contact-form-7/) integration
|
24 |
+
|
25 |
+
Latest Files on GitHub: [https://github.com/mcguffin/wp-recaptcha-integration](https://github.com/mcguffin/wp-recaptcha-integration)
|
26 |
+
|
27 |
+
== Installation ==
|
28 |
+
|
29 |
+
First follow the standard [WordPress plugin installation procedere](http://codex.wordpress.org/Managing_Plugins).
|
30 |
+
|
31 |
+
Then goto the [Google Recaptcha Site](http://www.google.com/recaptcha), sign up your site and enter your API-Keys on the configuration page.
|
32 |
+
|
33 |
+
== Frequently asked questions ==
|
34 |
+
|
35 |
+
= I found a bug. Where should I post it? =
|
36 |
+
|
37 |
+
I personally prefer GitHub but you can post it in the forum as well. The plugin code is here: [GitHub](https://github.com/mcguffin/wp-recaptcha-integration)
|
38 |
+
|
39 |
+
= I want to use the latest files. How can I do this? =
|
40 |
+
|
41 |
+
Use the GitHub Repo rather than the WordPress Plugin. Do as follows:
|
42 |
+
|
43 |
+
1. If you haven't already done: [Install git](https://help.github.com/articles/set-up-git)
|
44 |
+
|
45 |
+
2. in the console cd into Your 'wp-content/plugins´ directory
|
46 |
+
|
47 |
+
3. type `git clone git@github.com:mcguffin/wp-recaptcha-integration.git`
|
48 |
+
|
49 |
+
4. If you want to update to the latest files (be careful, might be untested on Your WP-Version) type git pull´.
|
50 |
+
|
51 |
+
Please note that the GitHub repository is more likely to contain unstable and untested code. Urgent fixes
|
52 |
+
concerning stability or security (like crashes, vulnerabilities and alike) are more likely to be fixed in
|
53 |
+
the official WP plugin repository first.
|
54 |
+
|
55 |
+
= I found a bug and fixed it. How can I contribute? =
|
56 |
+
|
57 |
+
Either post it on [GitHub](https://github.com/mcguffin/wp-recaptcha-integration) or—if you are working on a cloned repository—send me a pull request.
|
58 |
+
|
59 |
+
= Will you accept translations? =
|
60 |
+
|
61 |
+
Yep sure! (And a warm thankyou in advance.) It might take some time until your localization
|
62 |
+
will appear in an official plugin release, and it is not unlikely that I will have added
|
63 |
+
or removed some strings in the meantime.
|
64 |
+
|
65 |
+
As soon as there is a [public centralized repository for WordPress plugin translations](https://translate.wordpress.org/projects/wp-plugins)
|
66 |
+
I will migrate all the translation stuff there.
|
67 |
+
|
68 |
+
|
69 |
+
== Screenshots ==
|
70 |
+
|
71 |
+
1. Plugin Settings
|
72 |
+
2. Ninja Form Integration
|
73 |
+
3. Contact Form 7 Integration
|
74 |
+
|
75 |
+
== Changelog ==
|
76 |
+
|
77 |
+
= 1.0.0 =
|
78 |
+
Initial Release
|
79 |
+
|
80 |
+
== Plugin API ==
|
81 |
+
|
82 |
+
The plugin offers some filters to allow themes and other plugins to hook in.
|
83 |
+
|
84 |
+
See [GitHub-Repo](https://github.com/mcguffin/wp-recaptcha-integration) for details.
|
recaptchalib.php
ADDED
@@ -0,0 +1,277 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
* This is a PHP library that handles calling reCAPTCHA.
|
4 |
+
* - Documentation and latest version
|
5 |
+
* http://recaptcha.net/plugins/php/
|
6 |
+
* - Get a reCAPTCHA API Key
|
7 |
+
* https://www.google.com/recaptcha/admin/create
|
8 |
+
* - Discussion group
|
9 |
+
* http://groups.google.com/group/recaptcha
|
10 |
+
*
|
11 |
+
* Copyright (c) 2007 reCAPTCHA -- http://recaptcha.net
|
12 |
+
* AUTHORS:
|
13 |
+
* Mike Crawford
|
14 |
+
* Ben Maurer
|
15 |
+
*
|
16 |
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
17 |
+
* of this software and associated documentation files (the "Software"), to deal
|
18 |
+
* in the Software without restriction, including without limitation the rights
|
19 |
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
20 |
+
* copies of the Software, and to permit persons to whom the Software is
|
21 |
+
* furnished to do so, subject to the following conditions:
|
22 |
+
*
|
23 |
+
* The above copyright notice and this permission notice shall be included in
|
24 |
+
* all copies or substantial portions of the Software.
|
25 |
+
*
|
26 |
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
27 |
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
28 |
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
29 |
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
30 |
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
31 |
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
32 |
+
* THE SOFTWARE.
|
33 |
+
*/
|
34 |
+
|
35 |
+
/**
|
36 |
+
* The reCAPTCHA server URL's
|
37 |
+
*/
|
38 |
+
define("RECAPTCHA_API_SERVER", "http://www.google.com/recaptcha/api");
|
39 |
+
define("RECAPTCHA_API_SECURE_SERVER", "https://www.google.com/recaptcha/api");
|
40 |
+
define("RECAPTCHA_VERIFY_SERVER", "www.google.com");
|
41 |
+
|
42 |
+
/**
|
43 |
+
* Encodes the given data into a query string format
|
44 |
+
* @param $data - array of string elements to be encoded
|
45 |
+
* @return string - encoded request
|
46 |
+
*/
|
47 |
+
function _recaptcha_qsencode ($data) {
|
48 |
+
$req = "";
|
49 |
+
foreach ( $data as $key => $value )
|
50 |
+
$req .= $key . '=' . urlencode( stripslashes($value) ) . '&';
|
51 |
+
|
52 |
+
// Cut the last '&'
|
53 |
+
$req=substr($req,0,strlen($req)-1);
|
54 |
+
return $req;
|
55 |
+
}
|
56 |
+
|
57 |
+
|
58 |
+
|
59 |
+
/**
|
60 |
+
* Submits an HTTP POST to a reCAPTCHA server
|
61 |
+
* @param string $host
|
62 |
+
* @param string $path
|
63 |
+
* @param array $data
|
64 |
+
* @param int port
|
65 |
+
* @return array response
|
66 |
+
*/
|
67 |
+
function _recaptcha_http_post($host, $path, $data, $port = 80) {
|
68 |
+
|
69 |
+
$req = _recaptcha_qsencode ($data);
|
70 |
+
|
71 |
+
$http_request = "POST $path HTTP/1.0\r\n";
|
72 |
+
$http_request .= "Host: $host\r\n";
|
73 |
+
$http_request .= "Content-Type: application/x-www-form-urlencoded;\r\n";
|
74 |
+
$http_request .= "Content-Length: " . strlen($req) . "\r\n";
|
75 |
+
$http_request .= "User-Agent: reCAPTCHA/PHP\r\n";
|
76 |
+
$http_request .= "\r\n";
|
77 |
+
$http_request .= $req;
|
78 |
+
|
79 |
+
$response = '';
|
80 |
+
if( false == ( $fs = @fsockopen($host, $port, $errno, $errstr, 10) ) ) {
|
81 |
+
die ('Could not open socket');
|
82 |
+
}
|
83 |
+
|
84 |
+
fwrite($fs, $http_request);
|
85 |
+
|
86 |
+
while ( !feof($fs) )
|
87 |
+
$response .= fgets($fs, 1160); // One TCP-IP packet
|
88 |
+
fclose($fs);
|
89 |
+
$response = explode("\r\n\r\n", $response, 2);
|
90 |
+
|
91 |
+
return $response;
|
92 |
+
}
|
93 |
+
|
94 |
+
|
95 |
+
|
96 |
+
/**
|
97 |
+
* Gets the challenge HTML (javascript and non-javascript version).
|
98 |
+
* This is called from the browser, and the resulting reCAPTCHA HTML widget
|
99 |
+
* is embedded within the HTML form it was called from.
|
100 |
+
* @param string $pubkey A public key for reCAPTCHA
|
101 |
+
* @param string $error The error given by reCAPTCHA (optional, default is null)
|
102 |
+
* @param boolean $use_ssl Should the request be made over ssl? (optional, default is false)
|
103 |
+
|
104 |
+
* @return string - The HTML to be embedded in the user's form.
|
105 |
+
*/
|
106 |
+
function recaptcha_get_html ($pubkey, $error = null, $use_ssl = false)
|
107 |
+
{
|
108 |
+
if ($pubkey == null || $pubkey == '') {
|
109 |
+
die ("To use reCAPTCHA you must get an API key from <a href='https://www.google.com/recaptcha/admin/create'>https://www.google.com/recaptcha/admin/create</a>");
|
110 |
+
}
|
111 |
+
|
112 |
+
if ($use_ssl) {
|
113 |
+
$server = RECAPTCHA_API_SECURE_SERVER;
|
114 |
+
} else {
|
115 |
+
$server = RECAPTCHA_API_SERVER;
|
116 |
+
}
|
117 |
+
|
118 |
+
$errorpart = "";
|
119 |
+
if ($error) {
|
120 |
+
$errorpart = "&error=" . $error;
|
121 |
+
}
|
122 |
+
return '<script type="text/javascript" src="'. $server . '/challenge?k=' . $pubkey . $errorpart . '"></script>
|
123 |
+
|
124 |
+
<noscript>
|
125 |
+
<iframe src="'. $server . '/noscript?k=' . $pubkey . $errorpart . '" height="300" width="500" frameborder="0"></iframe><br/>
|
126 |
+
<textarea name="recaptcha_challenge_field" rows="3" cols="40"></textarea>
|
127 |
+
<input type="hidden" name="recaptcha_response_field" value="manual_challenge"/>
|
128 |
+
</noscript>';
|
129 |
+
}
|
130 |
+
|
131 |
+
|
132 |
+
|
133 |
+
|
134 |
+
/**
|
135 |
+
* A ReCaptchaResponse is returned from recaptcha_check_answer()
|
136 |
+
*/
|
137 |
+
class ReCaptchaResponse {
|
138 |
+
var $is_valid;
|
139 |
+
var $error;
|
140 |
+
}
|
141 |
+
|
142 |
+
|
143 |
+
/**
|
144 |
+
* Calls an HTTP POST function to verify if the user's guess was correct
|
145 |
+
* @param string $privkey
|
146 |
+
* @param string $remoteip
|
147 |
+
* @param string $challenge
|
148 |
+
* @param string $response
|
149 |
+
* @param array $extra_params an array of extra variables to post to the server
|
150 |
+
* @return ReCaptchaResponse
|
151 |
+
*/
|
152 |
+
function recaptcha_check_answer ($privkey, $remoteip, $challenge, $response, $extra_params = array())
|
153 |
+
{
|
154 |
+
if ($privkey == null || $privkey == '') {
|
155 |
+
die ("To use reCAPTCHA you must get an API key from <a href='https://www.google.com/recaptcha/admin/create'>https://www.google.com/recaptcha/admin/create</a>");
|
156 |
+
}
|
157 |
+
|
158 |
+
if ($remoteip == null || $remoteip == '') {
|
159 |
+
die ("For security reasons, you must pass the remote ip to reCAPTCHA");
|
160 |
+
}
|
161 |
+
|
162 |
+
|
163 |
+
|
164 |
+
//discard spam submissions
|
165 |
+
if ($challenge == null || strlen($challenge) == 0 || $response == null || strlen($response) == 0) {
|
166 |
+
$recaptcha_response = new ReCaptchaResponse();
|
167 |
+
$recaptcha_response->is_valid = false;
|
168 |
+
$recaptcha_response->error = 'incorrect-captcha-sol';
|
169 |
+
return $recaptcha_response;
|
170 |
+
}
|
171 |
+
|
172 |
+
$response = _recaptcha_http_post (RECAPTCHA_VERIFY_SERVER, "/recaptcha/api/verify",
|
173 |
+
array (
|
174 |
+
'privatekey' => $privkey,
|
175 |
+
'remoteip' => $remoteip,
|
176 |
+
'challenge' => $challenge,
|
177 |
+
'response' => $response
|
178 |
+
) + $extra_params
|
179 |
+
);
|
180 |
+
|
181 |
+
$answers = explode ("\n", $response [1]);
|
182 |
+
$recaptcha_response = new ReCaptchaResponse();
|
183 |
+
|
184 |
+
if (trim ($answers [0]) == 'true') {
|
185 |
+
$recaptcha_response->is_valid = true;
|
186 |
+
}
|
187 |
+
else {
|
188 |
+
$recaptcha_response->is_valid = false;
|
189 |
+
$recaptcha_response->error = $answers [1];
|
190 |
+
}
|
191 |
+
return $recaptcha_response;
|
192 |
+
|
193 |
+
}
|
194 |
+
|
195 |
+
/**
|
196 |
+
* gets a URL where the user can sign up for reCAPTCHA. If your application
|
197 |
+
* has a configuration page where you enter a key, you should provide a link
|
198 |
+
* using this function.
|
199 |
+
* @param string $domain The domain where the page is hosted
|
200 |
+
* @param string $appname The name of your application
|
201 |
+
*/
|
202 |
+
function recaptcha_get_signup_url ($domain = null, $appname = null) {
|
203 |
+
return "https://www.google.com/recaptcha/admin/create?" . _recaptcha_qsencode (array ('domains' => $domain, 'app' => $appname));
|
204 |
+
}
|
205 |
+
|
206 |
+
function _recaptcha_aes_pad($val) {
|
207 |
+
$block_size = 16;
|
208 |
+
$numpad = $block_size - (strlen ($val) % $block_size);
|
209 |
+
return str_pad($val, strlen ($val) + $numpad, chr($numpad));
|
210 |
+
}
|
211 |
+
|
212 |
+
/* Mailhide related code */
|
213 |
+
|
214 |
+
function _recaptcha_aes_encrypt($val,$ky) {
|
215 |
+
if (! function_exists ("mcrypt_encrypt")) {
|
216 |
+
die ("To use reCAPTCHA Mailhide, you need to have the mcrypt php module installed.");
|
217 |
+
}
|
218 |
+
$mode=MCRYPT_MODE_CBC;
|
219 |
+
$enc=MCRYPT_RIJNDAEL_128;
|
220 |
+
$val=_recaptcha_aes_pad($val);
|
221 |
+
return mcrypt_encrypt($enc, $ky, $val, $mode, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0");
|
222 |
+
}
|
223 |
+
|
224 |
+
|
225 |
+
function _recaptcha_mailhide_urlbase64 ($x) {
|
226 |
+
return strtr(base64_encode ($x), '+/', '-_');
|
227 |
+
}
|
228 |
+
|
229 |
+
/* gets the reCAPTCHA Mailhide url for a given email, public key and private key */
|
230 |
+
function recaptcha_mailhide_url($pubkey, $privkey, $email) {
|
231 |
+
if ($pubkey == '' || $pubkey == null || $privkey == "" || $privkey == null) {
|
232 |
+
die ("To use reCAPTCHA Mailhide, you have to sign up for a public and private key, " .
|
233 |
+
"you can do so at <a href='http://www.google.com/recaptcha/mailhide/apikey'>http://www.google.com/recaptcha/mailhide/apikey</a>");
|
234 |
+
}
|
235 |
+
|
236 |
+
|
237 |
+
$ky = pack('H*', $privkey);
|
238 |
+
$cryptmail = _recaptcha_aes_encrypt ($email, $ky);
|
239 |
+
|
240 |
+
return "http://www.google.com/recaptcha/mailhide/d?k=" . $pubkey . "&c=" . _recaptcha_mailhide_urlbase64 ($cryptmail);
|
241 |
+
}
|
242 |
+
|
243 |
+
/**
|
244 |
+
* gets the parts of the email to expose to the user.
|
245 |
+
* eg, given johndoe@example,com return ["john", "example.com"].
|
246 |
+
* the email is then displayed as john...@example.com
|
247 |
+
*/
|
248 |
+
function _recaptcha_mailhide_email_parts ($email) {
|
249 |
+
$arr = preg_split("/@/", $email );
|
250 |
+
|
251 |
+
if (strlen ($arr[0]) <= 4) {
|
252 |
+
$arr[0] = substr ($arr[0], 0, 1);
|
253 |
+
} else if (strlen ($arr[0]) <= 6) {
|
254 |
+
$arr[0] = substr ($arr[0], 0, 3);
|
255 |
+
} else {
|
256 |
+
$arr[0] = substr ($arr[0], 0, 4);
|
257 |
+
}
|
258 |
+
return $arr;
|
259 |
+
}
|
260 |
+
|
261 |
+
/**
|
262 |
+
* Gets html to display an email address given a public an private key.
|
263 |
+
* to get a key, go to:
|
264 |
+
*
|
265 |
+
* http://www.google.com/recaptcha/mailhide/apikey
|
266 |
+
*/
|
267 |
+
function recaptcha_mailhide_html($pubkey, $privkey, $email) {
|
268 |
+
$emailparts = _recaptcha_mailhide_email_parts ($email);
|
269 |
+
$url = recaptcha_mailhide_url ($pubkey, $privkey, $email);
|
270 |
+
|
271 |
+
return htmlentities($emailparts[0]) . "<a href='" . htmlentities ($url) .
|
272 |
+
"' onclick=\"window.open('" . htmlentities ($url) . "', '', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=500,height=300'); return false;\" title=\"Reveal this e-mail address\">...</a>@" . htmlentities ($emailparts [1]);
|
273 |
+
|
274 |
+
}
|
275 |
+
|
276 |
+
|
277 |
+
?>
|
screenshot-1.png
ADDED
Binary file
|
screenshot-2.png
ADDED
Binary file
|
screenshot-3.png
ADDED
Binary file
|
wp-recaptcha-integration.php
ADDED
@@ -0,0 +1,291 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/*
|
3 |
+
Plugin Name: WP reCaptcha Integration
|
4 |
+
Plugin URI: https://wordpress.org/plugins/wp-recaptcha-integration/
|
5 |
+
Description: Integrate reCaptcha in your blog. Supports no Captcha (new style recaptcha) as well as the old stle reCaptcha. Provides of the box integration for signup, login, comment forms, lost password, Ninja Forms and contact form 7.
|
6 |
+
Version: 0.9.0
|
7 |
+
Author: Jörn Lund
|
8 |
+
Author URI: https://github.com/mcguffin/
|
9 |
+
*/
|
10 |
+
|
11 |
+
|
12 |
+
|
13 |
+
|
14 |
+
class WordPress_reCaptcha {
|
15 |
+
|
16 |
+
private $_has_api_key = false;
|
17 |
+
|
18 |
+
private $last_error = '';
|
19 |
+
|
20 |
+
/**
|
21 |
+
* Holding the singleton instance
|
22 |
+
*/
|
23 |
+
private static $_instance = null;
|
24 |
+
|
25 |
+
/**
|
26 |
+
* @return WordPress_reCaptcha_Options The options manager instance
|
27 |
+
*/
|
28 |
+
public static function instance(){
|
29 |
+
if ( is_null( self::$_instance ) )
|
30 |
+
self::$_instance = new self();
|
31 |
+
return self::$_instance;
|
32 |
+
}
|
33 |
+
|
34 |
+
/**
|
35 |
+
* Prevent from creating more than one instance
|
36 |
+
*/
|
37 |
+
private function __clone() {
|
38 |
+
}
|
39 |
+
|
40 |
+
/**
|
41 |
+
* Prevent from creating more than one instance
|
42 |
+
*/
|
43 |
+
private function __construct() {
|
44 |
+
add_option('recaptcha_publickey','');
|
45 |
+
add_option('recaptcha_privatekey','');
|
46 |
+
|
47 |
+
add_option('recaptcha_flavor','grecaptcha');
|
48 |
+
add_option('recaptcha_theme','light');
|
49 |
+
add_option('recaptcha_enable_comments' , true);
|
50 |
+
add_option('recaptcha_enable_signup' , true);
|
51 |
+
add_option('recaptcha_enable_login' , false);
|
52 |
+
add_option('recaptcha_enable_lostpw' , false);
|
53 |
+
add_option('recaptcha_disable_for_known_users' , true);
|
54 |
+
|
55 |
+
$this->_has_api_key = get_option( 'recaptcha_publickey' ) && get_option( 'recaptcha_privatekey' );
|
56 |
+
|
57 |
+
if ( $this->_has_api_key ) {
|
58 |
+
add_action( 'wp_head' , array($this,'recaptcha_script') );
|
59 |
+
|
60 |
+
add_action('init' , array(&$this,'init') );
|
61 |
+
add_action('plugins_loaded' , array(&$this,'plugins_loaded') );
|
62 |
+
|
63 |
+
if ( get_option('recaptcha_enable_signup') || get_option('recaptcha_enable_login') || get_option('recaptcha_enable_lostpw') )
|
64 |
+
add_action( 'login_head' , array(&$this,'recaptcha_script') );
|
65 |
+
}
|
66 |
+
|
67 |
+
register_activation_hook( __FILE__ , array( __CLASS__ , 'activate' ) );
|
68 |
+
register_deactivation_hook( __FILE__ , array( __CLASS__ , 'deactivate' ) );
|
69 |
+
register_uninstall_hook( __FILE__ , array( __CLASS__ , 'uninstall' ) );
|
70 |
+
|
71 |
+
}
|
72 |
+
function has_api_key() {
|
73 |
+
return $this->_has_api_key;
|
74 |
+
}
|
75 |
+
|
76 |
+
function plugins_loaded() {
|
77 |
+
if ( $this->_has_api_key ) {
|
78 |
+
// check if ninja forms is present
|
79 |
+
if ( class_exists('Ninja_Forms') || function_exists('ninja_forms_register_field') )
|
80 |
+
include_once dirname(__FILE__).'/inc/ninja_forms_field_recaptcha.php';
|
81 |
+
|
82 |
+
// check if contact form 7 forms is present
|
83 |
+
if ( function_exists('wpcf7') )
|
84 |
+
include_once dirname(__FILE__).'/inc/contact_form_7_recaptcha.php';
|
85 |
+
}
|
86 |
+
}
|
87 |
+
function init() {
|
88 |
+
load_plugin_textdomain( 'wp-recaptcha-integration', false , dirname( plugin_basename( __FILE__ ) ).'/languages/' );
|
89 |
+
|
90 |
+
$require_recaptcha = $this->is_required();
|
91 |
+
|
92 |
+
if ( get_option('recaptcha_enable_comments') && $require_recaptcha ) {
|
93 |
+
add_action('comment_form',array($this,'print_recaptcha_html'));
|
94 |
+
add_action('pre_comment_on_post',array($this,'recaptcha_check_or_die'));
|
95 |
+
// add action @ comment approve
|
96 |
+
}
|
97 |
+
if ( get_option('recaptcha_enable_signup') && $require_recaptcha ) {
|
98 |
+
add_action('register_form',array($this,'print_recaptcha_html'));
|
99 |
+
add_filter('registration_errors',array(&$this,'login_errors'));
|
100 |
+
}
|
101 |
+
if ( get_option('recaptcha_enable_login') && $require_recaptcha ) {
|
102 |
+
add_action('login_form',array($this,'print_recaptcha_html'));
|
103 |
+
add_filter('wp_authenticate_user',array(&$this,'deny_login'),99 );
|
104 |
+
}
|
105 |
+
if ( get_option('recaptcha_enable_lostpw') && $require_recaptcha ) {
|
106 |
+
add_action('lostpassword_form' , array($this,'print_recaptcha_html'));
|
107 |
+
add_filter('lostpassword_post' , array(&$this,'recaptcha_check_or_die'),99 );
|
108 |
+
}
|
109 |
+
}
|
110 |
+
|
111 |
+
function is_required() {
|
112 |
+
$is_required = ! ( get_option('recaptcha_disable_for_known_users') && current_user_can( 'read' ) );
|
113 |
+
return apply_filters( 'recaptcha_required' , $is_required );
|
114 |
+
}
|
115 |
+
|
116 |
+
function deny_login( $user ){
|
117 |
+
if ( isset( $_POST["log"] ) && ! $this->recaptcha_check() ) {
|
118 |
+
return new WP_Error( 'captcha_error' , __("<strong>Error:</strong> the Captcha didn’t verify.",'wp-recaptcha-integration') );
|
119 |
+
} else {
|
120 |
+
return $user;
|
121 |
+
}
|
122 |
+
}
|
123 |
+
function login_errors( $errors ) {
|
124 |
+
if ( isset( $_POST["log"] ) && ! $this->recaptcha_check() ) {
|
125 |
+
$errors->add( 'captcha_error' , __("<strong>Error:</strong> the Captcha didn’t verify.",'wp-recaptcha-integration') );
|
126 |
+
}
|
127 |
+
return $errors;
|
128 |
+
}
|
129 |
+
|
130 |
+
function recaptcha_script() {
|
131 |
+
switch ( get_option( 'recaptcha_flavor' ) ) {
|
132 |
+
case 'grecaptcha':
|
133 |
+
?><script src="https://www.google.com/recaptcha/api.js?hl=en" async defer></script><?php
|
134 |
+
?><style type="text/css">
|
135 |
+
#login {
|
136 |
+
width:350px !important;
|
137 |
+
}
|
138 |
+
</style><?php
|
139 |
+
break;
|
140 |
+
case 'recaptcha':
|
141 |
+
$recaptcha_theme = get_option('recaptcha_theme');
|
142 |
+
if ( $recaptcha_theme == 'custom' ) {
|
143 |
+
?><script type="text/javascript">
|
144 |
+
var RecaptchaOptions = {
|
145 |
+
theme : '<?php echo $recaptcha_theme ?>',
|
146 |
+
custom_theme_widget: 'recaptcha_widget'
|
147 |
+
};
|
148 |
+
</script><?php
|
149 |
+
} else {
|
150 |
+
?><script type="text/javascript">
|
151 |
+
var RecaptchaOptions = {
|
152 |
+
theme : '<?php echo $recaptcha_theme ?>'
|
153 |
+
};
|
154 |
+
</script><?php
|
155 |
+
}
|
156 |
+
}
|
157 |
+
}
|
158 |
+
function recaptcha_check_or_die( ) {
|
159 |
+
if ( ! $this->recaptcha_check() )
|
160 |
+
wp_die( __("Sorry, the Captcha didn’t verify.",'wp-recaptcha-integration') );
|
161 |
+
}
|
162 |
+
|
163 |
+
function print_recaptcha_html(){
|
164 |
+
echo $this->recaptcha_html();
|
165 |
+
}
|
166 |
+
|
167 |
+
function recaptcha_html() {
|
168 |
+
switch ( get_option( 'recaptcha_flavor' ) ) {
|
169 |
+
case 'grecaptcha':
|
170 |
+
return $this->grecaptcha_html();
|
171 |
+
case 'recaptcha':
|
172 |
+
return $this->old_recaptcha_html();
|
173 |
+
}
|
174 |
+
}
|
175 |
+
|
176 |
+
function old_recaptcha_html() {
|
177 |
+
require_once dirname(__FILE__).'/recaptchalib.php';
|
178 |
+
$public_key = get_option( 'recaptcha_publickey' );
|
179 |
+
$recaptcha_theme = get_option('recaptcha_theme');
|
180 |
+
|
181 |
+
if ($recaptcha_theme == 'custom')
|
182 |
+
$return = $this->get_custom_html( $public_key );
|
183 |
+
else
|
184 |
+
$return = recaptcha_get_html( $public_key, $this->last_error );
|
185 |
+
return $return;
|
186 |
+
}
|
187 |
+
|
188 |
+
function grecaptcha_html() {
|
189 |
+
$public_key = get_option( 'recaptcha_publickey' );
|
190 |
+
$theme = get_option('recaptcha_theme');
|
191 |
+
$return = sprintf( '<div class="g-recaptcha" data-sitekey="%s" data-theme="%s"></div>',$public_key,$theme);
|
192 |
+
return $return;
|
193 |
+
}
|
194 |
+
|
195 |
+
function get_custom_html( $public_key ) {
|
196 |
+
|
197 |
+
$return = '<div id="recaptcha_widget" style="display:none">';
|
198 |
+
|
199 |
+
$return .= '<div id="recaptcha_image"></div>';
|
200 |
+
$return .= sprintf('<div class="recaptcha_only_if_incorrect_sol" style="color:red">%s</div>',__('Incorrect please try again','wp-recaptcha-integration'));
|
201 |
+
|
202 |
+
$return .= sprintf('<span class="recaptcha_only_if_image">%s</span>',__('Enter the words above:','wp-recaptcha-integration'));
|
203 |
+
$return .= sprintf('<span class="recaptcha_only_if_audio">%s</span>',__('Enter the numbers you hear:','wp-recaptcha-integration'));
|
204 |
+
|
205 |
+
$return .= '<input type="text" id="recaptcha_response_field" name="recaptcha_response_field" />';
|
206 |
+
|
207 |
+
$return .= sprintf('<div><a href="javascript:Recaptcha.reload()"></a></div>',__('Get another CAPTCHA','wp-recaptcha-integration'));
|
208 |
+
$return .= sprintf('<div class="recaptcha_only_if_image"><a href="javascript:Recaptcha.switch_type(\'audio\')">%s</a></div>',__('Get an audio CAPTCHA','wp-recaptcha-integration'));
|
209 |
+
$return .= sprintf('<div class="recaptcha_only_if_audio"><a href="javascript:Recaptcha.switch_type(\'image\')">%s</a></div>',__('Get an image CAPTCHA','wp-recaptcha-integration'));
|
210 |
+
|
211 |
+
$return .= '<div><a href="javascript:Recaptcha.showhelp()">Help</a></div>';
|
212 |
+
$return .= '</div>';
|
213 |
+
|
214 |
+
$return .= sprintf('<script type="text/javascript" src="http://www.google.com/recaptcha/api/challenge?k=%s"></script>',$public_key);
|
215 |
+
$return .= '<noscript>';
|
216 |
+
$return .= sprintf('<iframe src="http://www.google.com/recaptcha/api/noscript?k=%s" height="300" width="500" frameborder="0"></iframe><br>',$public_key);
|
217 |
+
$return .= '<textarea name="recaptcha_challenge_field" rows="3" cols="40">';
|
218 |
+
$return .= '</textarea>';
|
219 |
+
$return .= '<input type="hidden" name="recaptcha_response_field" value="manual_challenge">';
|
220 |
+
$return .= '</noscript>';
|
221 |
+
|
222 |
+
return $return;
|
223 |
+
}
|
224 |
+
|
225 |
+
function recaptcha_check() {
|
226 |
+
switch ( get_option( 'recaptcha_flavor' ) ) {
|
227 |
+
case 'grecaptcha':
|
228 |
+
return $this->grecaptcha_check();
|
229 |
+
case 'recaptcha':
|
230 |
+
return $this->old_recaptcha_check();
|
231 |
+
}
|
232 |
+
}
|
233 |
+
function grecaptcha_check() {
|
234 |
+
$private_key = get_option( 'recaptcha_privatekey' );
|
235 |
+
$user_response = isset( $_REQUEST['g-recaptcha-response'] ) ? $_REQUEST['g-recaptcha-response'] : false;
|
236 |
+
if ( $user_response ) {
|
237 |
+
$remote_ip = $_SERVER['REMOTE_ADDR'];
|
238 |
+
$url = "https://www.google.com/recaptcha/api/siteverify?secret=$private_key&response=$user_response&remoteip=$remote_ip";
|
239 |
+
$response = wp_remote_get( $url );
|
240 |
+
if ( ! is_wp_error($response) ) {
|
241 |
+
$response_data = wp_remote_retrieve_body( $response );
|
242 |
+
$result = json_decode($response_data);
|
243 |
+
return $result->success;
|
244 |
+
}
|
245 |
+
}
|
246 |
+
return false;
|
247 |
+
}
|
248 |
+
function old_recaptcha_check() {
|
249 |
+
require_once dirname(__FILE__).'/recaptchalib.php';
|
250 |
+
$private_key = get_option( 'recaptcha_privatekey' );
|
251 |
+
$response = recaptcha_check_answer( $private_key,
|
252 |
+
$_SERVER["REMOTE_ADDR"],
|
253 |
+
$_POST["recaptcha_challenge_field"],
|
254 |
+
$_POST["recaptcha_response_field"]);
|
255 |
+
|
256 |
+
if ( ! $response->is_valid )
|
257 |
+
$this->last_error = $response->error;
|
258 |
+
|
259 |
+
return $response->is_valid;
|
260 |
+
}
|
261 |
+
/**
|
262 |
+
* Fired on plugin activation
|
263 |
+
*/
|
264 |
+
public static function activate() {
|
265 |
+
}
|
266 |
+
|
267 |
+
/**
|
268 |
+
* Fired on plugin deactivation
|
269 |
+
*/
|
270 |
+
public static function deactivate() {
|
271 |
+
}
|
272 |
+
/**
|
273 |
+
*
|
274 |
+
*/
|
275 |
+
public static function uninstall() {
|
276 |
+
delete_option( 'recaptcha_publickey' );
|
277 |
+
delete_option( 'recaptcha_privatekey' );
|
278 |
+
|
279 |
+
delete_option( 'recaptcha_flavor' );
|
280 |
+
delete_option( 'recaptcha_theme' );
|
281 |
+
delete_option( 'recaptcha_enable_comments' );
|
282 |
+
delete_option( 'recaptcha_enable_signup' );
|
283 |
+
delete_option( 'recaptcha_enable_login' );
|
284 |
+
delete_option( 'recaptcha_disable_for_known_users' );
|
285 |
+
}
|
286 |
+
}
|
287 |
+
|
288 |
+
|
289 |
+
WordPress_reCaptcha::instance();
|
290 |
+
|
291 |
+
require_once dirname(__FILE__).'/inc/recaptcha-options.php';
|