wpcf7_init_captcha

CAPTCHA functions.

Description

wpcf7_init_captcha(); 

Usage

  1. if ( !function_exists( 'wpcf7_init_captcha' ) ) { 
  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_init_captcha(); 
  7.  

Defined (1)

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

/modules/really-simple-captcha.php  
  1. function wpcf7_init_captcha() { 
  2. static $captcha = null; 
  3.  
  4. if ( $captcha ) { 
  5. return $captcha; 
  6.  
  7. if ( class_exists( 'ReallySimpleCaptcha' ) ) { 
  8. $captcha = new ReallySimpleCaptcha(); 
  9. } else { 
  10. return false; 
  11.  
  12. $dir = trailingslashit( wpcf7_captcha_tmp_dir() ); 
  13.  
  14. $captcha->tmp_dir = $dir; 
  15.  
  16. if ( is_callable( array( $captcha, 'make_tmp_dir' ) ) ) { 
  17. $result = $captcha->make_tmp_dir(); 
  18.  
  19. if ( ! $result ) { 
  20. return false; 
  21.  
  22. return $captcha; 
  23.  
  24. if ( wp_mkdir_p( $dir ) ) { 
  25. $htaccess_file = $dir . '.htaccess'; 
  26.  
  27. if ( file_exists( $htaccess_file ) ) { 
  28. return $captcha; 
  29.  
  30. if ( $handle = @fopen( $htaccess_file, 'w' ) ) { 
  31. fwrite( $handle, 'Order deny, allow' . "\n" ); 
  32. fwrite( $handle, 'Deny from all' . "\n" ); 
  33. fwrite( $handle, '<Files ~ "^[0-9A-Za-z]+\\.(jpeg|gif|png)$">' . "\n" ); 
  34. fwrite( $handle, ' Allow from all' . "\n" ); 
  35. fwrite( $handle, '</Files>' . "\n" ); 
  36. fclose( $handle ); 
  37. } else { 
  38. return false; 
  39.  
  40. return $captcha;