wpcf7_tag_generator_recaptcha

The Contact Form 7 wpcf7 tag generator recaptcha function.

Description

wpcf7_tag_generator_recaptcha( $contact_form, (string) $args = '' ); 

Parameters (2)

0. $contact_form
The contact form.
1. $args — Optional. (string) => ''
The args.

Usage

  1. if ( !function_exists( 'wpcf7_tag_generator_recaptcha' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'contact-form-7/modules/recaptcha.php'; 
  3.  
  4. // The contact form. 
  5. $contact_form = null; 
  6.  
  7. // The args. 
  8. $args = ''; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = wpcf7_tag_generator_recaptcha($contact_form, $args); 
  12.  

Defined (1)

The function is defined in the following location(s).

/modules/recaptcha.php  
  1. function wpcf7_tag_generator_recaptcha( $contact_form, $args = '' ) { 
  2. $args = wp_parse_args( $args, array() ); 
  3.  
  4. $recaptcha = WPCF7_RECAPTCHA::get_instance(); 
  5.  
  6. if ( ! $recaptcha->is_active() ) { 
  7. ?> 
  8. <div class="control-box"> 
  9. <fieldset> 
  10. <legend><?php echo sprintf( esc_html( __( "To use reCAPTCHA, first you need to install an API key pair. For more details, see %s.", 'contact-form-7' ) ), wpcf7_link( __( 'https://contactform7.com/recaptcha/', 'contact-form-7' ), __( 'reCAPTCHA', 'contact-form-7' ) ) ); ?></legend> 
  11. </fieldset> 
  12. </div> 
  13. <?php 
  14.  
  15. return; 
  16.  
  17. $description = __( "Generate a form-tag for a reCAPTCHA widget. For more details, see %s.", 'contact-form-7' ); 
  18.  
  19. $desc_link = wpcf7_link( __( 'https://contactform7.com/recaptcha/', 'contact-form-7' ), __( 'reCAPTCHA', 'contact-form-7' ) ); 
  20.  
  21. ?> 
  22. <div class="control-box"> 
  23. <fieldset> 
  24. <legend><?php echo sprintf( esc_html( $description ), $desc_link ); ?></legend> 
  25.  
  26. <table class="form-table"> 
  27. <tbody> 
  28. <tr> 
  29. <th scope="row"><?php echo esc_html( __( 'Theme', 'contact-form-7' ) ); ?></th> 
  30. <td> 
  31. <fieldset> 
  32. <legend class="screen-reader-text"><?php echo esc_html( __( 'Theme', 'contact-form-7' ) ); ?></legend> 
  33. <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', 'contact-form-7' ) ); ?></label> 
  34. <br /> 
  35. <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', 'contact-form-7' ) ); ?></label> 
  36. </fieldset> 
  37. </td> 
  38. </tr> 
  39.  
  40. <tr> 
  41. <th scope="row"><?php echo esc_html( __( 'Size', 'contact-form-7' ) ); ?></th> 
  42. <td> 
  43. <fieldset> 
  44. <legend class="screen-reader-text"><?php echo esc_html( __( 'Size', 'contact-form-7' ) ); ?></legend> 
  45. <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', 'contact-form-7' ) ); ?></label> 
  46. <br /> 
  47. <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', 'contact-form-7' ) ); ?></label> 
  48. </fieldset> 
  49. </td> 
  50. </tr> 
  51.  
  52. <tr> 
  53. <th scope="row"><label for="<?php echo esc_attr( $args['content'] . '-id' ); ?>"><?php echo esc_html( __( 'Id attribute', 'contact-form-7' ) ); ?></label></th> 
  54. <td><input type="text" name="id" class="idvalue oneline option" id="<?php echo esc_attr( $args['content'] . '-id' ); ?>" /></td> 
  55. </tr> 
  56.  
  57. <tr> 
  58. <th scope="row"><label for="<?php echo esc_attr( $args['content'] . '-class' ); ?>"><?php echo esc_html( __( 'Class attribute', 'contact-form-7' ) ); ?></label></th> 
  59. <td><input type="text" name="class" class="classvalue oneline option" id="<?php echo esc_attr( $args['content'] . '-class' ); ?>" /></td> 
  60. </tr> 
  61.  
  62. </tbody> 
  63. </table> 
  64. </fieldset> 
  65. </div> 
  66.  
  67. <div class="insert-box"> 
  68. <input type="text" name="recaptcha" class="tag code" readonly="readonly" onfocus="this.select()" /> 
  69.  
  70. <div class="submitbox"> 
  71. <input type="button" class="button button-primary insert-tag" value="<?php echo esc_attr( __( 'Insert Tag', 'contact-form-7' ) ); ?>" /> 
  72. </div> 
  73. </div> 
  74. <?php