test
This commit is contained in:
@@ -16,19 +16,31 @@ function sev_tort_handle_lead_form() {
|
||||
sev_tort_redirect_form_status( 'consent' );
|
||||
}
|
||||
|
||||
if ( ! empty( $_POST['lead_company'] ) ) {
|
||||
sev_tort_redirect_form_status( 'success' );
|
||||
}
|
||||
|
||||
$name = isset( $_POST['lead_name'] ) ? sanitize_text_field( wp_unslash( $_POST['lead_name'] ) ) : '';
|
||||
$phone = isset( $_POST['lead_phone'] ) ? sanitize_text_field( wp_unslash( $_POST['lead_phone'] ) ) : '';
|
||||
$email = isset( $_POST['lead_email'] ) ? sanitize_email( wp_unslash( $_POST['lead_email'] ) ) : '';
|
||||
$message = isset( $_POST['lead_message'] ) ? sanitize_textarea_field( wp_unslash( $_POST['lead_message'] ) ) : '';
|
||||
$page = isset( $_POST['lead_page'] ) ? sanitize_text_field( wp_unslash( $_POST['lead_page'] ) ) : '';
|
||||
$source = isset( $_POST['lead_source'] ) ? sanitize_text_field( wp_unslash( $_POST['lead_source'] ) ) : '';
|
||||
|
||||
if ( '' === $phone ) {
|
||||
if ( '' === $phone || ! preg_match( '/^\+7 \([0-9]{3}\) [0-9]{3}-[0-9]{2}-[0-9]{2}$/', $phone ) ) {
|
||||
sev_tort_redirect_form_status( 'error' );
|
||||
}
|
||||
|
||||
if ( '' !== $email && ! is_email( $email ) ) {
|
||||
sev_tort_redirect_form_status( 'error' );
|
||||
}
|
||||
|
||||
$text = "Новая заявка с сайта sevastopol-tort.ru\n";
|
||||
$text .= "Страница: " . $page . "\n";
|
||||
$text .= "Страница: " . ( $page ? $page : 'не указана' ) . "\n";
|
||||
$text .= "Источник: " . ( $source ? $source : 'не указан' ) . "\n";
|
||||
$text .= "Имя: " . ( $name ? $name : 'не указано' ) . "\n";
|
||||
$text .= "Телефон: " . $phone . "\n";
|
||||
$text .= "Почта: " . ( $email ? $email : 'не указана' ) . "\n";
|
||||
$text .= "Комментарий: " . ( $message ? $message : 'не указан' );
|
||||
|
||||
$sent = sev_tort_send_telegram_message( $text );
|
||||
|
||||
Reference in New Issue
Block a user