update
This commit is contained in:
@@ -12,6 +12,7 @@ function wpcf7_add_form_tag_acceptance() {
|
||||
'wpcf7_acceptance_form_tag_handler',
|
||||
array(
|
||||
'name-attr' => true,
|
||||
'selectable-values' => true,
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -52,8 +52,7 @@ function wpcf7_akismet( $spam, $submission ) {
|
||||
'blog_charset' => get_option( 'blog_charset' ),
|
||||
'user_ip' => $submission->get_meta( 'remote_ip' ),
|
||||
'user_agent' => $submission->get_meta( 'user_agent' ),
|
||||
'referrer' => isset( $_SERVER['HTTP_REFERER'] )
|
||||
? $_SERVER['HTTP_REFERER'] : '',
|
||||
'referrer' => $_SERVER['HTTP_REFERER'] ?? '',
|
||||
);
|
||||
|
||||
$datetime = date_create_immutable(
|
||||
|
||||
@@ -72,11 +72,14 @@ function wpcf7_checkbox_form_tag_handler( $tag ) {
|
||||
$tag->values = array_merge(
|
||||
array_slice( $tag->values, 0, -1 ),
|
||||
array_values( $data ),
|
||||
array_slice( $tag->values, -1 ) );
|
||||
array_slice( $tag->values, -1 )
|
||||
);
|
||||
|
||||
$tag->labels = array_merge(
|
||||
array_slice( $tag->labels, 0, -1 ),
|
||||
array_values( $data ),
|
||||
array_slice( $tag->labels, -1 ) );
|
||||
array_slice( $tag->labels, -1 )
|
||||
);
|
||||
} else {
|
||||
$tag->values = array_merge( $tag->values, array_values( $data ) );
|
||||
$tag->labels = array_merge( $tag->labels, array_values( $data ) );
|
||||
@@ -148,7 +151,7 @@ function wpcf7_checkbox_form_tag_handler( $tag ) {
|
||||
$class .= ' last';
|
||||
|
||||
if ( $free_text ) {
|
||||
$free_text_name = $tag->name . '_free_text';
|
||||
$free_text_name = sprintf( '_wpcf7_free_text_%s', $tag->name );
|
||||
|
||||
$free_text_atts = array(
|
||||
'name' => $free_text_name,
|
||||
@@ -207,6 +210,120 @@ function wpcf7_swv_add_checkbox_rules( $schema, $contact_form ) {
|
||||
}
|
||||
|
||||
|
||||
add_action(
|
||||
'wpcf7_swv_create_schema',
|
||||
'wpcf7_swv_add_checkbox_enum_rules',
|
||||
20, 2
|
||||
);
|
||||
|
||||
function wpcf7_swv_add_checkbox_enum_rules( $schema, $contact_form ) {
|
||||
$tags = $contact_form->scan_form_tags( array(
|
||||
'basetype' => array( 'checkbox', 'radio' ),
|
||||
) );
|
||||
|
||||
$values = array_reduce(
|
||||
$tags,
|
||||
function ( $values, $tag ) {
|
||||
if ( $tag->has_option( 'free_text' ) ) {
|
||||
$values[$tag->name] = 'free_text';
|
||||
}
|
||||
|
||||
if (
|
||||
isset( $values[$tag->name] ) and
|
||||
! is_array( $values[$tag->name] ) // Maybe 'free_text'
|
||||
) {
|
||||
return $values;
|
||||
}
|
||||
|
||||
if ( ! isset( $values[$tag->name] ) ) {
|
||||
$values[$tag->name] = array();
|
||||
}
|
||||
|
||||
$tag_values = array_merge(
|
||||
(array) $tag->values,
|
||||
(array) $tag->get_data_option()
|
||||
);
|
||||
|
||||
$values[$tag->name] = array_merge(
|
||||
$values[$tag->name],
|
||||
$tag_values
|
||||
);
|
||||
|
||||
return $values;
|
||||
},
|
||||
array()
|
||||
);
|
||||
|
||||
foreach ( $values as $field => $field_values ) {
|
||||
if ( ! is_array( $field_values ) ) { // Maybe 'free_text'
|
||||
continue;
|
||||
}
|
||||
|
||||
$field_values = array_map(
|
||||
static function ( $value ) {
|
||||
return html_entity_decode(
|
||||
(string) $value,
|
||||
ENT_QUOTES | ENT_HTML5,
|
||||
'UTF-8'
|
||||
);
|
||||
},
|
||||
$field_values
|
||||
);
|
||||
|
||||
$field_values = array_filter(
|
||||
array_unique( $field_values ),
|
||||
static function ( $value ) {
|
||||
return '' !== $value;
|
||||
}
|
||||
);
|
||||
|
||||
$schema->add_rule(
|
||||
wpcf7_swv_create_rule( 'enum', array(
|
||||
'field' => $field,
|
||||
'accept' => array_values( $field_values ),
|
||||
'error' => $contact_form->filter_message(
|
||||
__( "Undefined value was submitted through this field.", 'contact-form-7' )
|
||||
),
|
||||
) )
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
add_filter( 'wpcf7_posted_data_checkbox',
|
||||
'wpcf7_posted_data_checkbox',
|
||||
10, 3
|
||||
);
|
||||
|
||||
add_filter( 'wpcf7_posted_data_checkbox*',
|
||||
'wpcf7_posted_data_checkbox',
|
||||
10, 3
|
||||
);
|
||||
|
||||
add_filter( 'wpcf7_posted_data_radio',
|
||||
'wpcf7_posted_data_checkbox',
|
||||
10, 3
|
||||
);
|
||||
|
||||
function wpcf7_posted_data_checkbox( $value, $value_orig, $form_tag ) {
|
||||
if ( $form_tag->has_option( 'free_text' ) ) {
|
||||
$value = (array) $value;
|
||||
|
||||
$free_text_name = sprintf( '_wpcf7_free_text_%s', $form_tag->name );
|
||||
$free_text = wp_unslash( $_POST[$free_text_name] ?? '' );
|
||||
|
||||
$last_val = array_pop( $value );
|
||||
|
||||
if ( isset( $last_val ) ) {
|
||||
$last_val = sprintf( '%s %s', $last_val, $free_text );
|
||||
$value[] = trim( $last_val );
|
||||
}
|
||||
}
|
||||
|
||||
return $value;
|
||||
}
|
||||
|
||||
|
||||
/* Tag generator */
|
||||
|
||||
add_action( 'wpcf7_admin_init',
|
||||
|
||||
@@ -14,7 +14,7 @@ wpcf7_include_module_file( 'constant-contact/doi.php' );
|
||||
add_action(
|
||||
'wpcf7_init',
|
||||
'wpcf7_constant_contact_register_service',
|
||||
20, 0
|
||||
120, 0
|
||||
);
|
||||
|
||||
/**
|
||||
|
||||
@@ -113,10 +113,7 @@ class WPCF7_ConstantContact extends WPCF7_Service_OAuth2 {
|
||||
}
|
||||
|
||||
public function link() {
|
||||
echo sprintf( '<a href="%1$s">%2$s</a>',
|
||||
'https://constant-contact.evyy.net/c/1293104/205991/3411',
|
||||
'constantcontact.com'
|
||||
);
|
||||
echo 'constantcontact.com';
|
||||
}
|
||||
|
||||
protected function get_redirect_uri() {
|
||||
@@ -247,7 +244,7 @@ class WPCF7_ConstantContact extends WPCF7_Service_OAuth2 {
|
||||
'Accept' => 'application/json',
|
||||
'Content-Type' => 'application/json; charset=utf-8',
|
||||
),
|
||||
'body' => json_encode( $properties ),
|
||||
'body' => wp_json_encode( $properties ),
|
||||
);
|
||||
|
||||
$response = $this->remote_request( $endpoint, $request );
|
||||
@@ -366,6 +363,15 @@ class WPCF7_ConstantContact extends WPCF7_Service_OAuth2 {
|
||||
}
|
||||
|
||||
public function display( $action = '' ) {
|
||||
echo sprintf(
|
||||
'<p><strong>%1$s</strong> %2$s</p>',
|
||||
esc_html( __( 'Warning:', 'contact-form-7' ) ),
|
||||
wpcf7_link(
|
||||
__( 'https://contactform7.com/2024/02/02/we-end-the-constant-contact-integration/', 'contact-form-7' ),
|
||||
__( "This feature is deprecated. You are not recommended to use it.", 'contact-form-7' )
|
||||
)
|
||||
);
|
||||
|
||||
echo sprintf(
|
||||
'<p>%s</p>',
|
||||
esc_html( __( "The Constant Contact integration module allows you to send contact data collected through your contact forms to the Constant Contact API. You can create reliable email subscription services in a few easy steps.", 'contact-form-7' ) )
|
||||
|
||||
@@ -13,8 +13,9 @@ function wpcf7_listo( $data, $options, $args ) {
|
||||
|
||||
$args = wp_parse_args( $args, array() );
|
||||
|
||||
$contact_form = wpcf7_get_current_contact_form();
|
||||
$args['locale'] = $contact_form->locale();
|
||||
if ( $contact_form = wpcf7_get_current_contact_form() ) {
|
||||
$args['locale'] = $contact_form->locale();
|
||||
}
|
||||
|
||||
foreach ( (array) $options as $option ) {
|
||||
$option = explode( '.', $option );
|
||||
|
||||
@@ -98,7 +98,7 @@ add_filter( 'wpcf7_validate_quiz', 'wpcf7_quiz_validation_filter', 10, 2 );
|
||||
function wpcf7_quiz_validation_filter( $result, $tag ) {
|
||||
$name = $tag->name;
|
||||
|
||||
$answer = isset( $_POST[$name] ) ? wp_unslash( $_POST[$name] ) : '';
|
||||
$answer = wp_unslash( $_POST[$name] ?? '' );
|
||||
|
||||
$answer = wpcf7_canonicalize( $answer, array(
|
||||
'strip_separators' => true,
|
||||
@@ -106,9 +106,7 @@ function wpcf7_quiz_validation_filter( $result, $tag ) {
|
||||
|
||||
$answer_hash = wp_hash( $answer, 'wpcf7_quiz' );
|
||||
|
||||
$expected_hash = isset( $_POST['_wpcf7_quiz_answer_' . $name] )
|
||||
? (string) $_POST['_wpcf7_quiz_answer_' . $name]
|
||||
: '';
|
||||
$expected_hash = (string) ( $_POST['_wpcf7_quiz_answer_' . $name] ?? '' );
|
||||
|
||||
if ( ! hash_equals( $expected_hash, $answer_hash ) ) {
|
||||
$result->invalidate( $tag, wpcf7_get_message( 'quiz_answer_not_correct' ) );
|
||||
@@ -170,24 +168,6 @@ function wpcf7_quiz_ajax_refill( $items ) {
|
||||
}
|
||||
|
||||
|
||||
/* Mail-tag replacement */
|
||||
|
||||
add_filter( 'wpcf7_mail_tag_replaced_quiz', 'wpcf7_quiz_mail_tag', 10, 4 );
|
||||
|
||||
function wpcf7_quiz_mail_tag( $replaced, $submitted, $html, $mail_tag ) {
|
||||
$field_name = $mail_tag->field_name();
|
||||
$submitted = isset( $_POST[$field_name] ) ? $_POST[$field_name] : '';
|
||||
$replaced = $submitted;
|
||||
|
||||
if ( $html ) {
|
||||
$replaced = esc_html( $replaced );
|
||||
$replaced = wptexturize( $replaced );
|
||||
}
|
||||
|
||||
return $replaced;
|
||||
}
|
||||
|
||||
|
||||
/* Messages */
|
||||
|
||||
add_filter( 'wpcf7_messages', 'wpcf7_quiz_messages', 10, 1 );
|
||||
|
||||
@@ -167,8 +167,8 @@ function wpcf7_captcha_validation_filter( $result, $tag ) {
|
||||
|
||||
$captchac = '_wpcf7_captcha_challenge_' . $name;
|
||||
|
||||
$prefix = isset( $_POST[$captchac] ) ? (string) $_POST[$captchac] : '';
|
||||
$response = isset( $_POST[$name] ) ? (string) $_POST[$name] : '';
|
||||
$prefix = (string) ( $_POST[$captchac] ?? '' );
|
||||
$response = (string) ( $_POST[$name] ?? '' );
|
||||
$response = wpcf7_canonicalize( $response );
|
||||
|
||||
if ( 0 === strlen( $prefix )
|
||||
|
||||
@@ -1 +1 @@
|
||||
document.addEventListener("DOMContentLoaded",(t=>{var e;wpcf7_recaptcha={...null!==(e=wpcf7_recaptcha)&&void 0!==e?e:{}};const c=wpcf7_recaptcha.sitekey,{homepage:n,contactform:a}=wpcf7_recaptcha.actions,o=t=>{const{action:e,func:n,params:a}=t;grecaptcha.execute(c,{action:e}).then((t=>{const c=new CustomEvent("wpcf7grecaptchaexecuted",{detail:{action:e,token:t}});document.dispatchEvent(c)})).then((()=>{"function"==typeof n&&n(...a)})).catch((t=>console.error(t)))};if(grecaptcha.ready((()=>{o({action:n})})),document.addEventListener("change",(t=>{o({action:a})})),"undefined"!=typeof wpcf7&&"function"==typeof wpcf7.submit){const t=wpcf7.submit;wpcf7.submit=function(e){o({action:a,func:t,params:[e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:{}]})}}document.addEventListener("wpcf7grecaptchaexecuted",(t=>{const e=document.querySelectorAll('form.wpcf7-form input[name="_wpcf7_recaptcha_response"]');for(let c=0;c<e.length;c++)e[c].setAttribute("value",t.detail.token)}))}));
|
||||
document.addEventListener("DOMContentLoaded",(e=>{var t;wpcf7_recaptcha={...null!==(t=wpcf7_recaptcha)&&void 0!==t?t:{}};const c=wpcf7_recaptcha.sitekey,{homepage:n,contactform:a}=wpcf7_recaptcha.actions,o=e=>{const{action:t,func:n,params:a}=e;grecaptcha.execute(c,{action:t}).then((e=>{const c=new CustomEvent("wpcf7grecaptchaexecuted",{detail:{action:t,token:e}});document.dispatchEvent(c)})).then((()=>{"function"==typeof n&&n(...a)})).catch((e=>console.error(e)))};if(grecaptcha.ready((()=>{o({action:n})})),document.addEventListener("change",(e=>{o({action:a})})),"undefined"!=typeof wpcf7&&"function"==typeof wpcf7.submit){const e=wpcf7.submit;wpcf7.submit=(t,c={})=>{o({action:a,func:e,params:[t,c]})}}document.addEventListener("wpcf7grecaptchaexecuted",(e=>{const t=document.querySelectorAll('form.wpcf7-form input[name="_wpcf7_recaptcha_response"]');for(let c=0;c<t.length;c++)t[c].setAttribute("value",e.detail.token)}))}));
|
||||
@@ -53,7 +53,7 @@ function wpcf7_recaptcha_enqueue_scripts() {
|
||||
),
|
||||
array(),
|
||||
'3.0',
|
||||
true
|
||||
array( 'in_footer' => true )
|
||||
);
|
||||
|
||||
$assets = array();
|
||||
@@ -79,7 +79,7 @@ function wpcf7_recaptcha_enqueue_scripts() {
|
||||
)
|
||||
),
|
||||
$assets['version'],
|
||||
true
|
||||
array( 'in_footer' => true )
|
||||
);
|
||||
|
||||
wp_enqueue_script( 'wpcf7-recaptcha' );
|
||||
@@ -135,8 +135,7 @@ function wpcf7_recaptcha_verify_response( $spam, $submission ) {
|
||||
return $spam;
|
||||
}
|
||||
|
||||
$token = isset( $_POST['_wpcf7_recaptcha_response'] )
|
||||
? trim( $_POST['_wpcf7_recaptcha_response'] ) : '';
|
||||
$token = trim( $_POST['_wpcf7_recaptcha_response'] ?? '' );
|
||||
|
||||
if ( $service->verify( $token ) ) { // Human
|
||||
$spam = false;
|
||||
|
||||
@@ -133,6 +133,10 @@ class WPCF7_RECAPTCHA extends WPCF7_Service {
|
||||
|
||||
$endpoint = 'https://www.google.com/recaptcha/api/siteverify';
|
||||
|
||||
if ( apply_filters( 'wpcf7_use_recaptcha_net', false ) ) {
|
||||
$endpoint = 'https://www.recaptcha.net/recaptcha/api/siteverify';
|
||||
}
|
||||
|
||||
$sitekey = $this->get_sitekey();
|
||||
$secret = $this->get_secret( $sitekey );
|
||||
|
||||
@@ -221,8 +225,8 @@ class WPCF7_RECAPTCHA extends WPCF7_Service {
|
||||
$this->reset_data();
|
||||
$redirect_to = $this->menu_page_url( 'action=setup' );
|
||||
} else {
|
||||
$sitekey = isset( $_POST['sitekey'] ) ? trim( $_POST['sitekey'] ) : '';
|
||||
$secret = isset( $_POST['secret'] ) ? trim( $_POST['secret'] ) : '';
|
||||
$sitekey = trim( $_POST['sitekey'] ?? '' );
|
||||
$secret = trim( $_POST['secret'] ?? '' );
|
||||
|
||||
if ( $sitekey and $secret ) {
|
||||
$this->sitekeys = array( $sitekey => $secret );
|
||||
|
||||
@@ -153,6 +153,75 @@ function wpcf7_swv_add_select_rules( $schema, $contact_form ) {
|
||||
}
|
||||
|
||||
|
||||
add_action(
|
||||
'wpcf7_swv_create_schema',
|
||||
'wpcf7_swv_add_select_enum_rules',
|
||||
20, 2
|
||||
);
|
||||
|
||||
function wpcf7_swv_add_select_enum_rules( $schema, $contact_form ) {
|
||||
$tags = $contact_form->scan_form_tags( array(
|
||||
'basetype' => array( 'select' ),
|
||||
) );
|
||||
|
||||
$values = array_reduce(
|
||||
$tags,
|
||||
function ( $values, $tag ) {
|
||||
if ( ! isset( $values[$tag->name] ) ) {
|
||||
$values[$tag->name] = array();
|
||||
}
|
||||
|
||||
$tag_values = array_merge(
|
||||
(array) $tag->values,
|
||||
(array) $tag->get_data_option()
|
||||
);
|
||||
|
||||
if ( $tag->has_option( 'first_as_label' ) ) {
|
||||
$tag_values = array_slice( $tag_values, 1 );
|
||||
}
|
||||
|
||||
$values[$tag->name] = array_merge(
|
||||
$values[$tag->name],
|
||||
$tag_values
|
||||
);
|
||||
|
||||
return $values;
|
||||
},
|
||||
array()
|
||||
);
|
||||
|
||||
foreach ( $values as $field => $field_values ) {
|
||||
$field_values = array_map(
|
||||
static function ( $value ) {
|
||||
return html_entity_decode(
|
||||
(string) $value,
|
||||
ENT_QUOTES | ENT_HTML5,
|
||||
'UTF-8'
|
||||
);
|
||||
},
|
||||
$field_values
|
||||
);
|
||||
|
||||
$field_values = array_filter(
|
||||
array_unique( $field_values ),
|
||||
static function ( $value ) {
|
||||
return '' !== $value;
|
||||
}
|
||||
);
|
||||
|
||||
$schema->add_rule(
|
||||
wpcf7_swv_create_rule( 'enum', array(
|
||||
'field' => $field,
|
||||
'accept' => array_values( $field_values ),
|
||||
'error' => $contact_form->filter_message(
|
||||
__( "Undefined value was submitted through this field.", 'contact-form-7' )
|
||||
),
|
||||
) )
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Tag generator */
|
||||
|
||||
add_action( 'wpcf7_admin_init', 'wpcf7_add_tag_generator_menu', 25, 0 );
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
/**
|
||||
* Brevo (formerly Sendinblue) module main file
|
||||
* Brevo module main file
|
||||
*
|
||||
* @link https://contactform7.com/sendinblue-integration/
|
||||
*/
|
||||
@@ -219,6 +219,18 @@ function wpcf7_sendinblue_collect_parameters() {
|
||||
}
|
||||
}
|
||||
|
||||
$params = array_map(
|
||||
function ( $param ) {
|
||||
if ( is_array( $param ) ) {
|
||||
$param = wpcf7_array_flatten( $param );
|
||||
$param = reset( $param );
|
||||
}
|
||||
|
||||
return $param;
|
||||
},
|
||||
$params
|
||||
);
|
||||
|
||||
$params = apply_filters(
|
||||
'wpcf7_sendinblue_collect_parameters',
|
||||
$params
|
||||
|
||||
@@ -27,7 +27,7 @@ class WPCF7_Sendinblue extends WPCF7_Service {
|
||||
}
|
||||
|
||||
public function get_title() {
|
||||
return __( 'Brevo (formerly Sendinblue)', 'contact-form-7' );
|
||||
return __( 'Brevo', 'contact-form-7' );
|
||||
}
|
||||
|
||||
public function is_active() {
|
||||
@@ -47,7 +47,7 @@ class WPCF7_Sendinblue extends WPCF7_Service {
|
||||
|
||||
public function link() {
|
||||
echo wpcf7_link(
|
||||
'https://www.brevo.com/?tap_a=30591-fb13f0&tap_s=1031580-b1bb1d',
|
||||
'https://get.brevo.com/wpcf7-integration',
|
||||
'brevo.com'
|
||||
);
|
||||
}
|
||||
@@ -88,9 +88,7 @@ class WPCF7_Sendinblue extends WPCF7_Service {
|
||||
$this->reset_data();
|
||||
$redirect_to = $this->menu_page_url( 'action=setup' );
|
||||
} else {
|
||||
$this->api_key = isset( $_POST['api_key'] )
|
||||
? trim( $_POST['api_key'] )
|
||||
: '';
|
||||
$this->api_key = trim( $_POST['api_key'] ?? '' );
|
||||
|
||||
$confirmed = $this->confirm_key();
|
||||
|
||||
@@ -153,7 +151,7 @@ class WPCF7_Sendinblue extends WPCF7_Service {
|
||||
'<p><strong>%s</strong></p>',
|
||||
wpcf7_link(
|
||||
__( 'https://contactform7.com/sendinblue-integration/', 'contact-form-7' ),
|
||||
__( 'Brevo (formerly Sendinblue) integration', 'contact-form-7' )
|
||||
__( 'Brevo integration', 'contact-form-7' )
|
||||
)
|
||||
);
|
||||
|
||||
@@ -252,12 +250,14 @@ trait WPCF7_Sendinblue_API {
|
||||
}
|
||||
|
||||
|
||||
public function get_lists() {
|
||||
public function get_lists( $options = '' ) {
|
||||
$options = wp_parse_args( $options, array(
|
||||
'limit' => 50,
|
||||
'offset' => 0,
|
||||
) );
|
||||
|
||||
$endpoint = add_query_arg(
|
||||
array(
|
||||
'limit' => 50,
|
||||
'offset' => 0,
|
||||
),
|
||||
$options,
|
||||
'https://api.sendinblue.com/v3/contacts/lists'
|
||||
);
|
||||
|
||||
@@ -336,7 +336,7 @@ trait WPCF7_Sendinblue_API {
|
||||
'Content-Type' => 'application/json; charset=utf-8',
|
||||
'API-Key' => $this->get_api_key(),
|
||||
),
|
||||
'body' => json_encode( $properties ),
|
||||
'body' => wp_json_encode( $properties ),
|
||||
);
|
||||
|
||||
$response = wp_remote_post( $endpoint, $request );
|
||||
@@ -364,7 +364,7 @@ trait WPCF7_Sendinblue_API {
|
||||
'Content-Type' => 'application/json; charset=utf-8',
|
||||
'API-Key' => $this->get_api_key(),
|
||||
),
|
||||
'body' => json_encode( $properties ),
|
||||
'body' => wp_json_encode( $properties ),
|
||||
);
|
||||
|
||||
$response = wp_remote_post( $endpoint, $request );
|
||||
|
||||
@@ -61,7 +61,7 @@ class WPCF7_Stripe_API {
|
||||
$headers = array(
|
||||
'Authorization' => sprintf( 'Bearer %s', $this->secret ),
|
||||
'Stripe-Version' => self::api_version,
|
||||
'X-Stripe-Client-User-Agent' => json_encode( $ua ),
|
||||
'X-Stripe-Client-User-Agent' => wp_json_encode( $ua ),
|
||||
'User-Agent' => sprintf(
|
||||
'%1$s/%2$s (%3$s)',
|
||||
self::app_name,
|
||||
|
||||
@@ -107,9 +107,8 @@ class WPCF7_Stripe extends WPCF7_Service {
|
||||
$this->reset_data();
|
||||
$redirect_to = $this->menu_page_url( 'action=setup' );
|
||||
} else {
|
||||
$publishable = isset( $_POST['publishable'] ) ?
|
||||
trim( $_POST['publishable'] ) : '';
|
||||
$secret = isset( $_POST['secret'] ) ? trim( $_POST['secret'] ) : '';
|
||||
$publishable = trim( $_POST['publishable'] ?? '' );
|
||||
$secret = trim( $_POST['secret'] ?? '' );
|
||||
|
||||
if ( $publishable and $secret ) {
|
||||
$this->api_keys = array(
|
||||
|
||||
@@ -80,7 +80,7 @@ function wpcf7_stripe_enqueue_scripts() {
|
||||
)
|
||||
),
|
||||
$assets['version'],
|
||||
true
|
||||
array( 'in_footer' => true )
|
||||
);
|
||||
|
||||
$api_keys = $service->get_api_keys();
|
||||
|
||||
@@ -41,7 +41,7 @@ function wpcf7_text_form_tag_handler( $tag ) {
|
||||
$atts = array();
|
||||
|
||||
$atts['size'] = $tag->get_size_option( '40' );
|
||||
$atts['maxlength'] = $tag->get_maxlength_option();
|
||||
$atts['maxlength'] = $tag->get_maxlength_option( '80' );
|
||||
$atts['minlength'] = $tag->get_minlength_option();
|
||||
|
||||
if ( $atts['maxlength'] and $atts['minlength']
|
||||
@@ -156,7 +156,7 @@ function wpcf7_swv_add_text_rules( $schema, $contact_form ) {
|
||||
);
|
||||
}
|
||||
|
||||
if ( $maxlength = $tag->get_maxlength_option() ) {
|
||||
if ( $maxlength = $tag->get_maxlength_option( '80' ) ) {
|
||||
$schema->add_rule(
|
||||
wpcf7_swv_create_rule( 'maxlength', array(
|
||||
'field' => $tag->name,
|
||||
|
||||
@@ -30,7 +30,7 @@ function wpcf7_textarea_form_tag_handler( $tag ) {
|
||||
|
||||
$atts['cols'] = $tag->get_cols_option( '40' );
|
||||
$atts['rows'] = $tag->get_rows_option( '10' );
|
||||
$atts['maxlength'] = $tag->get_maxlength_option();
|
||||
$atts['maxlength'] = $tag->get_maxlength_option( '400' );
|
||||
$atts['minlength'] = $tag->get_minlength_option();
|
||||
|
||||
if ( $atts['maxlength'] and $atts['minlength']
|
||||
@@ -119,7 +119,7 @@ function wpcf7_swv_add_textarea_rules( $schema, $contact_form ) {
|
||||
);
|
||||
}
|
||||
|
||||
if ( $maxlength = $tag->get_maxlength_option() ) {
|
||||
if ( $maxlength = $tag->get_maxlength_option( '400' ) ) {
|
||||
$schema->add_rule(
|
||||
wpcf7_swv_create_rule( 'maxlength', array(
|
||||
'field' => $tag->name,
|
||||
|
||||
Reference in New Issue
Block a user