/modules/listo.php

  1. <?php 
  2. /** 
  3. ** Retrieve list data from the Listo plugin. 
  4. ** Listo http://wordpress.org/plugins/listo/ 
  5. **/ 
  6.  
  7. add_filter( 'wpcf7_form_tag_data_option', 'wpcf7_listo', 10, 3 ); 
  8.  
  9. function wpcf7_listo( $data, $options, $args ) { 
  10. if ( ! function_exists( 'listo' ) ) { 
  11. return $data; 
  12.  
  13. $args = wp_parse_args( $args, array() ); 
  14.  
  15. $contact_form = wpcf7_get_current_contact_form(); 
  16. $args['locale'] = $contact_form->locale(); 
  17.  
  18. foreach ( (array) $options as $option ) { 
  19. $option = explode( '.', $option ); 
  20. $type = $option[0]; 
  21. $args['group'] = isset( $option[1] ) ? $option[1] : null; 
  22.  
  23. if ( $list = listo( $type, $args ) ) { 
  24. $data = array_merge( (array) $data, $list ); 
  25.  
  26. return $data; 
.