Contact Form 7 – reCaptcha v2 - Version 1.1.3

Version Description

(2019-02-06) = * An attempt to make translations easier and better overall. * Combined a few redundant translation functions into a single translation function. * Made wording and references more consistent. * Added a margin-bottom: 0 style to the reCaptcha iframe in an attempt to prevent CSS overlapping.

Download this release

Release Info

Developer IQComputing
Plugin Icon 128x128 Contact Form 7 – reCaptcha v2
Version 1.1.3
Comparing to
See all releases

Code changes from version 1.1.2 to 1.1.3

Files changed (4) hide show
  1. changelog.txt +11 -0
  2. readme.txt +8 -11
  3. recaptcha-v2.php +57 -18
  4. wpcf7-recaptcha.php +11 -11
changelog.txt CHANGED
@@ -2,6 +2,17 @@
2
 
3
  This is to keep track of all changes the plugin undertakes. The readme.txt should only contain the most recent 3.
4
 
 
 
 
 
 
 
 
 
 
 
 
5
  = 1.1.2 =
6
 
7
  Relase Date: January 14, 2019
2
 
3
  This is to keep track of all changes the plugin undertakes. The readme.txt should only contain the most recent 3.
4
 
5
+ = 1.1.3 =
6
+
7
+ Relase Date: February 06, 2019
8
+
9
+ * Overview
10
+ * An attempt to make translations easier and better overall.
11
+ * Combined a few redundant translation functions into a single translation function.
12
+ * Changed instances of reCaptcha that were all caps and not consistent.
13
+ * Added a margin-bottom: 0 style to the reCaptcha iframe in an attempt to prevent CSS overlapping using the `add_action( 'wp_enqueue_scripts', 'iqfix_recaptcha_inline_css' )` hook.
14
+
15
+
16
  = 1.1.2 =
17
 
18
  Relase Date: January 14, 2019
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: iqcomputing
3
  Tags: contact-form-7, contact-form-7-recaptcha, recaptcha, spam
4
  Requires at least: 4.9
5
  Tested up to: 5.0.2
6
- Stable tag: 1.1.2
7
  License: GPLv2 or later
8
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
9
 
@@ -59,19 +59,16 @@ Should the above be correct, at this point it's time to open a support thread fo
59
 
60
  == Changelog ==
61
 
 
 
 
 
 
 
62
  = 1.1.2 (2019-01-14) =
63
  * Renamed Text Domain to match the plugin slug which should help translations.
64
  * Added Portable Object Template (.pot) file to /languages/ folder.
65
  * Added call to action on settings page which encourages users to like IQComputing on Facebook to receive the latest news and updates.
66
 
67
  = 1.1.1 (2019-01-07) =
68
- * Adds message whenever user forgets to click reCaptcha checkbox.
69
-
70
- = 1.1.0 (2018-12-28) =
71
- * Prevents Contact Form 7 from removing reCaptcha keys upon update.
72
- * Removes Contact Form 7 reCaptcha upgrade notice.
73
-
74
- = 1.0.0 (2018-12-28) =
75
- * Initial release of plugin.
76
- * Contact Form 7 5.0.5 reCaptcha functionality copied over.
77
- * Created subpage under "Contact" named "reCaptcha Version" to be used as a settings page.
3
  Tags: contact-form-7, contact-form-7-recaptcha, recaptcha, spam
4
  Requires at least: 4.9
5
  Tested up to: 5.0.2
6
+ Stable tag: 1.1.3
7
  License: GPLv2 or later
8
  License URI: https://www.gnu.org/licenses/gpl-2.0.html
9
 
59
 
60
  == Changelog ==
61
 
62
+ = 1.1.3 (2019-02-06) =
63
+ * An attempt to make translations easier and better overall.
64
+ * Combined a few redundant translation functions into a single translation function.
65
+ * Made wording and references more consistent.
66
+ * Added a margin-bottom: 0 style to the reCaptcha iframe in an attempt to prevent CSS overlapping.
67
+
68
  = 1.1.2 (2019-01-14) =
69
  * Renamed Text Domain to match the plugin slug which should help translations.
70
  * Added Portable Object Template (.pot) file to /languages/ folder.
71
  * Added call to action on settings page which encourages users to like IQComputing on Facebook to receive the latest news and updates.
