wpcf7_captcha_display_warning_message

The Contact Form 7 wpcf7 captcha display warning message function.

Description

wpcf7_captcha_display_warning_message(); 

Usage

  1. if ( !function_exists( 'wpcf7_captcha_display_warning_message' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'contact-form-7/modules/really-simple-captcha.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = wpcf7_captcha_display_warning_message(); 
  7.  

Defined (1)

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

/modules/really-simple-captcha.php  
  1. function wpcf7_captcha_display_warning_message() { 
  2. if ( ! $contact_form = wpcf7_get_current_contact_form() ) { 
  3. return; 
  4.  
  5. $has_tags = (bool) $contact_form->scan_form_tags( 
  6. array( 'type' => array( 'captchac' ) ) ); 
  7.  
  8. if ( ! $has_tags ) { 
  9. return; 
  10.  
  11. if ( ! class_exists( 'ReallySimpleCaptcha' ) ) { 
  12. return; 
  13.  
  14. $uploads_dir = wpcf7_captcha_tmp_dir(); 
  15.  
  16. if ( ! is_dir( $uploads_dir ) || ! wp_is_writable( $uploads_dir ) ) { 
  17. $message = sprintf( __( 'This contact form contains CAPTCHA fields, but the temporary folder for the files (%s) does not exist or is not writable. You can create the folder or change its permission manually.', 'contact-form-7' ), $uploads_dir ); 
  18.  
  19. echo '<div class="notice notice-warning"><p>' . esc_html( $message ) . '</p></div>'; 
  20.  
  21. if ( ! function_exists( 'imagecreatetruecolor' ) || ! function_exists( 'imagettftext' ) ) { 
  22. $message = __( 'This contact form contains CAPTCHA fields, but the necessary libraries (GD and FreeType) are not available on your server.', 'contact-form-7' ); 
  23.  
  24. echo '<div class="notice notice-warning"><p>' . esc_html( $message ) . '</p></div>';