Edit File by line
/home/barbar84/www/wp-conte.../themes/Divi/includes/builder/module
File: ContactForm.php
<?php
[0] Fix | Delete
[1] Fix | Delete
class ET_Builder_Module_Contact_Form extends ET_Builder_Module_Type_WithSpamProtection {
[2] Fix | Delete
[3] Fix | Delete
function init() {
[4] Fix | Delete
parent::init();
[5] Fix | Delete
[6] Fix | Delete
$this->name = esc_html__( 'Contact Form', 'et_builder' );
[7] Fix | Delete
$this->plural = esc_html__( 'Contact Forms', 'et_builder' );
[8] Fix | Delete
$this->slug = 'et_pb_contact_form';
[9] Fix | Delete
$this->vb_support = 'on';
[10] Fix | Delete
$this->child_slug = 'et_pb_contact_field';
[11] Fix | Delete
$this->child_item_text = esc_html__( 'Field', 'et_builder' );
[12] Fix | Delete
[13] Fix | Delete
$this->main_css_element = '%%order_class%%.et_pb_contact_form_container';
[14] Fix | Delete
[15] Fix | Delete
$this->settings_modal_toggles = array(
[16] Fix | Delete
'general' => array(
[17] Fix | Delete
'toggles' => array(
[18] Fix | Delete
'main_content' => et_builder_i18n( 'Text' ),
[19] Fix | Delete
'email' => esc_html__( 'Email', 'et_builder' ),
[20] Fix | Delete
'elements' => et_builder_i18n( 'Elements' ),
[21] Fix | Delete
'redirect' => esc_html__( 'Redirect', 'et_builder' ),
[22] Fix | Delete
'spam' => esc_html__( 'Spam Protection', 'et_builder' ),
[23] Fix | Delete
),
[24] Fix | Delete
),
[25] Fix | Delete
);
[26] Fix | Delete
[27] Fix | Delete
$this->advanced_fields = array(
[28] Fix | Delete
'borders' => array(
[29] Fix | Delete
'default' => array(
[30] Fix | Delete
'css' => array(
[31] Fix | Delete
'main' => array(
[32] Fix | Delete
'border_radii' => sprintf( '%1$s .input, %1$s .input[type="checkbox"] + label i, %1$s .input[type="radio"] + label i', $this->main_css_element ),
[33] Fix | Delete
'border_styles' => sprintf( '%1$s .input, %1$s .input[type="checkbox"] + label i, %1$s .input[type="radio"] + label i', $this->main_css_element ),
[34] Fix | Delete
),
[35] Fix | Delete
'important' => 'plugin_only',
[36] Fix | Delete
),
[37] Fix | Delete
'label_prefix' => esc_html__( 'Inputs', 'et_builder' ),
[38] Fix | Delete
),
[39] Fix | Delete
),
[40] Fix | Delete
'fonts' => array(
[41] Fix | Delete
'title' => array(
[42] Fix | Delete
'label' => et_builder_i18n( 'Title' ),
[43] Fix | Delete
'css' => array(
[44] Fix | Delete
'main' => "{$this->main_css_element} h1, {$this->main_css_element} h2.et_pb_contact_main_title, {$this->main_css_element} h3.et_pb_contact_main_title, {$this->main_css_element} h4.et_pb_contact_main_title, {$this->main_css_element} h5.et_pb_contact_main_title, {$this->main_css_element} h6.et_pb_contact_main_title",
[45] Fix | Delete
),
[46] Fix | Delete
'header_level' => array(
[47] Fix | Delete
'default' => 'h1',
[48] Fix | Delete
),
[49] Fix | Delete
),
[50] Fix | Delete
'captcha' => array(
[51] Fix | Delete
'label' => esc_html__( 'Captcha', 'et_builder' ),
[52] Fix | Delete
'css' => array(
[53] Fix | Delete
'main' => "{$this->main_css_element} .et_pb_contact_right p",
[54] Fix | Delete
),
[55] Fix | Delete
'hide_text_align' => true,
[56] Fix | Delete
'line_height' => array(
[57] Fix | Delete
'default' => '1.7em',
[58] Fix | Delete
),
[59] Fix | Delete
),
[60] Fix | Delete
),
[61] Fix | Delete
'box_shadow' => array(
[62] Fix | Delete
'default' => array(
[63] Fix | Delete
'css' => array(
[64] Fix | Delete
'main' => implode(
[65] Fix | Delete
', ',
[66] Fix | Delete
array(
[67] Fix | Delete
'%%order_class%% .et_pb_contact_field input',
[68] Fix | Delete
'%%order_class%% .et_pb_contact_field select',
[69] Fix | Delete
'%%order_class%% .et_pb_contact_field textarea',
[70] Fix | Delete
'%%order_class%% .et_pb_contact_field .et_pb_contact_field_options_list label > i',
[71] Fix | Delete
'%%order_class%% input.et_pb_contact_captcha',
[72] Fix | Delete
)
[73] Fix | Delete
),
[74] Fix | Delete
),
[75] Fix | Delete
),
[76] Fix | Delete
),
[77] Fix | Delete
'button' => array(
[78] Fix | Delete
'button' => array(
[79] Fix | Delete
'label' => et_builder_i18n( 'Button' ),
[80] Fix | Delete
'css' => array(
[81] Fix | Delete
'main' => "{$this->main_css_element}.et_pb_module .et_pb_button",
[82] Fix | Delete
'limited_main' => "{$this->main_css_element}.et_pb_module .et_pb_button",
[83] Fix | Delete
),
[84] Fix | Delete
'no_rel_attr' => true,
[85] Fix | Delete
'box_shadow' => array(
[86] Fix | Delete
'css' => array(
[87] Fix | Delete
'main' => '%%order_class%% .et_pb_contact_submit',
[88] Fix | Delete
),
[89] Fix | Delete
),
[90] Fix | Delete
'margin_padding' => array(
[91] Fix | Delete
'css' => array(
[92] Fix | Delete
'important' => 'all',
[93] Fix | Delete
),
[94] Fix | Delete
),
[95] Fix | Delete
),
[96] Fix | Delete
),
[97] Fix | Delete
'margin_padding' => array(
[98] Fix | Delete
'css' => array(
[99] Fix | Delete
'important' => array( 'custom_margin' ), // needed to overwrite last module margin-bottom styling
[100] Fix | Delete
),
[101] Fix | Delete
),
[102] Fix | Delete
'max_width' => array(
[103] Fix | Delete
'css' => array(
[104] Fix | Delete
'module_alignment' => '%%order_class%%.et_pb_contact_form_container.et_pb_module',
[105] Fix | Delete
),
[106] Fix | Delete
),
[107] Fix | Delete
'text' => array(
[108] Fix | Delete
'css' => array(
[109] Fix | Delete
'text_orientation' => '%%order_class%% input, %%order_class%% textarea, %%order_class%% label',
[110] Fix | Delete
'text_shadow' => '%%order_class%%, %%order_class%% input, %%order_class%% textarea, %%order_class%% label, %%order_class%% select',
[111] Fix | Delete
),
[112] Fix | Delete
),
[113] Fix | Delete
'form_field' => array(
[114] Fix | Delete
'form_field' => array(
[115] Fix | Delete
'label' => esc_html__( 'Fields', 'et_builder' ),
[116] Fix | Delete
'css' => array(
[117] Fix | Delete
'main' => '%%order_class%% .input',
[118] Fix | Delete
'background_color' => '%%order_class%% .input, %%order_class%% .input[type="checkbox"] + label i, %%order_class%% .input[type="radio"] + label i',
[119] Fix | Delete
'background_color_hover' => '%%order_class%% .input:hover, %%order_class%% .input[type="checkbox"]:hover + label i, %%order_class%% .input[type="radio"]:hover + label i',
[120] Fix | Delete
'focus_background_color' => '%%order_class%% .input:focus, %%order_class%% .input[type="checkbox"]:active + label i, %%order_class%% .input[type="radio"]:active + label i',
[121] Fix | Delete
'focus_background_color_hover' => '%%order_class%% .input:focus:hover, %%order_class%% .input[type="checkbox"]:active:hover + label i, %%order_class%% .input[type="radio"]:active:hover + label i',
[122] Fix | Delete
'placeholder_focus' => '%%order_class%% p .input:focus::-webkit-input-placeholder, %%order_class%% p .input:focus::-moz-placeholder, %%order_class%% p .input:focus:-ms-input-placeholder, %%order_class%% p textarea:focus::-webkit-input-placeholder, %%order_class%% p textarea:focus::-moz-placeholder, %%order_class%% p textarea:focus:-ms-input-placeholder',
[123] Fix | Delete
'padding' => '%%order_class%% .et_pb_contact_field .input',
[124] Fix | Delete
'margin' => '%%order_class%% .et_pb_contact_field',
[125] Fix | Delete
'form_text_color' => '%%order_class%% .input, %%order_class%% .input[type="checkbox"] + label, %%order_class%% .input[type="radio"] + label, %%order_class%% .input[type="checkbox"]:checked + label i:before',
[126] Fix | Delete
'form_text_color_hover' => '%%order_class%% .input:hover, %%order_class%% .input[type="checkbox"]:hover + label, %%order_class%% .input[type="radio"]:hover + label, %%order_class%% .input[type="checkbox"]:checked:hover + label i:before',
[127] Fix | Delete
'focus_text_color' => '%%order_class%% .input:focus, %%order_class%% .input[type="checkbox"]:active + label, %%order_class%% .input[type="radio"]:active + label, %%order_class%% .input[type="checkbox"]:checked:active + label i:before',
[128] Fix | Delete
'focus_text_color_hover' => '%%order_class%% .input:focus:hover, %%order_class%% .input[type="checkbox"]:active:hover + label, %%order_class%% .input[type="radio"]:active:hover + label, %%order_class%% .input[type="checkbox"]:checked:active:hover + label i:before',
[129] Fix | Delete
),
[130] Fix | Delete
'box_shadow' => false,
[131] Fix | Delete
'border_styles' => false,
[132] Fix | Delete
'font_field' => array(
[133] Fix | Delete
'css' => array(
[134] Fix | Delete
'main' => implode(
[135] Fix | Delete
', ',
[136] Fix | Delete
array(
[137] Fix | Delete
"{$this->main_css_element} .input",
[138] Fix | Delete
"{$this->main_css_element} .input::placeholder",
[139] Fix | Delete
"{$this->main_css_element} .input::-webkit-input-placeholder",
[140] Fix | Delete
"{$this->main_css_element} .input::-moz-placeholder",
[141] Fix | Delete
"{$this->main_css_element} .input:-ms-input-placeholder",
[142] Fix | Delete
"{$this->main_css_element} .input[type=checkbox] + label",
[143] Fix | Delete
"{$this->main_css_element} .input[type=radio] + label",
[144] Fix | Delete
)
[145] Fix | Delete
),
[146] Fix | Delete
'hover' => array(
[147] Fix | Delete
"{$this->main_css_element} .input:hover",
[148] Fix | Delete
"{$this->main_css_element} .input:hover::placeholder",
[149] Fix | Delete
"{$this->main_css_element} .input:hover::-webkit-input-placeholder",
[150] Fix | Delete
"{$this->main_css_element} .input:hover::-moz-placeholder",
[151] Fix | Delete
"{$this->main_css_element} .input:hover:-ms-input-placeholder",
[152] Fix | Delete
"{$this->main_css_element} .input[type=checkbox]:hover + label",
[153] Fix | Delete
"{$this->main_css_element} .input[type=radio]:hover + label",
[154] Fix | Delete
),
[155] Fix | Delete
),
[156] Fix | Delete
),
[157] Fix | Delete
'margin_padding' => array(
[158] Fix | Delete
'css' => array(
[159] Fix | Delete
'main' => '%%order_class%% .input',
[160] Fix | Delete
'padding' => '%%order_class%% .et_pb_contact_field .input',
[161] Fix | Delete
'margin' => '%%order_class%% .et_pb_contact_field',
[162] Fix | Delete
),
[163] Fix | Delete
),
[164] Fix | Delete
),
[165] Fix | Delete
),
[166] Fix | Delete
);
[167] Fix | Delete
[168] Fix | Delete
$this->custom_css_fields = array(
[169] Fix | Delete
'contact_title' => array(
[170] Fix | Delete
'label' => esc_html__( 'Contact Title', 'et_builder' ),
[171] Fix | Delete
'selector' => '.et_pb_contact_main_title',
[172] Fix | Delete
),
[173] Fix | Delete
'contact_button' => array(
[174] Fix | Delete
'label' => esc_html__( 'Contact Button', 'et_builder' ),
[175] Fix | Delete
'selector' => '.et_pb_contact_form_container .et_contact_bottom_container .et_pb_contact_submit.et_pb_button',
[176] Fix | Delete
'no_space_before_selector' => true,
[177] Fix | Delete
),
[178] Fix | Delete
'contact_fields' => array(
[179] Fix | Delete
'label' => esc_html__( 'Form Fields', 'et_builder' ),
[180] Fix | Delete
'selector' => 'input',
[181] Fix | Delete
),
[182] Fix | Delete
'text_field' => array(
[183] Fix | Delete
'label' => esc_html__( 'Message Field', 'et_builder' ),
[184] Fix | Delete
'selector' => 'textarea.et_pb_contact_message',
[185] Fix | Delete
),
[186] Fix | Delete
'captcha_field' => array(
[187] Fix | Delete
'label' => esc_html__( 'Captcha Field', 'et_builder' ),
[188] Fix | Delete
'selector' => 'input.et_pb_contact_captcha',
[189] Fix | Delete
),
[190] Fix | Delete
'captcha_label' => array(
[191] Fix | Delete
'label' => esc_html__( 'Captcha Text', 'et_builder' ),
[192] Fix | Delete
'selector' => '.et_pb_contact_right p',
[193] Fix | Delete
),
[194] Fix | Delete
);
[195] Fix | Delete
[196] Fix | Delete
$this->help_videos = array(
[197] Fix | Delete
array(
[198] Fix | Delete
'id' => 'y3NSTE6BSfo',
[199] Fix | Delete
'name' => esc_html__( 'An introduction to the Contact Form module', 'et_builder' ),
[200] Fix | Delete
),
[201] Fix | Delete
);
[202] Fix | Delete
}
[203] Fix | Delete
[204] Fix | Delete
/**
[205] Fix | Delete
* Get form map containing essential info (form number, field id/type/required) based on
[206] Fix | Delete
* et_pb_contact_field's shortcode layout
[207] Fix | Delete
*
[208] Fix | Delete
* @since 3.26.5
[209] Fix | Delete
*
[210] Fix | Delete
* @param string $content_shortcode
[211] Fix | Delete
* @param int $contact_form_number
[212] Fix | Delete
* @param array $hidden_form_fields
[213] Fix | Delete
*
[214] Fix | Delete
* @return mixed[] {
[215] Fix | Delete
* Form Map
[216] Fix | Delete
*
[217] Fix | Delete
* @type int $form_number Contact form number.
[218] Fix | Delete
* @type string[] $fields {
[219] Fix | Delete
* Form Field
[220] Fix | Delete
*
[221] Fix | Delete
* @type string $field_type Field type
[222] Fix | Delete
* @type string $field_id Field id
[223] Fix | Delete
* @type string $required_mark Required field status. Accepts 'on', 'off'.
[224] Fix | Delete
* }
[225] Fix | Delete
* }
[226] Fix | Delete
*/
[227] Fix | Delete
function get_form_map( $content_shortcode = '', $contact_form_number = 0, $hidden_form_fields = array() ) {
[228] Fix | Delete
$pattern = get_shortcode_regex( array( 'et_pb_contact_field' ) );
[229] Fix | Delete
$map = array(
[230] Fix | Delete
'form_number' => (int) $contact_form_number,
[231] Fix | Delete
'fields' => array(),
[232] Fix | Delete
);
[233] Fix | Delete
[234] Fix | Delete
preg_match_all( "/$pattern/", $content_shortcode, $contact_fields, PREG_SET_ORDER );
[235] Fix | Delete
[236] Fix | Delete
foreach ( $contact_fields as $contact_field ) {
[237] Fix | Delete
$contact_field_attrs = shortcode_parse_atts( $contact_field[3] );
[238] Fix | Delete
$field_id = strtolower( self::$_->array_get( $contact_field_attrs, 'field_id' ) );
[239] Fix | Delete
$conditional_logic = self::$_->array_get( $contact_field_attrs, 'conditional_logic', 'off' );
[240] Fix | Delete
[241] Fix | Delete
// Only allow to disable fields for which conditional logic has been enabled
[242] Fix | Delete
if ( 'on' === $conditional_logic && in_array( $field_id, $hidden_form_fields ) ) {
[243] Fix | Delete
continue;
[244] Fix | Delete
}
[245] Fix | Delete
[246] Fix | Delete
$map['fields'][] = array(
[247] Fix | Delete
'field_type' => self::$_->array_get( $contact_field_attrs, 'field_type', 'input' ),
[248] Fix | Delete
'field_id' => $field_id,
[249] Fix | Delete
'required_mark' => self::$_->array_get( $contact_field_attrs, 'required_mark', 'on' ),
[250] Fix | Delete
);
[251] Fix | Delete
}
[252] Fix | Delete
[253] Fix | Delete
return $map;
[254] Fix | Delete
}
[255] Fix | Delete
[256] Fix | Delete
function get_fields() {
[257] Fix | Delete
return array_merge(
[258] Fix | Delete
self::_get_spam_provider_fields(),
[259] Fix | Delete
array(
[260] Fix | Delete
'captcha' => array(
[261] Fix | Delete
'label' => esc_html__( 'Use Basic Captcha', 'et_builder' ),
[262] Fix | Delete
'type' => 'yes_no_button',
[263] Fix | Delete
'option_category' => 'configuration',
[264] Fix | Delete
'options' => array(
[265] Fix | Delete
'on' => et_builder_i18n( 'Yes' ),
[266] Fix | Delete
'off' => et_builder_i18n( 'No' ),
[267] Fix | Delete
),
[268] Fix | Delete
'toggle_slug' => 'spam',
[269] Fix | Delete
'description' => esc_html__( 'Turn the captcha on or off using this option.', 'et_builder' ),
[270] Fix | Delete
'default_on_front' => 'on',
[271] Fix | Delete
'show_if' => array(
[272] Fix | Delete
'use_spam_service' => 'off',
[273] Fix | Delete
),
[274] Fix | Delete
),
[275] Fix | Delete
'email' => array(
[276] Fix | Delete
'label' => esc_html__( 'Email Address', 'et_builder' ),
[277] Fix | Delete
'type' => 'text',
[278] Fix | Delete
'option_category' => 'basic_option',
[279] Fix | Delete
'description' => et_get_safe_localization(
[280] Fix | Delete
sprintf(
[281] Fix | Delete
__( 'Input the email address where messages should be sent.<br /><br /> Note: email delivery and spam prevention are complex processes. We recommend using a delivery service such as <a href="%1$s">Mandrill</a>, <a href="%2$s">SendGrid</a>, or other similar service to ensure the deliverability of messages that are submitted through this form', 'et_builder' ),
[282] Fix | Delete
'http://mandrill.com/',
[283] Fix | Delete
'https://sendgrid.com/'
[284] Fix | Delete
)
[285] Fix | Delete
),
[286] Fix | Delete
'toggle_slug' => 'email',
[287] Fix | Delete
),
[288] Fix | Delete
'title' => array(
[289] Fix | Delete
'label' => et_builder_i18n( 'Title' ),
[290] Fix | Delete
'type' => 'text',
[291] Fix | Delete
'option_category' => 'basic_option',
[292] Fix | Delete
'description' => esc_html__( 'Define a title for your contact form.', 'et_builder' ),
[293] Fix | Delete
'toggle_slug' => 'main_content',
[294] Fix | Delete
'dynamic_content' => 'text',
[295] Fix | Delete
'mobile_options' => true,
[296] Fix | Delete
'hover' => 'tabs',
[297] Fix | Delete
),
[298] Fix | Delete
'custom_message' => array(
[299] Fix | Delete
'label' => esc_html__( 'Message Pattern', 'et_builder' ),
[300] Fix | Delete
'type' => 'textarea',
[301] Fix | Delete
'option_category' => 'configuration',
[302] Fix | Delete
'description' => et_get_safe_localization( __( 'Here you can define the custom pattern for the email Message. Fields should be included in following format - <strong>%%field_id%%</strong>. For example if you want to include the field with id = <strong>phone</strong> and field with id = <strong>message</strong>, then you can use the following pattern: <strong>My message is %%message%% and phone number is %%phone%%</strong>. Leave blank for default.', 'et_builder' ) ),
[303] Fix | Delete
'toggle_slug' => 'email',
[304] Fix | Delete
),
[305] Fix | Delete
'use_redirect' => array(
[306] Fix | Delete
'label' => esc_html__( 'Enable Redirect URL', 'et_builder' ),
[307] Fix | Delete
'type' => 'yes_no_button',
[308] Fix | Delete
'option_category' => 'configuration',
[309] Fix | Delete
'options' => array(
[310] Fix | Delete
'off' => et_builder_i18n( 'No' ),
[311] Fix | Delete
'on' => et_builder_i18n( 'Yes' ),
[312] Fix | Delete
),
[313] Fix | Delete
'affects' => array(
[314] Fix | Delete
'redirect_url',
[315] Fix | Delete
),
[316] Fix | Delete
'toggle_slug' => 'redirect',
[317] Fix | Delete
'description' => esc_html__( 'Redirect users after successful form submission.', 'et_builder' ),
[318] Fix | Delete
'default_on_front' => 'off',
[319] Fix | Delete
),
[320] Fix | Delete
'redirect_url' => array(
[321] Fix | Delete
'label' => esc_html__( 'Redirect URL', 'et_builder' ),
[322] Fix | Delete
'type' => 'text',
[323] Fix | Delete
'option_category' => 'configuration',
[324] Fix | Delete
'depends_show_if' => 'on',
[325] Fix | Delete
'toggle_slug' => 'redirect',
[326] Fix | Delete
'description' => esc_html__( 'Type the Redirect URL', 'et_builder' ),
[327] Fix | Delete
),
[328] Fix | Delete
'success_message' => array(
[329] Fix | Delete
'label' => esc_html__( 'Success Message', 'et_builder' ),
[330] Fix | Delete
'type' => 'text',
[331] Fix | Delete
'option_category' => 'configuration',
[332] Fix | Delete
'description' => esc_html__( 'Type the message you want to display after successful form submission. Leave blank for default', 'et_builder' ),
[333] Fix | Delete
'toggle_slug' => 'main_content',
[334] Fix | Delete
'dynamic_content' => 'text',
[335] Fix | Delete
),
[336] Fix | Delete
'submit_button_text' => array(
[337] Fix | Delete
'label' => esc_html__( 'Submit Button', 'et_builder' ),
[338] Fix | Delete
'type' => 'text',
[339] Fix | Delete
'option_category' => 'basic_option',
[340] Fix | Delete
'description' => esc_html__( 'Define the text of the form submit button.', 'et_builder' ),
[341] Fix | Delete
'toggle_slug' => 'main_content',
[342] Fix | Delete
'dynamic_content' => 'text',
[343] Fix | Delete
'mobile_options' => true,
[344] Fix | Delete
'hover' => 'tabs',
[345] Fix | Delete
),
[346] Fix | Delete
)
[347] Fix | Delete
);
[348] Fix | Delete
}
[349] Fix | Delete
[350] Fix | Delete
public function get_transition_fields_css_props() {
[351] Fix | Delete
$fields = parent::get_transition_fields_css_props();
[352] Fix | Delete
[353] Fix | Delete
$fields['form_field_background_color'] = array(
[354] Fix | Delete
'background-color' => implode(
[355] Fix | Delete
', ',
[356] Fix | Delete
array(
[357] Fix | Delete
'%%order_class%% .input',
[358] Fix | Delete
'%%order_class%% .input[type="checkbox"]+label i',
[359] Fix | Delete
'%%order_class%% .input[type="radio"]+label i',
[360] Fix | Delete
)
[361] Fix | Delete
),
[362] Fix | Delete
);
[363] Fix | Delete
[364] Fix | Delete
return $fields;
[365] Fix | Delete
}
[366] Fix | Delete
[367] Fix | Delete
function predefined_child_modules() {
[368] Fix | Delete
$output = sprintf(
[369] Fix | Delete
'[et_pb_contact_field field_title="%1$s" field_type="input" field_id="Name" required_mark="on" fullwidth_field="off" /][et_pb_contact_field field_title="%2$s" field_type="email" field_id="Email" required_mark="on" fullwidth_field="off" /][et_pb_contact_field field_title="%3$s" field_type="text" field_id="Message" required_mark="on" fullwidth_field="on" /]',
[370] Fix | Delete
esc_attr__( 'Name', 'et_builder' ),
[371] Fix | Delete
esc_attr__( 'Email Address', 'et_builder' ),
[372] Fix | Delete
esc_attr__( 'Message', 'et_builder' )
[373] Fix | Delete
);
[374] Fix | Delete
[375] Fix | Delete
return $output;
[376] Fix | Delete
}
[377] Fix | Delete
[378] Fix | Delete
/**
[379] Fix | Delete
* Renders the module output.
[380] Fix | Delete
*
[381] Fix | Delete
* @param array $attrs List of attributes.
[382] Fix | Delete
* @param string $content Content being processed.
[383] Fix | Delete
* @param string $render_slug Slug of module that is used for rendering output.
[384] Fix | Delete
*
[385] Fix | Delete
* @return string
[386] Fix | Delete
*/
[387] Fix | Delete
public function render( $attrs, $content, $render_slug ) {
[388] Fix | Delete
parent::render( $attrs, $content, $render_slug );
[389] Fix | Delete
[390] Fix | Delete
global $et_pb_half_width_counter, $et_pb_contact_form_num;
[391] Fix | Delete
[392] Fix | Delete
$et_pb_half_width_counter = 0;
[393] Fix | Delete
[394] Fix | Delete
$multi_view = et_pb_multi_view_options( $this );
[395] Fix | Delete
$multi_view->set_default_value( 'submit_button_text', __( 'Submit', 'et_builder' ) );
[396] Fix | Delete
[397] Fix | Delete
$captcha = $this->props['captcha'];
[398] Fix | Delete
$email = $this->props['email'];
[399] Fix | Delete
$title = $multi_view->render_element(
[400] Fix | Delete
array(
[401] Fix | Delete
'tag' => et_pb_process_header_level( $this->props['title_level'], 'h1' ),
[402] Fix | Delete
'content' => '{{title}}',
[403] Fix | Delete
'attrs' => array(
[404] Fix | Delete
'class' => 'et_pb_contact_main_title',
[405] Fix | Delete
),
[406] Fix | Delete
)
[407] Fix | Delete
);
[408] Fix | Delete
$form_field_text_color = $this->props['form_field_text_color'];
[409] Fix | Delete
$button_custom = $this->props['custom_button'];
[410] Fix | Delete
$custom_message = $this->props['custom_message'];
[411] Fix | Delete
$use_redirect = $this->props['use_redirect'];
[412] Fix | Delete
$redirect_url = $this->props['redirect_url'];
[413] Fix | Delete
$success_message = $this->_esc_attr( 'success_message' );
[414] Fix | Delete
$header_level = $this->props['title_level'];
[415] Fix | Delete
$use_spam_service = $this->prop( 'use_spam_service', 'off' );
[416] Fix | Delete
[417] Fix | Delete
$field_text_color_hover = $this->get_hover_value( 'form_field_text_color' );
[418] Fix | Delete
$field_text_color_values = et_pb_responsive_options()->get_property_values( $this->props, 'form_field_text_color' );
[419] Fix | Delete
$field_focus_text_color_hover = $this->get_hover_value( 'form_field_focus_text_color' );
[420] Fix | Delete
$field_focus_text_color_values = et_pb_responsive_options()->get_property_values( $this->props, 'form_field_focus_text_color' );
[421] Fix | Delete
[422] Fix | Delete
$custom_icon_values = et_pb_responsive_options()->get_property_values( $this->props, 'button_icon' );
[423] Fix | Delete
$custom_icon = isset( $custom_icon_values['desktop'] ) ? $custom_icon_values['desktop'] : '';
[424] Fix | Delete
$custom_icon_tablet = isset( $custom_icon_values['tablet'] ) ? $custom_icon_values['tablet'] : '';
[425] Fix | Delete
$custom_icon_phone = isset( $custom_icon_values['phone'] ) ? $custom_icon_values['phone'] : '';
[426] Fix | Delete
[427] Fix | Delete
$video_background = $this->video_background();
[428] Fix | Delete
$parallax_image_background = $this->get_parallax_image_background();
[429] Fix | Delete
[430] Fix | Delete
// Form Field Text Color - Radio Checked.
[431] Fix | Delete
$field_text_color_important = et_builder_has_limitation( 'force_use_global_important' ) ? ' !important' : '';
[432] Fix | Delete
et_pb_responsive_options()->generate_responsive_css( $field_text_color_values, '%%order_class%% .input[type="radio"]:checked + label i:before', 'background-color', $render_slug, $field_text_color_important, 'color' );
[433] Fix | Delete
[434] Fix | Delete
if ( et_builder_is_hover_enabled( 'form_field_text_color', $this->props ) ) {
[435] Fix | Delete
ET_Builder_Element::set_style(
[436] Fix | Delete
$render_slug,
[437] Fix | Delete
array(
[438] Fix | Delete
'selector' => '%%order_class%% .input[type="radio"]:checked:hover + label i:before',
[439] Fix | Delete
'declaration' => sprintf(
[440] Fix | Delete
'background-color: %1$s%2$s;',
[441] Fix | Delete
esc_html( $field_text_color_hover ),
[442] Fix | Delete
$field_text_color_important
[443] Fix | Delete
),
[444] Fix | Delete
)
[445] Fix | Delete
);
[446] Fix | Delete
}
[447] Fix | Delete
[448] Fix | Delete
// Form Field Text Color on Focus - Radio Checked.
[449] Fix | Delete
et_pb_responsive_options()->generate_responsive_css( $field_focus_text_color_values, '%%order_class%% .input[type="radio"]:checked:active + label i:before', 'background-color', $render_slug, $field_text_color_important, 'color' );
[450] Fix | Delete
[451] Fix | Delete
if ( et_builder_is_hover_enabled( 'form_field_focus_text_color', $this->props ) ) {
[452] Fix | Delete
ET_Builder_Element::set_style(
[453] Fix | Delete
$render_slug,
[454] Fix | Delete
array(
[455] Fix | Delete
'selector' => '%%order_class%% .input[type="radio"]:checked:active:hover + label i:before',
[456] Fix | Delete
'declaration' => sprintf(
[457] Fix | Delete
'background-color: %1$s%2$s;',
[458] Fix | Delete
esc_html( $field_focus_text_color_hover ),
[459] Fix | Delete
$field_text_color_important
[460] Fix | Delete
),
[461] Fix | Delete
)
[462] Fix | Delete
);
[463] Fix | Delete
}
[464] Fix | Delete
[465] Fix | Delete
$success_message = '' !== $success_message ? $success_message : esc_html__( 'Thanks for contacting us', 'et_builder' );
[466] Fix | Delete
[467] Fix | Delete
$et_pb_contact_form_num = $this->render_count();
[468] Fix | Delete
$hidden_form_fields_key = "et_pb_contact_email_hidden_fields_{$et_pb_contact_form_num}";
[469] Fix | Delete
$hidden_form_fields = self::$_->array_get( $_POST, $hidden_form_fields_key, array() );
[470] Fix | Delete
$shortcode_content = $content;
[471] Fix | Delete
[472] Fix | Delete
if ( ! empty( $hidden_form_fields ) ) {
[473] Fix | Delete
$hidden_form_fields = str_replace( '\\', '', $hidden_form_fields );
[474] Fix | Delete
$hidden_form_fields = json_decode( $hidden_form_fields );
[475] Fix | Delete
}
[476] Fix | Delete
[477] Fix | Delete
$content = $this->content;
[478] Fix | Delete
[479] Fix | Delete
$et_error_message = '';
[480] Fix | Delete
$et_contact_error = false;
[481] Fix | Delete
$current_form_fields = isset( $_POST[ 'et_pb_contact_email_fields_' . $et_pb_contact_form_num ] ) ? $_POST[ 'et_pb_contact_email_fields_' . $et_pb_contact_form_num ] : '';
[482] Fix | Delete
$contact_email = '';
[483] Fix | Delete
$processed_fields_values = array();
[484] Fix | Delete
[485] Fix | Delete
$nonce_result = isset( $_POST[ '_wpnonce-et-pb-contact-form-submitted-' . $et_pb_contact_form_num ] ) && wp_verify_nonce( $_POST[ '_wpnonce-et-pb-contact-form-submitted-' . $et_pb_contact_form_num ], 'et-pb-contact-form-submit' ) ? true : false;
[486] Fix | Delete
[487] Fix | Delete
// check that the form was submitted and et_pb_contact_et_number field is empty to protect from spam
[488] Fix | Delete
if ( $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 ] ) ) {
[489] Fix | Delete
if ( '' !== $current_form_fields ) {
[490] Fix | Delete
$fields_data_json = str_replace( '\\', '', $current_form_fields );
[491] Fix | Delete
$fields_data_array = json_decode( $fields_data_json, true );
[492] Fix | Delete
[493] Fix | Delete
// check whether captcha field is not empty
[494] Fix | Delete
if ( 'on' === $captcha && 'off' === $use_spam_service && ( ! isset( $_POST[ 'et_pb_contact_captcha_' . $et_pb_contact_form_num ] ) || empty( $_POST[ 'et_pb_contact_captcha_' . $et_pb_contact_form_num ] ) ) ) {
[495] Fix | Delete
$et_error_message .= sprintf( '<p class="et_pb_contact_error_text">%1$s</p>', esc_html__( 'Make sure you entered the captcha.', 'et_builder' ) );
[496] Fix | Delete
$et_contact_error = true;
[497] Fix | Delete
[498] Fix | Delete
} elseif ( 'on' === $use_spam_service && $this->is_spam_submission() ) {
[499] Fix | Delete
12
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function