72
 
73
  = 1.1.1 (2019-01-07) =
74
+ * Adds message whenever user forgets to click reCaptcha checkbox.
 
 
 
 
 
 
 
 
 
recaptcha-v2.php CHANGED
@@ -335,7 +335,7 @@ function iqfix_wpcf7_add_tag_generator_recaptcha() {
335
  $tag_generator = WPCF7_TagGenerator::get_instance();
336
  $tag_generator->add(
337
  'recaptcha',
338
- esc_html__( 'reCAPTCHA', 'wpcf7-recaptcha' ),
339
  'iqfix_wpcf7_tag_generator_recaptcha',
340
  array( 'nameless' => 1 )
341
  );
@@ -366,55 +366,77 @@ function iqfix_wpcf7_tag_generator_recaptcha( $contact_form, $args = '' ) {
366
  ?>
367
  <div class="control-box">
368
  <fieldset>
369
- <legend><?php echo sprintf( esc_html( __( "To use reCAPTCHA, first you need to install an API key pair. For more details, see %s.", 'wpcf7-recaptcha' ) ), wpcf7_link( __( 'https://contactform7.com/recaptcha/', 'wpcf7-recaptcha' ), __( 'reCAPTCHA', 'wpcf7-recaptcha' ) ) ); ?></legend>
 
 
 
370
  </fieldset>
371
  </div>
372
  <?php
373
 
374
  return;
375
  }
376
-
377
- $description = __( "Generate a form-tag for a reCAPTCHA widget. For more details, see %s.", 'wpcf7-recaptcha' );
378
- $desc_link = wpcf7_link( __( 'https://contactform7.com/recaptcha/', 'wpcf7-recaptcha' ), __( 'reCAPTCHA', 'wpcf7-recaptcha' ) );
 
379
 
380
  ?>
381
  <div class="control-box">
382
  <fieldset>
383
- <legend><?php echo sprintf( esc_html( $description ), $desc_link ); ?></legend>
384
 
385
  <table class="form-table">
386
  <tbody>
387
  <tr>
388
- <th scope="row"><?php echo esc_html( __( 'Size', 'wpcf7-recaptcha' ) ); ?></th>
 
 
 
389
  <td>
390
  <fieldset>
391
- <legend class="screen-reader-text"><?php echo esc_html( __( 'Size', 'wpcf7-recaptcha' ) ); ?></legend>
392
- <label for="<?php echo esc_attr( $args['content'] . '-size-normal' ); ?>"><input type="radio" name="size" class="option default" id="<?php echo esc_attr( $args['content'] . '-size-normal' ); ?>" value="normal" checked="checked" /> <?php echo esc_html( __( 'Normal', 'wpcf7-recaptcha' ) ); ?></label>
 
 
 
393
  <br />
394
- <label for="<?php echo esc_attr( $args['content'] . '-size-compact' ); ?>"><input type="radio" name="size" class="option" id="<?php echo esc_attr( $args['content'] . '-size-compact' ); ?>" value="compact" /> <?php echo esc_html( __( 'Compact', 'wpcf7-recaptcha' ) ); ?></label>
395
  </fieldset>
396
  </td>
397
  </tr>
398
 
399
  <tr>
400
- <th scope="row"><?php echo esc_html( __( 'Theme', 'wpcf7-recaptcha' ) ); ?></th>
 
 
 
401
  <td>
402
  <fieldset>
403
- <legend class="screen-reader-text"><?php echo esc_html( __( 'Theme', 'wpcf7-recaptcha' ) ); ?></legend>
404
- <label for="<?php echo esc_attr( $args['content'] . '-theme-light' ); ?>"><input type="radio" name="theme" class="option default" id="<?php echo esc_attr( $args['content'] . '-theme-light' ); ?>" value="light" checked="checked" /> <?php echo esc_html( __( 'Light', 'wpcf7-recaptcha' ) ); ?></label>
 
 
 
405
  <br />
406
- <label for="<?php echo esc_attr( $args['content'] . '-theme-dark' ); ?>"><input type="radio" name="theme" class="option" id="<?php echo esc_attr( $args['content'] . '-theme-dark' ); ?>" value="dark" /> <?php echo esc_html( __( 'Dark', 'wpcf7-recaptcha' ) ); ?></label>
407
  </fieldset>
408
  </td>
409
  </tr>
410
 
411
  <tr>
412
- <th scope="row"><label for="<?php echo esc_attr( $args['content'] . '-id' ); ?>"><?php echo esc_html( __( 'Id attribute', 'wpcf7-recaptcha' ) ); ?></label></th>
 
 
 
413
  <td><input type="text" name="id" class="idvalue oneline option" id="<?php echo esc_attr( $args['content'] . '-id' ); ?>" /></td>
414
  </tr>
415
 
416
  <tr>
417
- <th scope="row"><label for="<?php echo esc_attr( $args['content'] . '-class' ); ?>"><?php echo esc_html( __( 'Class attribute', 'wpcf7-recaptcha' ) ); ?></label></th>
 
 
 
418
  <td><input type="text" name="class" class="classvalue oneline option" id="<?php echo esc_attr( $args['content'] . '-class' ); ?>" /></td>
419
  </tr>
420
 
@@ -427,7 +449,10 @@ function iqfix_wpcf7_tag_generator_recaptcha( $contact_form, $args = '' ) {
427
  <input type="text" name="recaptcha" class="tag code" readonly="readonly" onfocus="this.select()" />
428
 
429
  <div class="submitbox">
430
- <input type="button" class="button button-primary insert-tag" value="<?php echo esc_attr( __( 'Insert Tag', 'wpcf7-recaptcha' ) ); ?>" />
 
 
 
431
  </div>
432
  </div>
433
  <?php
@@ -591,4 +616,18 @@ function iqfix_recaptcha_class_init() {
591
  }
592
 
593
  }
594
- add_action( 'init', 'iqfix_recaptcha_class_init', 11 );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
335
  $tag_generator = WPCF7_TagGenerator::get_instance();
336
  $tag_generator->add(
337
  'recaptcha',
338
+ esc_html__( 'reCaptcha', 'wpcf7-recaptcha' ),
339
  'iqfix_wpcf7_tag_generator_recaptcha',
340
  array( 'nameless' => 1 )
341
  );
366
  ?>
367
  <div class="control-box">
368
  <fieldset>
369
+ <legend><?php
370
+ /* translators: %s is a link to the Contact Form 7 blog post regarding reCaptcha v3 */
371
+ echo sprintf( esc_html__( "To use reCaptcha, first you need to install an API key pair. For more details, see %s.", 'wpcf7-recaptcha' ), wpcf7_link( 'https://contactform7.com/recaptcha/', esc_html__( 'reCaptcha', 'wpcf7-recaptcha' ) ) );
372
+ ?></legend>
373
  </fieldset>
374
  </div>
375
  <?php
376
 
377
  return;
378
  }
