wpcf7_captcha_ajax_refill

The Contact Form 7 wpcf7 captcha ajax refill function.

Description

wpcf7_captcha_ajax_refill( $items ); 

Parameters (1)

0. $items
The items.

Usage

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

Defined (1)

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

/modules/really-simple-captcha.php  
  1. function wpcf7_captcha_ajax_refill( $items ) { 
  2. if ( ! is_array( $items ) ) 
  3. return $items; 
  4.  
  5. $fes = wpcf7_scan_form_tags( array( 'type' => 'captchac' ) ); 
  6.  
  7. if ( empty( $fes ) ) 
  8. return $items; 
  9.  
  10. $refill = array(); 
  11.  
  12. foreach ( $fes as $fe ) { 
  13. $name = $fe['name']; 
  14. $options = $fe['options']; 
  15.  
  16. if ( empty( $name ) ) 
  17. continue; 
  18.  
  19. $op = wpcf7_captchac_options( $options ); 
  20. if ( $filename = wpcf7_generate_captcha( $op ) ) { 
  21. $captcha_url = wpcf7_captcha_url( $filename ); 
  22. $refill[$name] = $captcha_url; 
  23.  
  24. if ( ! empty( $refill ) ) 
  25. $items['captcha'] = $refill; 
  26.  
  27. return $items;