Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93

Warning: Undefined array key "page_file_edit_line" in /home/sportsfever/public_html/filemanger/edit_text_line.php on line 32
/home/sportsfe.../httpdocs/clone/wp-conte.../themes/Divi/includes/builder/module
File: ContactForm.php
// check all the required fields, generate error message if required field is empty
[500] Fix | Delete
$field_value = isset( $_POST[ $value['field_id'] ] ) ? trim( $_POST[ $value['field_id'] ] ) : '';
[501] Fix | Delete
[502] Fix | Delete
if ( 'required' === $value['required_mark'] && empty( $field_value ) && ! is_numeric( $field_value ) ) {
[503] Fix | Delete
$et_error_message .= sprintf( '<p class="et_pb_contact_error_text">%1$s</p>', esc_html__( 'Make sure you fill in all required fields.', 'et_builder' ) );
[504] Fix | Delete
$et_contact_error = true;
[505] Fix | Delete
continue;
[506] Fix | Delete
}
[507] Fix | Delete
[508] Fix | Delete
// additional check for email field
[509] Fix | Delete
if ( 'email' === $value['field_type'] && 'required' === $value['required_mark'] && ! empty( $field_value ) ) {
[510] Fix | Delete
$contact_email = isset( $_POST[ $value['field_id'] ] ) ? sanitize_email( $_POST[ $value['field_id'] ] ) : '';
[511] Fix | Delete
[512] Fix | Delete
if ( ! empty( $contact_email ) && ! is_email( $contact_email ) ) {
[513] Fix | Delete
$et_error_message .= sprintf( '<p class="et_pb_contact_error_text">%1$s</p>', esc_html__( 'Invalid Email.', 'et_builder' ) );
[514] Fix | Delete
$et_contact_error = true;
[515] Fix | Delete
}
[516] Fix | Delete
}
[517] Fix | Delete
[518] Fix | Delete
// prepare the array of processed field values in convenient format
[519] Fix | Delete
if ( false === $et_contact_error ) {
[520] Fix | Delete
$processed_fields_values[ $value['original_id'] ]['value'] = $field_value;
[521] Fix | Delete
$processed_fields_values[ $value['original_id'] ]['label'] = $value['field_label'];
[522] Fix | Delete
}
[523] Fix | Delete
}
[524] Fix | Delete
[525] Fix | Delete
// Check form's integrity by comparing fields structure (used for required fields check, etc)
[526] Fix | Delete
// stored in the shortcode against submitted value generated using JS on the front end
[527] Fix | Delete
// to prevent data being altered by modifying form markup.
[528] Fix | Delete
$form_map = $this->get_form_map( $shortcode_content, $et_pb_contact_form_num, $hidden_form_fields );
[529] Fix | Delete
[530] Fix | Delete
if ( serialize( $submitted_form_map ) !== serialize( $form_map ) ) {
[531] Fix | Delete
$et_error_message .= sprintf(
[532] Fix | Delete
'<p class="et_pb_contact_error_text">%1$s</p>',
[533] Fix | Delete
esc_html__( 'Invalid submission. Please refresh the page and try again.', 'et_builder' )
[534] Fix | Delete
);
[535] Fix | Delete
$et_contact_error = true;
[536] Fix | Delete
}
[537] Fix | Delete
}
[538] Fix | Delete
} else {
[539] Fix | Delete
$et_error_message .= sprintf( '<p class="et_pb_contact_error_text">%1$s</p>', esc_html__( 'Make sure you fill in all required fields.', 'et_builder' ) );
[540] Fix | Delete
$et_contact_error = true;
[541] Fix | Delete
}
[542] Fix | Delete
} else {
[543] Fix | Delete
if ( false === $nonce_result && isset( $_POST['et_pb_contactform_submit_' . $et_pb_contact_form_num] ) && empty( $_POST['et_pb_contact_et_number_' . $et_pb_contact_form_num] ) ) {
[544] Fix | Delete
$et_error_message .= sprintf( '<p class="et_pb_contact_error_text">%1$s</p>', esc_html__( 'Please refresh the page and try again.', 'et_builder' ) );
[545] Fix | Delete
}
[546] Fix | Delete
$et_contact_error = true;
[547] Fix | Delete
}
[548] Fix | Delete
[549] Fix | Delete
// generate digits for captcha
[550] Fix | Delete
$et_pb_first_digit = rand( 1, 15 );
[551] Fix | Delete
$et_pb_second_digit = rand( 1, 15 );
[552] Fix | Delete
[553] Fix | Delete
if ( ! $et_contact_error && $nonce_result ) {
[554] Fix | Delete
$et_email_to = '' !== $email
[555] Fix | Delete
? $email
[556] Fix | Delete
: get_site_option( 'admin_email' );
[557] Fix | Delete
[558] Fix | Delete
$et_site_name = get_option( 'blogname' );
[559] Fix | Delete
[560] Fix | Delete
$contact_name = isset( $processed_fields_values['name'] ) ? stripslashes( sanitize_text_field( $processed_fields_values['name']['value'] ) ) : '';
[561] Fix | Delete
[562] Fix | Delete
if ( '' !== $custom_message ) {
[563] Fix | Delete
// decode html entites to make sure HTML from the message pattern is rendered properly
[564] Fix | Delete
$message_pattern = et_builder_convert_line_breaks( html_entity_decode( $custom_message ), "\r\n" );
[565] Fix | Delete
[566] Fix | Delete
// insert the data from contact form into the message pattern
[567] Fix | Delete
foreach ( $processed_fields_values as $key => $value ) {
[568] Fix | Delete
// strip all tags from each field. Don't strip tags from the entire message to allow using HTML in the pattern.
[569] Fix | Delete
$message_pattern = str_ireplace( "%%{$key}%%", wp_strip_all_tags( $value['value'] ), $message_pattern );
[570] Fix | Delete
}
[571] Fix | Delete
[572] Fix | Delete
if ( is_array( $hidden_form_fields ) ) {
[573] Fix | Delete
foreach ( $hidden_form_fields as $hidden_field_label ) {
[574] Fix | Delete
$message_pattern = str_ireplace( "%%{$hidden_field_label}%%", '', $message_pattern );
[575] Fix | Delete
}
[576] Fix | Delete
}
[577] Fix | Delete
} else {
[578] Fix | Delete
// use default message pattern if custom pattern is not defined
[579] Fix | Delete
$message_pattern = isset( $processed_fields_values['message']['value'] ) ? $processed_fields_values['message']['value'] : '';
[580] Fix | Delete
[581] Fix | Delete
// Add all custom fields into the message body by default
[582] Fix | Delete
foreach ( $processed_fields_values as $key => $value ) {
[583] Fix | Delete
if ( ! in_array( $key, array( 'message', 'name', 'email' ) ) ) {
[584] Fix | Delete
$message_pattern .= "\r\n";
[585] Fix | Delete
$message_pattern .= sprintf(
[586] Fix | Delete
'%1$s: %2$s',
[587] Fix | Delete
'' !== $value['label'] ? $value['label'] : $key,
[588] Fix | Delete
$value['value']
[589] Fix | Delete
);
[590] Fix | Delete
}
[591] Fix | Delete
}
[592] Fix | Delete
[593] Fix | Delete
// strip all tags from the message content
[594] Fix | Delete
$message_pattern = wp_strip_all_tags( $message_pattern );
[595] Fix | Delete
}
[596] Fix | Delete
[597] Fix | Delete
$http_host = str_replace( 'www.', '', $_SERVER['HTTP_HOST'] );
[598] Fix | Delete
[599] Fix | Delete
$headers[] = "From: \"{$contact_name}\" <mail@{$http_host}>";
[600] Fix | Delete
[601] Fix | Delete
// Set `Reply-To` email header based on contact_name and contact_email values
[602] Fix | Delete
if ( ! empty( $contact_email ) ) {
[603] Fix | Delete
$contact_name = ! empty( $contact_name ) ? $contact_name : $contact_email;
[604] Fix | Delete
$headers[] = "Reply-To: \"{$contact_name}\" <{$contact_email}>";
[605] Fix | Delete
}
[606] Fix | Delete
[607] Fix | Delete
add_filter( 'et_get_safe_localization', 'et_allow_ampersand' );
[608] Fix | Delete
[609] Fix | Delete
// don't strip tags at this point to properly send the HTML from pattern. All the unwanted HTML stripped at this point.
[610] Fix | Delete
$email_message = trim( stripslashes( $message_pattern ) );
[611] Fix | Delete
[612] Fix | Delete
wp_mail( apply_filters( 'et_contact_page_email_to', $et_email_to ),
[613] Fix | Delete
et_get_safe_localization( sprintf(
[614] Fix | Delete
__( 'New Message From %1$s%2$s', 'et_builder' ),
[615] Fix | Delete
sanitize_text_field( html_entity_decode( $et_site_name, ENT_QUOTES, 'UTF-8' ) ),
[616] Fix | Delete
( '' !== $title ? sprintf( _x( ' - %s', 'contact form title separator', 'et_builder' ), $title ) : '' )
[617] Fix | Delete
) ),
[618] Fix | Delete
! empty( $email_message ) ? $email_message : ' ',
[619] Fix | Delete
apply_filters( 'et_contact_page_headers', $headers, $contact_name, $contact_email )
[620] Fix | Delete
);
[621] Fix | Delete
[622] Fix | Delete
remove_filter( 'et_get_safe_localization', 'et_allow_ampersand' );
[623] Fix | Delete
[624] Fix | Delete
$et_error_message = sprintf( '<p>%1$s</p>', et_core_esc_previously( $success_message ) );
[625] Fix | Delete
}
[626] Fix | Delete
[627] Fix | Delete
$form = '';
[628] Fix | Delete
$current_url = ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
[629] Fix | Delete
[630] Fix | Delete
$et_pb_captcha = sprintf( '
[631] Fix | Delete
<div class="et_pb_contact_right">
[632] Fix | Delete
<p class="clearfix">
[633] Fix | Delete
<span class="et_pb_contact_captcha_question">%1$s</span> = <input type="text" size="2" class="input et_pb_contact_captcha" data-first_digit="%3$s" data-second_digit="%4$s" value="" name="et_pb_contact_captcha_%2$s" data-required_mark="required" autocomplete="off">
[634] Fix | Delete
</p>
[635] Fix | Delete
</div><!-- .et_pb_contact_right -->',
[636] Fix | Delete
sprintf( '%1$s + %2$s', esc_html( $et_pb_first_digit ), esc_html( $et_pb_second_digit ) ),
[637] Fix | Delete
esc_attr( $et_pb_contact_form_num ),
[638] Fix | Delete
esc_attr( $et_pb_first_digit ),
[639] Fix | Delete
esc_attr( $et_pb_second_digit )
[640] Fix | Delete
);
[641] Fix | Delete
[642] Fix | Delete
if ( '' === trim( $content ) ) {
[643] Fix | Delete
$content = do_shortcode( $this->predefined_child_modules() );
[644] Fix | Delete
}
[645] Fix | Delete
[646] Fix | Delete
if ( $et_contact_error ) {
[647] Fix | Delete
$multi_view_data_attr = $multi_view->render_attrs( array(
[648] Fix | Delete
'content' => '{{submit_button_text}}',
[649] Fix | Delete
) );
[650] Fix | Delete
[651] Fix | Delete
$form = sprintf( '
[652] Fix | Delete
<div class="et_pb_contact">
[653] Fix | Delete
<form class="et_pb_contact_form clearfix" method="post" action="%1$s">
[654] Fix | Delete
%8$s
[655] Fix | Delete
<input type="hidden" value="et_contact_proccess" name="et_pb_contactform_submit_%7$s"/>
[656] Fix | Delete
<div class="et_contact_bottom_container">
[657] Fix | Delete
%2$s
[658] Fix | Delete
<button type="submit" name="et_builder_submit_button" class="et_pb_contact_submit et_pb_button%6$s"%5$s%9$s%10$s%11$s>%3$s</button>
[659] Fix | Delete
</div>
[660] Fix | Delete
%4$s
[661] Fix | Delete
</form>
[662] Fix | Delete
</div> <!-- .et_pb_contact -->',
[663] Fix | Delete
esc_url( $current_url ),
[664] Fix | Delete
( 'on' === $captcha && 'off' === $use_spam_service ? $et_pb_captcha : '' ),
[665] Fix | Delete
esc_html( $multi_view->get_value( 'submit_button_text' ) ),
[666] Fix | Delete
wp_nonce_field( 'et-pb-contact-form-submit', '_wpnonce-et-pb-contact-form-submitted-' . $et_pb_contact_form_num, true, false ),
[667] Fix | Delete
'' !== $custom_icon && 'on' === $button_custom ? sprintf(
[668] Fix | Delete
' data-icon="%1$s"',
[669] Fix | Delete
esc_attr( et_pb_process_font_icon( $custom_icon ) )
[670] Fix | Delete
) : '', // #5
[671] Fix | Delete
'' !== $custom_icon && 'on' === $button_custom ? ' et_pb_custom_button_icon' : '',
[672] Fix | Delete
esc_attr( $et_pb_contact_form_num ),
[673] Fix | Delete
$content,
[674] Fix | Delete
'' !== $custom_icon_tablet && 'on' === $button_custom ? sprintf( ' data-icon-tablet="%1$s"', esc_attr( et_pb_process_font_icon( $custom_icon_tablet ) ) ) : '',
[675] Fix | Delete
'' !== $custom_icon_phone && 'on' === $button_custom ? sprintf( ' data-icon-phone="%1$s"', esc_attr( et_pb_process_font_icon( $custom_icon_phone ) ) ) : '', // #10
[676] Fix | Delete
$multi_view_data_attr
[677] Fix | Delete
);
[678] Fix | Delete
}
[679] Fix | Delete
[680] Fix | Delete
// Module classnames
[681] Fix | Delete
$this->add_classname( array(
[682] Fix | Delete
'et_pb_contact_form_container',
[683] Fix | Delete
'clearfix',
[684] Fix | Delete
$this->get_text_orientation_classname(),
[685] Fix | Delete
) );
[686] Fix | Delete
[687] Fix | Delete
// Remove automatically added classname
[688] Fix | Delete
$this->remove_classname( $render_slug );
[689] Fix | Delete
[690] Fix | Delete
// Contact form should always have the ID. Use saved ID or generate automatically
[691] Fix | Delete
$module_id = '' !== $this->module_id(false) ? $this->module_id(false) : 'et_pb_contact_form_' . $et_pb_contact_form_num;
[692] Fix | Delete
[693] Fix | Delete
$output = sprintf( '
[694] Fix | Delete
<div id="%4$s" class="%5$s" data-form_unique_num="%6$s"%7$s>
[695] Fix | Delete
%9$s
[696] Fix | Delete
%8$s
[697] Fix | Delete
%1$s
[698] Fix | Delete
<div class="et-pb-contact-message">%2$s</div>
[699] Fix | Delete
%3$s
[700] Fix | Delete
</div> <!-- .et_pb_contact_form_container -->
[701] Fix | Delete
',
[702] Fix | Delete
$title,
[703] Fix | Delete
$et_error_message,
[704] Fix | Delete
$form,
[705] Fix | Delete
esc_attr( $module_id ),
[706] Fix | Delete
$this->module_classname( $render_slug ),
[707] Fix | Delete
esc_attr( $et_pb_contact_form_num ),
[708] Fix | Delete
'on' === $use_redirect && '' !== $redirect_url ? sprintf( ' data-redirect_url="%1$s"', esc_attr( $redirect_url ) ) : '',
[709] Fix | Delete
$video_background,
[710] Fix | Delete
$parallax_image_background
[711] Fix | Delete
);
[712] Fix | Delete
[713] Fix | Delete
return $output;
[714] Fix | Delete
}
[715] Fix | Delete
[716] Fix | Delete
/**
[717] Fix | Delete
* Filter multi view value.
[718] Fix | Delete
*
[719] Fix | Delete
* @since 3.27.1
[720] Fix | Delete
*
[721] Fix | Delete
* @see ET_Builder_Module_Helper_MultiViewOptions::filter_value
[722] Fix | Delete
*
[723] Fix | Delete
* @param mixed $raw_value Props raw value.
[724] Fix | Delete
* @param array $args {
[725] Fix | Delete
* Context data.
[726] Fix | Delete
*
[727] Fix | Delete
* @type string $context Context param: content, attrs, visibility, classes.
[728] Fix | Delete
* @type string $name Module options props name.
[729] Fix | Delete
* @type string $mode Current data mode: desktop, hover, tablet, phone.
[730] Fix | Delete
* @type string $attr_key Attribute key for attrs context data. Example: src, class, etc.
[731] Fix | Delete
* @type string $attr_sub_key Attribute sub key that availabe when passing attrs value as array such as styes. Example: padding-top, margin-botton, etc.
[732] Fix | Delete
* }
[733] Fix | Delete
* @param ET_Builder_Module_Helper_MultiViewOptions $multi_view Multiview object instance.
[734] Fix | Delete
*
[735] Fix | Delete
* @return mixed
[736] Fix | Delete
*/
[737] Fix | Delete
public function multi_view_filter_value( $raw_value, $args, $multi_view ) {
[738] Fix | Delete
$name = isset( $args['name'] ) ? $args['name'] : '';
[739] Fix | Delete
$mode = isset( $args['mode'] ) ? $args['mode'] : '';
[740] Fix | Delete
[741] Fix | Delete
$fields_need_escape = array(
[742] Fix | Delete
'title',
[743] Fix | Delete
);
[744] Fix | Delete
[745] Fix | Delete
if ( $raw_value && in_array( $name, $fields_need_escape, true ) ) {
[746] Fix | Delete
return $this->_esc_attr( $multi_view->get_name_by_mode( $name, $mode ), 'none', $raw_value );
[747] Fix | Delete
} else if ( 'submit_button_text' === $name ) {
[748] Fix | Delete
if ( '' === trim( $raw_value ) ) {
[749] Fix | Delete
$raw_value = __( 'Submit', 'et_builder' );
[750] Fix | Delete
}
[751] Fix | Delete
[752] Fix | Delete
return esc_html( $raw_value );
[753] Fix | Delete
}
[754] Fix | Delete
[755] Fix | Delete
return $raw_value;
[756] Fix | Delete
}
[757] Fix | Delete
}
[758] Fix | Delete
[759] Fix | Delete
new ET_Builder_Module_Contact_Form;
[760] Fix | Delete
[761] Fix | Delete
12
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function