379
+
380
+ /* translators: %s is a link to the Contact Form 7 blog post regarding reCaptcha v3 */
381
+ $description = esc_html__( "Generate a form-tag for a reCaptcha widget. For more details, see %s.", 'wpcf7-recaptcha' );
382
+ $desc_link = wpcf7_link( 'https://contactform7.com/recaptcha/', esc_html__( 'reCaptcha', 'wpcf7-recaptcha' ) );
383
 
384
  ?>
385
  <div class="control-box">
386
  <fieldset>
387
+ <legend><?php echo sprintf( $description, $desc_link ); ?></legend>
388
 
389
  <table class="form-table">
390
  <tbody>
391
  <tr>
392
+ <th scope="row"><?php
393
+ /* translators: ReCaptcha size (normal or compact) */
394
+ esc_html_e( 'Size', 'wpcf7-recaptcha' );
395
+ ?></th>
396
  <td>
397
  <fieldset>
398
+ <legend class="screen-reader-text"><?php
399
+ /* translators: Screen reader text, reCaptcha size (normal or compact) */
400
+ esc_html_e( 'Size', 'wpcf7-recaptcha' );
401
+ ?></legend>
402
+ <label for="<?php echo esc_attr( $args['content'] . '-size-normal' ); ?>"><input type="radio" name="size" class="option default" id="<?php echo esc_attr( $args['content'] . '-size-normal' ); ?>" value="normal" checked="checked" /> <?php /* translators: ReCaptcha size: normal */ esc_html_e( 'Normal', 'wpcf7-recaptcha' ); ?></label>
403
  <br />
