This commit is contained in:
2026-03-11 15:57:27 +01:00
parent 481271c972
commit b4b460fd21
10775 changed files with 2071579 additions and 26409 deletions

View File

@@ -38,9 +38,7 @@ function wpcf7_sendinblue_save_contact_form( $contact_form, $args, $context ) {
return;
}
$prop = isset( $_POST['wpcf7-sendinblue'] )
? (array) $_POST['wpcf7-sendinblue']
: array();
$prop = (array) ( $_POST['wpcf7-sendinblue'] ?? array() );
$prop = wp_parse_args(
$prop,
@@ -98,15 +96,15 @@ function wpcf7_sendinblue_editor_panels( $panels ) {
),
wpcf7_link(
__( 'https://contactform7.com/sendinblue-integration/', 'contact-form-7' ),
__( 'Brevo (formerly Sendinblue) integration', 'contact-form-7' )
__( 'Brevo integration', 'contact-form-7' )
)
);
$lists = $service->get_lists();
$lists = wpcf7_sendinblue_get_lists();
$templates = $service->get_templates();
?>
<h2><?php echo esc_html( __( 'Brevo (formerly Sendinblue)', 'contact-form-7' ) ); ?></h2>
<h2><?php echo esc_html( __( 'Brevo', 'contact-form-7' ) ); ?></h2>
<fieldset>
<legend><?php echo $description; ?></legend>
@@ -301,3 +299,39 @@ function wpcf7_sendinblue_editor_panels( $panels ) {
return $panels;
}
/**
* Retrieves contact lists from Brevo's database.
*/
function wpcf7_sendinblue_get_lists() {
static $lists = array();
$service = WPCF7_Sendinblue::get_instance();
if ( ! empty( $lists ) or ! $service->is_active() ) {
return $lists;
}
$limit = 50;
$offset = 0;
while ( count( $lists ) < $limit * 10 ) {
$lists_next = (array) $service->get_lists( array(
'limit' => $limit,
'offset' => $offset,
) );
if ( ! empty( $lists_next ) ) {
$lists = array_merge( $lists, $lists_next );
}
if ( count( $lists_next ) < $limit ) {
break;
}
$offset += $limit;
}
return $lists;
}