akismet
2 years ago
constant-contact
3 years ago
recaptcha
2 years ago
sendinblue
2 years ago
stripe
2 years ago
acceptance.php
3 years ago
checkbox.php
3 years ago
count.php
3 years ago
date.php
3 years ago
disallowed-list.php
4 years ago
doi-helper.php
4 years ago
file.php
3 years ago
flamingo.php
3 years ago
hidden.php
7 years ago
listo.php
3 years ago
number.php
3 years ago
quiz.php
4 years ago
really-simple-captcha.php
3 years ago
reflection.php
3 years ago
response.php
6 years ago
select.php
3 years ago
submit.php
4 years ago
text.php
3 years ago
textarea.php
3 years ago
listo.php
36 lines
| 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 | |
| 14 | $args = wp_parse_args( $args, array() ); |
| 15 | |
| 16 | $contact_form = wpcf7_get_current_contact_form(); |
| 17 | $args['locale'] = $contact_form->locale(); |
| 18 | |
| 19 | foreach ( (array) $options as $option ) { |
| 20 | $option = explode( '.', $option ); |
| 21 | $type = $option[0]; |
| 22 | |
| 23 | if ( isset( $option[1] ) ) { |
| 24 | $args['group'] = $option[1]; |
| 25 | } else { |
| 26 | unset( $args['group'] ); |
| 27 | } |
| 28 | |
| 29 | if ( $list = listo( $type, $args ) ) { |
| 30 | $data = array_merge( (array) $data, $list ); |
| 31 | } |
| 32 | } |
| 33 | |
| 34 | return $data; |
| 35 | } |
| 36 |