404
+ <label for="<?php echo esc_attr( $args['content'] . '-size-compact' ); ?>"><input type="radio" name="size" class="option" id="<?php echo esc_attr( $args['content'] . '-size-compact' ); ?>" value="compact" /> <?php /* translators: ReCaptcha size: compact */ esc_html_e( 'Compact', 'wpcf7-recaptcha' ); ?></label>
405
  </fieldset>
406
  </td>
407
  </tr>
408
 
409
  <tr>
410
+ <th scope="row"><?php
411
+ /* translators: ReCaptcha theme (light or dark) */
412
+ esc_html_e( 'Theme', 'wpcf7-recaptcha' );
413
+ ?></th>
414
  <td>
415
  <fieldset>
416
+ <legend class="screen-reader-text"><?php
417
+ /* translators: Screen reader text, reCaptcha theme (light or dark) */
418
+ esc_html_e( 'Theme', 'wpcf7-recaptcha' );
419
+ ?></legend>
420
+ <label for="<?php echo esc_attr( $args['content'] . '-theme-light' ); ?>"><input type="radio" name="theme" class="option default" id="<?php echo esc_attr( $args['content'] . '-theme-light' ); ?>" value="light" checked="checked" /> <?php /* translators: ReCaptcha theme: light */ esc_html_e( 'Light', 'wpcf7-recaptcha' ); ?></label>
421
  <br />
422
+ <label for="<?php echo esc_attr( $args['content'] . '-theme-dark' ); ?>"><input type="radio" name="theme" class="option" id="<?php echo esc_attr( $args['content'] . '-theme-dark' ); ?>" value="dark" /> <?php /* translators: ReCaptcha theme: dark */ esc_html_e( 'Dark', 'wpcf7-recaptcha' ); ?></label>
423
  </fieldset>
424
  </td>
425
  </tr>
426
 
427
  <tr>
428
+ <th scope="row"><label for="<?php echo esc_attr( $args['content'] . '-id' ); ?>"><?php
429
+ /* translators: HTML Attribute ID for reCaptcha box */
430
+ esc_html_e( 'Id attribute', 'wpcf7-recaptcha' );
431
+ ?></label></th>
432
  <td><input type="text" name="id" class="idvalue oneline option" id="<?php echo esc_attr( $args['content'] . '-id' ); ?>" /></td>
433
  </tr>
434
 
435
  <tr>
436
+ <th scope="row"><label for="<?php echo esc_attr( $args['content'] . '-class' ); ?>"><?php
437
+ /* translators: HTML Attribute class for reCaptcha box */
438
+ esc_html_e( 'Class attribute', 'wpcf7-recaptcha' );
439
+ ?></label></th>
440
  <td><input type="text" name="class" class="classvalue oneline option" id="<?php echo esc_attr( $args['content'] . '-class' ); ?>" /></td>
441
  </tr>
442
 
449
  <input type="text" name="recaptcha" class="tag code" readonly="readonly" onfocus="this.select()" />
450
 
451
  <div class="submitbox">
452
+ <input type="button" class="button button-primary insert-tag" value="<?php
453
+ /* translators: Insert shortcode tag into the page content */
454
+ esc_attr_e( 'Insert Tag', 'wpcf7-recaptcha' );
455
+ ?>" />
456
  </div>
457
  </div>
458
  <?php
616
  }
617
 
618
  }
619
+ add_action( 'init', 'iqfix_recaptcha_class_init', 11 );
620
+
621
+
622
+ /**
623
+ * Add some inline CSS for the reCaptcha iframe
624
+ *
625
+ * @return void
626
+ */
627
+ function iqfix_recaptcha_inline_css() {
628
+
629
+ $iqfix_css ='.wpcf7 .wpcf7-recaptcha iframe {margin-bottom: 0;}';
630
+ wp_add_inline_style( 'contact-form-7', $iqfix_css );
631
+
632
+ }
633
+ add_action( 'wp_enqueue_scripts', 'iqfix_recaptcha_inline_css' );
wpcf7-recaptcha.php CHANGED
@@ -2,12 +2,11 @@
2
  /**
3
  * Plugin Name: Contact Form 7 - reCaptcha v2
4
  * Description: ReCaptcha v2 Fix for Contact Form 7 5.1 and later.
5
- * Version: 1.1.2
6
  * Author: IQComputing
7
  * Author URI: http://www.iqcomputing.com/
8
  * License: GPL2
9
  * Text Domain: wpcf7-recaptcha
10
- * Domain Path: /languages/
11
  */
