Changeset 3274843
- Timestamp:
- 04/16/2025 02:17:51 PM (12 months ago)
- Location:
- wpcf7-recaptcha/trunk
- Files:
-
- 4 edited
-
changelog.txt (modified) (1 diff)
-
readme.txt (modified) (2 diffs)
-
recaptcha-v2.php (modified) (8 diffs)
-
wpcf7-recaptcha.php (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wpcf7-recaptcha/trunk/changelog.txt
r3186790 r3274843 2 2 3 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.4.9 = 6 7 Release Date: April 15, 2025 8 9 * Overview 10 * Updated the "Tested up to" value to support 6.7+ 11 * Fixes the [recaptcha] tag generator (previously broken). 12 13 * Code Changes 14 * Changes the iqfix_wpcf7_add_tag_generator_recaptcha() WPCF7_TagGenerator callback to better support WPCF7_TagGenerator v2. 15 * Now the version => 2 makes sense! 16 * This redevelops the tag generator HTML with better attributes such as `data-tag-part` and `data-tag-option` 17 * Doing so has now fixed the previously broken tag generation screen. 4 18 5 19 = 1.4.8 = -
wpcf7-recaptcha/trunk/readme.txt
r3186790 r3274843 4 4 Requires at least: 4.9 5 5 Tested up to: 6.7 6 Stable tag: 1.4. 86 Stable tag: 1.4.9 7 7 License: GPLv2 or later 8 8 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 61 61 == Changelog == 62 62 63 = 1.4.9 (2025-04-15) = 64 * Updated the "Tested up to" value to support 6.8+ 65 * Fixes to the [recaptcha] tag generator 66 63 67 = 1.4.8 (2024-11-13) = 64 68 * Updated the "Tested up to" value to support 6.7+ -
wpcf7-recaptcha/trunk/recaptcha-v2.php
r3186790 r3274843 63 63 } 64 64 65 $source = WPCF7::get_option( 'iqfix_recaptcha_source' );65 $source = \WPCF7::get_option( 'iqfix_recaptcha_source' ); 66 66 $source = IQFix_WPCF7_Deity::verify_recaptcha_source( $source ); 67 67 … … 112 112 } 113 113 114 $recaptcha = WPCF7_RECAPTCHA::get_instance();114 $recaptcha = \WPCF7_RECAPTCHA::get_instance(); 115 115 $atts['data-sitekey'] = $recaptcha->get_sitekey(); 116 116 $atts['data-type'] = $tag->get_option( 'type', '(audio|image)', true ); … … 162 162 } 163 163 164 $source = WPCF7::get_option( 'iqfix_recaptcha_source' );164 $source = \WPCF7::get_option( 'iqfix_recaptcha_source' ); 165 165 $source = IQFix_WPCF7_Deity::verify_recaptcha_source( $source ); 166 166 $url = add_query_arg( 'k', $args['sitekey'], … … 260 260 function iqfix_wpcf7_add_tag_generator_recaptcha() { 261 261 262 $tag_generator = WPCF7_TagGenerator::get_instance();262 $tag_generator = \WPCF7_TagGenerator::get_instance(); 263 263 $tag_generator->add( 264 264 'recaptcha', … … 280 280 * 281 281 * @param WPCF7_ContactForm $contact_form 282 * @param Array $ args282 * @param Array $options 283 283 * 284 284 * @return void 285 285 */ 286 function iqfix_wpcf7_tag_generator_recaptcha( $contact_form, $ args = '') {287 288 $ args = wp_parse_args( $args, array() );286 function iqfix_wpcf7_tag_generator_recaptcha( $contact_form, $options = array() ) { 287 288 $options = wp_parse_args( $options, array() ); 289 289 $recaptcha = IQFix_ReCaptcha::get_instance(); 290 291 if ( ! $recaptcha->is_active() ) { 290 $tgg = new \WPCF7_TagGeneratorGenerator( $options['content'] ); 292 291 293 292 ?> 294 <div class="control-box"> 295 <fieldset> 296 <legend><?php 297 /* translators: %s is a link to the Contact Form 7 blog post regarding reCaptcha v3 */ 298 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' ) ) ); 299 ?></legend> 300 </fieldset> 301 </div> 293 <header class="description-box"> 294 <h3><?php esc_html_e( 'ReCaptcha form-tag generator', 'wpcf7-recaptcha' ); ?></h3> 295 296 <p><?php 297 if ( ! $recaptcha->is_active() ) { 298 /* translators: %s is a link to the Contact Form 7 blog post regarding reCaptcha v3 */ 299 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' ) ) ); 300 } else { 301 /* translators: %s is a link to the Contact Form 7 blog post regarding reCaptcha v3 */ 302 $description = esc_html__( "Generate a form-tag for a reCaptcha widget. For more details, see %s.", 'wpcf7-recaptcha' ); 303 $desc_link = wpcf7_link( 'https://www.iqcomputing.com/support/articles/generate-google-recaptcha-v2-keys/', esc_html__( 'reCaptcha', 'wpcf7-recaptcha' ), array( 'target' => '_blank' ) ); 304 echo sprintf( $description, $desc_link ); 305 } 306 ?></p> 307 </header> 308 309 <div class="control-box"><?php 310 311 $tgg->print( 'field_type', array( 312 'with_required' => false, 313 'select_options' => array( 314 $options['id'] => esc_html__( 'ReCaptcha v2', 'wpcf7-recaptcha' ), 315 ), 316 ) ); 317 ?> 318 319 <fieldset> 320 <legend><?php esc_html_e( 'Size', 'wpcf7-recaptcha' ); ?></legend> 321 322 <label for="<?php echo esc_attr( $options['content'] . '-size-normal' ); ?>"> 323 <input type="radio" name="size" class="option default" id="<?php echo esc_attr( $options['content'] . '-size-normal' ); ?>" value="normal" checked="checked" data-tag-part="option" data-tag-option="" /> <?php 324 /* translators: ReCaptcha size: normal */ 325 esc_html_e( 'Normal', 'wpcf7-recaptcha' ); 326 ?></label> 327 <br /> 328 <label for="<?php echo esc_attr( $options['content'] . '-size-compact' ); ?>"> 329 <input type="radio" name="size" class="option" id="<?php echo esc_attr( $options['content'] . '-size-compact' ); ?>" value="compact" data-tag-part="option" data-tag-option="size:compact" /> <?php 330 /* translators: ReCaptcha size: compact */ 331 esc_html_e( 'Compact', 'wpcf7-recaptcha' ); 332 ?></label> 333 </fieldset> 334 335 <fieldset> 336 <legend><?php esc_html_e( 'Theme', 'wpcf7-recaptcha' ); ?></legend> 337 338 <label for="<?php echo esc_attr( $options['content'] . '-theme-light' ); ?>"> 339 <input type="radio" name="theme" class="option default" id="<?php echo esc_attr( $options['content'] . '-theme-light' ); ?>" value="light" checked="checked" data-tag-part="option" data-tag-option="" /> <?php 340 /* translators: ReCaptcha theme: light */ 341 esc_html_e( 'Light', 'wpcf7-recaptcha' ); 342 ?></label> 343 <br /> 344 <label for="<?php echo esc_attr( $options['content'] . '-theme-dark' ); ?>"> 345 <input type="radio" name="theme" class="option" id="<?php echo esc_attr( $options['content'] . '-theme-dark' ); ?>" value="dark" data-tag-part="option" data-tag-option="theme:dark" /> <?php 346 /* translators: ReCaptcha theme: dark */ 347 esc_html_e( 'Dark', 'wpcf7-recaptcha' ); 348 ?></label> 349 </fieldset> 350 351 352 <fieldset> 353 <legend><?php esc_html_e( 'Alignment', 'wpcf7-recaptcha' ); ?></legend> 354 355 <label for="<?php echo esc_attr( $options['content'] . '-align-left' ); ?>"> 356 <input type="radio" name="align" class="option default" id="<?php echo esc_attr( $options['content'] . '-align-left' ); ?>" value="left" checked="checked" data-tag-part="option" data-tag-option="" /> <?php 357 /* translators: ReCaptcha alignment: left */ 358 esc_html_e( 'Left', 'wpcf7-recaptcha' ); 359 ?></label> 360 <br /> 361 <label for="<?php echo esc_attr( $options['content'] . '-align-center' ); ?>"> 362 <input type="radio" name="align" class="option" id="<?php echo esc_attr( $options['content'] . '-align-center' ); ?>" value="center" data-tag-part="option" data-tag-option="align:center" /> <?php 363 /* translators: ReCaptcha alignment: center */ 364 esc_html_e( 'Center', 'wpcf7-recaptcha' ); 365 ?></label> 366 <br /> 367 <label for="<?php echo esc_attr( $options['content'] . '-align-right' ); ?>"> 368 <input type="radio" name="align" class="option" id="<?php echo esc_attr( $options['content'] . '-align-right' ); ?>" value="right" data-tag-part="option" data-tag-option="align:right" /> <?php 369 /* translators: ReCaptcha alignment: right */ 370 esc_html_e( 'Right', 'wpcf7-recaptcha' ); 371 ?></label> 372 </fieldset> 373 302 374 <?php 303 375 304 return; 305 } 306 307 /* translators: %s is a link to the Contact Form 7 blog post regarding reCaptcha v3 */ 308 $description = esc_html__( "Generate a form-tag for a reCaptcha widget. For more details, see %s.", 'wpcf7-recaptcha' ); 309 $desc_link = wpcf7_link( 'https://contactform7.com/recaptcha/', esc_html__( 'reCaptcha', 'wpcf7-recaptcha' ) ); 310 311 ?> 312 <div class="control-box"> 313 <fieldset> 314 <legend><?php echo sprintf( $description, $desc_link ); ?></legend> 315 316 <table class="form-table"> 317 <tbody> 318 <tr> 319 <th scope="row"><?php 320 /* translators: ReCaptcha size (normal or compact) */ 321 esc_html_e( 'Size', 'wpcf7-recaptcha' ); 322 ?></th> 323 <td> 324 <fieldset> 325 <legend class="screen-reader-text"><?php 326 /* translators: Screen reader text, reCaptcha size (normal or compact) */ 327 esc_html_e( 'Size', 'wpcf7-recaptcha' ); 328 ?></legend> 329 <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> 330 <br /> 331 <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> 332 </fieldset> 333 </td> 334 </tr> 335 336 <tr> 337 <th scope="row"><?php 338 /* translators: ReCaptcha theme (light or dark) */ 339 esc_html_e( 'Theme', 'wpcf7-recaptcha' ); 340 ?></th> 341 <td> 342 <fieldset> 343 <legend class="screen-reader-text"><?php 344 /* translators: Screen reader text, reCaptcha theme (light or dark) */ 345 esc_html_e( 'Theme', 'wpcf7-recaptcha' ); 346 ?></legend> 347 <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> 348 <br /> 349 <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> 350 </fieldset> 351 </td> 352 </tr> 353 354 <tr> 355 <th scope="row"><?php 356 /* translators: ReCaptcha theme (light or dark) */ 357 esc_html_e( 'Alignment', 'wpcf7-recaptcha' ); 358 ?></th> 359 <td> 360 <fieldset> 361 <legend class="screen-reader-text"><?php 362 /* translators: Alignment of the reCaptcha box (left, center, right) */ 363 esc_html_e( 'Alignment', 'wpcf7-recaptcha' ); 364 ?></legend> 365 <label for="<?php echo esc_attr( $args['content'] . '-align-left' ); ?>"><input type="radio" name="align" class="option default" id="<?php echo esc_attr( $args['content'] . '-align-left' ); ?>" value="left" checked="checked" /> <?php /* translators: ReCaptcha alignment: left */ esc_html_e( 'Left', 'wpcf7-recaptcha' ); ?></label> 366 <br /> 367 <label for="<?php echo esc_attr( $args['content'] . '-align-center' ); ?>"><input type="radio" name="align" class="option" id="<?php echo esc_attr( $args['content'] . '-align-center' ); ?>" value="center" /> <?php /* translators: ReCaptcha alignment: center */ esc_html_e( 'Center', 'wpcf7-recaptcha' ); ?></label> 368 <br /> 369 <label for="<?php echo esc_attr( $args['content'] . '-align-right' ); ?>"><input type="radio" name="align" class="option" id="<?php echo esc_attr( $args['content'] . '-align-right' ); ?>" value="right" /> <?php /* translators: ReCaptcha alignment: right */ esc_html_e( 'Right', 'wpcf7-recaptcha' ); ?></label> 370 </fieldset> 371 </td> 372 </tr> 373 374 <tr> 375 <th scope="row"><label for="<?php echo esc_attr( $args['content'] . '-id' ); ?>"><?php 376 /* translators: HTML Attribute ID for reCaptcha box */ 377 esc_html_e( 'Id attribute', 'wpcf7-recaptcha' ); 378 ?></label></th> 379 <td><input type="text" name="id" class="idvalue oneline option" id="<?php echo esc_attr( $args['content'] . '-id' ); ?>" /></td> 380 </tr> 381 382 <tr> 383 <th scope="row"><label for="<?php echo esc_attr( $args['content'] . '-class' ); ?>"><?php 384 /* translators: HTML Attribute class for reCaptcha box */ 385 esc_html_e( 'Class attribute', 'wpcf7-recaptcha' ); 386 ?></label></th> 387 <td><input type="text" name="class" class="classvalue oneline option" id="<?php echo esc_attr( $args['content'] . '-class' ); ?>" /></td> 388 </tr> 389 390 </tbody> 391 </table> 392 </fieldset> 393 </div> 394 395 <div class="insert-box"> 396 <input type="text" name="recaptcha" class="tag code" readonly="readonly" onfocus="this.select()" /> 397 398 <div class="submitbox"> 399 <input type="button" class="button button-primary insert-tag" value="<?php 400 /* translators: Insert shortcode tag into the page content */ 401 esc_attr_e( 'Insert Tag', 'wpcf7-recaptcha' ); 402 ?>" /> 403 </div> 404 </div> 376 $tgg->print( 'id_attr' ); 377 378 $tgg->print( 'class_attr' ); 379 380 381 ?></div> 382 383 <footer class="insert-box"> 384 <?php $tgg->print( 'insert_box_content' ); ?> 385 </footer> 405 386 <?php 406 387 … … 421 402 } 422 403 423 Class IQFix_ReCaptcha extends WPCF7_RECAPTCHA {404 Class IQFix_ReCaptcha extends \WPCF7_RECAPTCHA { 424 405 425 406 private static $instance; … … 441 422 $this->sitekeys = array( WPCF7_RECAPTCHA_SITEKEY => WPCF7_RECAPTCHA_SECRET ); 442 423 } else { 443 $this->sitekeys = WPCF7::get_option( 'recaptcha' );424 $this->sitekeys = \WPCF7::get_option( 'recaptcha' ); 444 425 } 445 426 … … 541 522 } 542 523 543 $source = WPCF7::get_option( 'iqfix_recaptcha_source' );524 $source = \WPCF7::get_option( 'iqfix_recaptcha_source' ); 544 525 $source = IQFix_WPCF7_Deity::verify_recaptcha_source( $source ); 545 526 $endpoint = sprintf( 'https://www.%s/recaptcha/api/siteverify', $source ); -
wpcf7-recaptcha/trunk/wpcf7-recaptcha.php
r3186790 r3274843 3 3 * Plugin Name: ReCaptcha v2 for Contact Form 7 4 4 * Description: ReCaptcha v2 Fix for Contact Form 7 5.1 and later. 5 * Version: 1.4. 85 * Version: 1.4.9 6 6 * Author: IQComputing 7 7 * Author URI: http://www.iqcomputing.com/ … … 25 25 * @var String 26 26 */ 27 public static $version = '1.4. 8';27 public static $version = '1.4.9'; 28 28 29 29 … … 69 69 private function include_files() { 70 70 71 $selection = WPCF7::get_option( 'iqfix_recaptcha' );72 $cf7_version = ( defined( 'WPCF7_VERSION' ) ) ? WPCF7_VERSION : WPCF7::get_option( 'version', '0' );71 $selection = \WPCF7::get_option( 'iqfix_recaptcha' ); 72 $cf7_version = ( defined( 'WPCF7_VERSION' ) ) ? WPCF7_VERSION : \WPCF7::get_option( 'version', '0' ); 73 73 74 74 // Prevent update from v2 to v3 notice. 75 WPCF7::update_option( 'recaptcha_v2_v3_warning', false );75 \WPCF7::update_option( 'recaptcha_v2_v3_warning', false ); 76 76 77 77 if( empty( $selection ) || version_compare( $cf7_version, '5.1', '<' ) ) { … … 79 79 } 80 80 81 include_once ( plugin_dir_path( __FILE__ ) . 'recaptcha-v2.php' );81 include_once plugin_dir_path( __FILE__ ) . 'recaptcha-v2.php'; 82 82 83 83 if( class_exists( 'Flamingo_Contact' ) ) { 84 include_once ( plugin_dir_path( __FILE__ ) . 'flamingo.php' ); // Flamingo updates84 include_once plugin_dir_path( __FILE__ ) . 'flamingo.php'; // Flamingo updates 85 85 } 86 86 … … 126 126 } else { 127 127 128 WPCF7::update_option( 'iqfix_recaptcha', $selection );129 WPCF7::update_option( 'iqfix_recaptcha_source', $source );128 \WPCF7::update_option( 'iqfix_recaptcha', $selection ); 129 \WPCF7::update_option( 'iqfix_recaptcha_source', $source ); 130 130 131 131 } … … 209 209 210 210 $updated = $this->save_recaptcha_settings(); 211 $cf7_version = ( defined( 'WPCF7_VERSION' ) ) ? WPCF7_VERSION : WPCF7::get_option( 'version', '0' );211 $cf7_version = ( defined( 'WPCF7_VERSION' ) ) ? WPCF7_VERSION : \WPCF7::get_option( 'version', '0' ); 212 212 213 213 // Grab Network Settings … … 223 223 } else { 224 224 225 $selection = WPCF7::get_option( 'iqfix_recaptcha' );226 $source = WPCF7::get_option( 'iqfix_recaptcha_source' );225 $selection = \WPCF7::get_option( 'iqfix_recaptcha' ); 226 $source = \WPCF7::get_option( 'iqfix_recaptcha_source' ); 227 227 228 228 }
Note: See TracChangeset
for help on using the changeset viewer.