12
 
13
 
@@ -19,7 +18,7 @@ defined( 'ABSPATH' ) or die( 'You cannot be here.' );
19
  */
20
  Class IQFix_WPCF7_Deity {
21
 
22
- public static $version = '1.1.2';
23
 
24
 
25
  /**
@@ -138,11 +137,12 @@ Class IQFix_WPCF7_Deity {
138
  esc_html__( 'Your reCaptcha settings have been updated.', 'wpcf7-recaptcha' )
139
  );
140
  }
141
-
142
- printf( '<p>%1$s %2$s <code>[recaptcha]</code> %3$s',
143
- esc_html__( 'Select the version of reCaptcha you would like to use.', 'wpcf7-recaptcha' ),
144
- esc_html__( 'You will still need to use the', 'wpcf7-recaptcha' ),
145
- esc_html__( 'shortcode tag in your Contact Form 7 forms.', 'wpcf7-recaptcha' )
 
146
  );
147
  ?>
148
 
@@ -161,11 +161,11 @@ Class IQFix_WPCF7_Deity {
161
  printf( '<a href="%1$s" target="_blank"><img src="%2$s" width="540" height="410" alt="%3$s" /></a>',
162
  esc_url( 'https://www.facebook.com/iqcomputing' ),
163
  esc_url( trailingslashit( plugin_dir_url( __FILE__ ) ) . 'assets/images/facebook-like.png' ),
 
164
  esc_attr__( 'Like IQComputing on Facebook mascot', 'wpcf7-recaptcha' )
165
  );
166
- printf( '<p>%1$s %2$s</p>',
167
- esc_html__( 'Click the image above and like us on Facebook!', 'wpcf7-recaptcha' ),
168
- esc_html__( 'Facebook is where you will receive the latest news on both this plugin and all future IQComputing plugins.', 'wpcf7-recaptcha' )
169
  );
170
  ?>
171
  </div> <!-- id="iqFacebook" -->
2
  /**
3
  * Plugin Name: Contact Form 7 - reCaptcha v2
4
  * Description: ReCaptcha v2 Fix for Contact Form 7 5.1 and later.
5
+ * Version: 1.1.3
6
  * Author: IQComputing
7
  * Author URI: http://www.iqcomputing.com/
8
  * License: GPL2
9
  * Text Domain: wpcf7-recaptcha
 
10
  */
11
 
12
 
18
  */
19
  Class IQFix_WPCF7_Deity {
20
 
21
+ public static $version = '1.1.3';
22
 
23
 
24
  /**
137
  esc_html__( 'Your reCaptcha settings have been updated.', 'wpcf7-recaptcha' )
138
  );
139
  }
140
+
141
+ /* translators: %s is a shortcode example wrapped in <code> tags. */
142
+ printf( '<p>%1$s</p>',
143
+ sprintf( esc_html__( 'Select the version of reCaptcha you would like to use. You will still need to use the %s shortcode tag in your Contact Form 7 forms.', 'wpcf7-recaptcha' ),
144
+ '<code>[recaptcha]</code>'
145
+ )
146
  );
147
  ?>
148
 
161
  printf( '<a href="%1$s" target="_blank"><img src="%2$s" width="540" height="410" alt="%3$s" /></a>',
162
  esc_url( 'https://www.facebook.com/iqcomputing' ),
163
  esc_url( trailingslashit( plugin_dir_url( __FILE__ ) ) . 'assets/images/facebook-like.png' ),
164
+ /* translators: Image alternative tag. */
165
  esc_attr__( 'Like IQComputing on Facebook mascot', 'wpcf7-recaptcha' )
166
  );
167
+ printf( '<p>%1$s</p>',
168
+ esc_html__( 'Click the image above and like us on Facebook! Facebook is where you will receive the latest news on both this plugin and all future IQComputing plugins.', 'wpcf7-recaptcha' )
 
169
  );
170
  ?>
171
  </div> <!-- id="iqFacebook" -->