Upgarded to 4.17.4

This commit is contained in:
2022-06-23 13:17:18 +01:00
parent 80f1e87db9
commit a04fb0c7af
404 changed files with 54683 additions and 4417 deletions
+5 -1
View File
@@ -411,13 +411,17 @@ class ET_Builder_Module_Accordion extends ET_Builder_Module {
'<div%3$s class="%2$s">
%5$s
%4$s
%6$s
%7$s
%1$s
</div>',
$this->content,
$this->module_classname( $render_slug ),
$this->module_id(),
$video_background,
$parallax_image_background
$parallax_image_background,
et_core_esc_previously( $this->background_pattern() ), // #6
et_core_esc_previously( $this->background_mask() ) // #7
);
return $output;
+5 -1
View File
@@ -460,6 +460,8 @@ class ET_Builder_Module_Audio extends ET_Builder_Module {
'<div%6$s class="%4$s"%9$s%10$s>
%8$s
%7$s
%11$s
%12$s
%5$s
<div class="et_pb_audio_module_content et_audio_container">
%1$s
@@ -480,7 +482,9 @@ class ET_Builder_Module_Audio extends ET_Builder_Module {
$video_background, // #7
$parallax_image_background, // #8
et_core_esc_previously( $data_background_layout ), // #9
et_core_esc_previously( $muti_view_data_attr ) // #10
et_core_esc_previously( $muti_view_data_attr ), // #10
et_core_esc_previously( $this->background_pattern() ), // #11
et_core_esc_previously( $this->background_mask() ) // #12
);
return $output;
+225 -55
View File
@@ -169,58 +169,223 @@ class ET_Builder_Module_Bar_Counters extends ET_Builder_Module {
function before_render() {
global $et_pb_counters_settings;
$multi_view = et_pb_multi_view_options( $this );
$background_image = $this->props['background_image'];
$parallax = $this->props['parallax'];
$parallax_method = $this->props['parallax_method'];
$background_video_mp4 = $this->props['background_video_mp4'];
$background_video_webm = $this->props['background_video_webm'];
$background_video_width = $this->props['background_video_width'];
$background_video_height = $this->props['background_video_height'];
$allow_player_pause = $this->props['allow_player_pause'];
$bar_bg_color_values = et_pb_responsive_options()->get_property_values( $this->props, 'bar_bg_color' );
$background_video_pause_outside_viewport = $this->props['background_video_pause_outside_viewport'];
$use_background_color_gradient = $this->props['use_background_color_gradient'];
// Background Color.
$background_last_edited = self::$_->array_get( $this->props, 'background_last_edited', '' );
$background_hover_enabled = self::$_->array_get( $this->props, 'background__hover_enabled', '' );
$background_colors = et_pb_responsive_options()->get_composite_property_values( $this->props, 'background', 'background_color' );
$background_enable_colors = et_pb_responsive_options()->get_composite_property_values( $this->props, 'background', 'background_enable_color' );
$background_color_hover = et_pb_hover_options()->get_compose_value( 'background_color', 'background', $this->props, '' );
$background_enable_color_hover = et_pb_hover_options()->get_compose_value( 'background_enable_color', 'background', $this->props, '' );
// Sticky Element.
$is_sticky_module = et_pb_sticky_options()->is_sticky_module( $this->props );
$multi_view = et_pb_multi_view_options( $this );
$bar_bg_color_values = et_pb_responsive_options()->get_property_values( $this->props, 'bar_bg_color' );
$et_pb_counters_settings = array(
'background_last_edited' => $this->props['background_last_edited'],
'background__hover_enabled' => isset( $this->props['background__hover_enabled'] ) ? $this->props['background__hover_enabled'] : '',
// Background Color.
'background_last_edited' => $background_last_edited,
'background__hover_enabled' => $background_hover_enabled,
'background_color' => $background_colors['desktop'],
'background_color_tablet' => $background_colors['tablet'],
'background_color_phone' => $background_colors['phone'],
'background_enable_color' => $background_enable_colors['desktop'],
'background_enable_color_tablet' => $background_enable_colors['tablet'],
'background_enable_color_phone' => $background_enable_colors['phone'],
'background_color_hover' => $background_color_hover,
'background_color__hover' => $background_color_hover,
'background_enable_color__hover' => $background_enable_color_hover,
'background_image' => $background_image,
'parallax' => $parallax,
'parallax_method' => $parallax_method,
'background_video_mp4' => $background_video_mp4,
'background_video_webm' => $background_video_webm,
'background_video_width' => $background_video_width,
'background_video_height' => $background_video_height,
'allow_player_pause' => $allow_player_pause,
'bar_bg_color' => isset( $bar_bg_color_values['desktop'] ) ? $bar_bg_color_values['desktop'] : '',
'bar_bg_color_tablet' => isset( $bar_bg_color_values['tablet'] ) ? $bar_bg_color_values['tablet'] : '',
'bar_bg_color_phone' => isset( $bar_bg_color_values['phone'] ) ? $bar_bg_color_values['phone'] : '',
'use_percentages' => $multi_view->get_values( 'use_percentages' ),
'background_video_pause_outside_viewport' => $background_video_pause_outside_viewport,
'use_background_color_gradient' => $use_background_color_gradient,
'is_sticky_module' => $is_sticky_module,
'background_color' => $this->props['background_color'],
'background_color_tablet' => $this->props['background_color_tablet'],
'background_color_phone' => $this->props['background_color_phone'],
'background_color__hover' => isset( $this->props['background_color__hover'] ) ? $this->props['background_color__hover'] : '',
'background_enable_color' => $this->props['background_enable_color'],
'background_enable_color_tablet' => $this->props['background_enable_color_tablet'],
'background_enable_color_phone' => $this->props['background_enable_color_phone'],
'background_enable_color__hover' => isset( $this->props['background_enable_color__hover'] ) ? $this->props['background_enable_color__hover'] : '',
// Background Gradient.
'use_background_color_gradient' => $this->props['use_background_color_gradient'],
'use_background_color_gradient_tablet' => $this->props['use_background_color_gradient_tablet'],
'use_background_color_gradient_phone' => $this->props['use_background_color_gradient_phone'],
'use_background_color_gradient__hover' => isset( $this->props['use_background_color_gradient__hover'] ) ? $this->props['use_background_color_gradient__hover'] : '',
'background_color_gradient_type' => $this->props['background_color_gradient_type'],
'background_color_gradient_type_tablet' => $this->props['background_color_gradient_type_tablet'],
'background_color_gradient_type_phone' => $this->props['background_color_gradient_type_phone'],
'background_color_gradient_type__hover' => isset( $this->props['background_color_gradient_type__hover'] ) ? $this->props['background_color_gradient_type__hover'] : '',
'background_color_gradient_direction' => $this->props['background_color_gradient_direction'],
'background_color_gradient_direction_tablet' => $this->props['background_color_gradient_direction_tablet'],
'background_color_gradient_direction_phone' => $this->props['background_color_gradient_direction_phone'],
'background_color_gradient_direction__hover' => isset( $this->props['background_color_gradient_direction__hover'] ) ? $this->props['background_color_gradient_direction__hover'] : '',
'background_color_gradient_direction_radial' => $this->props['background_color_gradient_direction_radial'],
'background_color_gradient_direction_radial_tablet' => $this->props['background_color_gradient_direction_radial_tablet'],
'background_color_gradient_direction_radial_phone' => $this->props['background_color_gradient_direction_radial_phone'],
'background_color_gradient_direction_radial__hover' => isset( $this->props['background_color_gradient_direction_radial__hover'] ) ? $this->props['background_color_gradient_direction_radial__hover'] : '',
'background_color_gradient_start' => $this->props['background_color_gradient_start'],
'background_color_gradient_start_tablet' => $this->props['background_color_gradient_start_tablet'],
'background_color_gradient_start_phone' => $this->props['background_color_gradient_start_phone'],
'background_color_gradient_start__hover' => isset( $this->props['background_color_gradient_start__hover'] ) ? $this->props['background_color_gradient_start__hover'] : '',
'background_color_gradient_end' => $this->props['background_color_gradient_end'],
'background_color_gradient_end_tablet' => $this->props['background_color_gradient_end_tablet'],
'background_color_gradient_end_phone' => $this->props['background_color_gradient_end_phone'],
'background_color_gradient_end__hover' => isset( $this->props['background_color_gradient_end__hover'] ) ? $this->props['background_color_gradient_end__hover'] : '',
'background_color_gradient_start_position' => $this->props['background_color_gradient_start_position'],
'background_color_gradient_start_position_tablet' => $this->props['background_color_gradient_start_position_tablet'],
'background_color_gradient_start_position_phone' => $this->props['background_color_gradient_start_position_phone'],
'background_color_gradient_start_position__hover' => isset( $this->props['background_color_gradient_start_position__hover'] ) ? $this->props['background_color_gradient_start_position__hover'] : '',
'background_color_gradient_end_position' => $this->props['background_color_gradient_end_position'],
'background_color_gradient_end_position_tablet' => $this->props['background_color_gradient_end_position_tablet'],
'background_color_gradient_end_position_phone' => $this->props['background_color_gradient_end_position_phone'],
'background_color_gradient_end_position__hover' => isset( $this->props['background_color_gradient_end_position__hover'] ) ? $this->props['background_color_gradient_end_position__hover'] : '',
'background_color_gradient_overlays_image' => $this->props['background_color_gradient_overlays_image'],
'background_color_gradient_overlays_image_tablet' => $this->props['background_color_gradient_overlays_image_tablet'],
'background_color_gradient_overlays_image_phone' => $this->props['background_color_gradient_overlays_image_phone'],
'background_color_gradient_overlays_image__hover' => isset( $this->props['background_color_gradient_overlays_image__hover'] ) ? $this->props['background_color_gradient_overlays_image__hover'] : '',
// Background Image.
'background_enable_image' => $this->props['background_enable_image'],
'background_enable_image_tablet' => $this->props['background_enable_image_tablet'],
'background_enable_image_phone' => $this->props['background_enable_image_phone'],
'background_enable_image__hover' => isset( $this->props['background_enable_image__hover'] ) ? $this->props['background_enable_image__hover'] : '',
'background_image' => $this->props['background_image'],
'background_image_tablet' => $this->props['background_image_tablet'],
'background_image_phone' => $this->props['background_image_phone'],
'background_image__hover' => isset( $this->props['background_image__hover'] ) ? $this->props['background_image__hover'] : '',
'background_size' => $this->props['background_size'],
'background_size_tablet' => $this->props['background_size_tablet'],
'background_size_phone' => $this->props['background_size_phone'],
'background_size__hover' => isset( $this->props['background_size__hover'] ) ? $this->props['background_size__hover'] : '',
'background_position' => $this->props['background_position'],
'background_position_tablet' => $this->props['background_position_tablet'],
'background_position_phone' => $this->props['background_position_phone'],
'background_position__hover' => isset( $this->props['background_position__hover'] ) ? $this->props['background_position__hover'] : '',
'background_repeat' => $this->props['background_repeat'],
'background_repeat_tablet' => $this->props['background_repeat_tablet'],
'background_repeat_phone' => $this->props['background_repeat_phone'],
'background_repeat__hover' => isset( $this->props['background_repeat__hover'] ) ? $this->props['background_repeat__hover'] : '',
'background_blend' => $this->props['background_blend'],
'background_blend_tablet' => $this->props['background_blend_tablet'],
'background_blend_phone' => $this->props['background_blend_phone'],
'background_blend__hover' => isset( $this->props['background_blend__hover'] ) ? $this->props['background_blend__hover'] : '',
// Background Parallax Gradient.
'parallax' => $this->props['parallax'],
'parallax_tablet' => $this->props['parallax_tablet'],
'parallax_phone' => $this->props['parallax_phone'],
'parallax__hover' => isset( $this->props['parallax__hover'] ) ? $this->props['parallax__hover'] : '',
'parallax_method' => $this->props['parallax_method'],
'parallax_method_tablet' => $this->props['parallax_method_tablet'],
'parallax_method_phone' => $this->props['parallax_method_phone'],
'parallax_method__hover' => isset( $this->props['parallax_method__hover'] ) ? $this->props['parallax_method__hover'] : '',
// Background Video.
'background_enable_video_mp4' => $this->props['background_enable_video_mp4'],
'background_enable_video_mp4_tablet' => $this->props['background_enable_video_mp4_tablet'],
'background_enable_video_mp4_phone' => $this->props['background_enable_video_mp4_phone'],
'background_enable_video_mp4__hover' => isset( $this->props['background_enable_video_mp4__hover'] ) ? $this->props['background_enable_video_mp4__hover'] : '',
'background_enable_video_webm' => $this->props['background_enable_video_webm'],
'background_enable_video_webm_tablet' => $this->props['background_enable_video_webm_tablet'],
'background_enable_video_webm_phone' => $this->props['background_enable_video_webm_phone'],
'background_enable_video_webm__hover' => isset( $this->props['background_enable_video_webm__hover'] ) ? $this->props['background_enable_video_webm__hover'] : '',
'background_video_mp4' => $this->props['background_video_mp4'],
'background_video_mp4_tablet' => $this->props['background_video_mp4_tablet'],
'background_video_mp4_phone' => $this->props['background_video_mp4_phone'],
'background_video_mp4__hover' => isset( $this->props['background_video_mp4__hover'] ) ? $this->props['background_video_mp4__hover'] : '',
'background_video_webm' => $this->props['background_video_webm'],
'background_video_webm_tablet' => $this->props['background_video_webm_tablet'],
'background_video_webm_phone' => $this->props['background_video_webm_phone'],
'background_video_webm__hover' => isset( $this->props['background_video_webm__hover'] ) ? $this->props['background_video_webm__hover'] : '',
'background_video_width' => $this->props['background_video_width'],
'background_video_width_tablet' => $this->props['background_video_width_tablet'],
'background_video_width_phone' => $this->props['background_video_width_phone'],
'background_video_width__hover' => isset( $this->props['background_video_width__hover'] ) ? $this->props['background_video_width__hover'] : '',
'background_video_height' => $this->props['background_video_height'],
'background_video_height_tablet' => $this->props['background_video_height_tablet'],
'background_video_height_phone' => $this->props['background_video_height_phone'],
'background_video_height__hover' => isset( $this->props['background_video_height__hover'] ) ? $this->props['background_video_height__hover'] : '',
'background_video_pause_outside_viewport' => $this->props['background_video_pause_outside_viewport'],
'allow_player_pause' => $this->props['allow_player_pause'],
// Background Pattern.
'background_pattern_style' => $this->props['background_pattern_style'],
'background_pattern_style_tablet' => $this->props['background_pattern_style_tablet'],
'background_pattern_style_phone' => $this->props['background_pattern_style_phone'],
'background_pattern_style__hover' => isset( $this->props['background_pattern_style__hover'] ) ? $this->props['background_pattern_style__hover'] : '',
'background_pattern_color' => $this->props['background_pattern_color'],
'background_pattern_color_tablet' => $this->props['background_pattern_color_tablet'],
'background_pattern_color_phone' => $this->props['background_pattern_color_phone'],
'background_pattern_color__hover' => isset( $this->props['background_pattern_color__hover'] ) ? $this->props['background_pattern_color__hover'] : '',
'background_pattern_transform' => $this->props['background_pattern_transform'],
'background_pattern_transform_tablet' => $this->props['background_pattern_transform_tablet'],
'background_pattern_transform_phone' => $this->props['background_pattern_transform_phone'],
'background_pattern_transform__hover' => isset( $this->props['background_pattern_transform__hover'] ) ? $this->props['background_pattern_transform__hover'] : '',
'background_pattern_size' => $this->props['background_pattern_size'],
'background_pattern_size_tablet' => $this->props['background_pattern_size_tablet'],
'background_pattern_size_phone' => $this->props['background_pattern_size_phone'],
'background_pattern_size__hover' => isset( $this->props['background_pattern_size__hover'] ) ? $this->props['background_pattern_size__hover'] : '',
'background_pattern_width' => $this->props['background_pattern_width'],
'background_pattern_width_tablet' => $this->props['background_pattern_width_tablet'],
'background_pattern_width_phone' => $this->props['background_pattern_width_phone'],
'background_pattern_width__hover' => isset( $this->props['background_pattern_width__hover'] ) ? $this->props['background_pattern_width__hover'] : '',
'background_pattern_height' => $this->props['background_pattern_height'],
'background_pattern_height_tablet' => $this->props['background_pattern_height_tablet'],
'background_pattern_height_phone' => $this->props['background_pattern_height_phone'],
'background_pattern_height__hover' => isset( $this->props['background_pattern_height__hover'] ) ? $this->props['background_pattern_height__hover'] : '',
'background_pattern_repeat_origin' => $this->props['background_pattern_repeat_origin'],
'background_pattern_repeat_origin_tablet' => $this->props['background_pattern_repeat_origin_tablet'],
'background_pattern_repeat_origin_phone' => $this->props['background_pattern_repeat_origin_phone'],
'background_pattern_repeat_origin__hover' => isset( $this->props['background_pattern_repeat_origin__hover'] ) ? $this->props['background_pattern_repeat_origin__hover'] : '',
'background_pattern_horizontal_offset' => $this->props['background_pattern_horizontal_offset'],
'background_pattern_horizontal_offset_tablet' => $this->props['background_pattern_horizontal_offset_tablet'],
'background_pattern_horizontal_offset_phone' => $this->props['background_pattern_horizontal_offset_phone'],
'background_pattern_horizontal_offset__hover' => isset( $this->props['background_pattern_horizontal_offset__hover'] ) ? $this->props['background_pattern_horizontal_offset__hover'] : '',
'background_pattern_vertical_offset' => $this->props['background_pattern_vertical_offset'],
'background_pattern_vertical_offset_tablet' => $this->props['background_pattern_vertical_offset_tablet'],
'background_pattern_vertical_offset_phone' => $this->props['background_pattern_vertical_offset_phone'],
'background_pattern_vertical_offset__hover' => isset( $this->props['background_pattern_vertical_offset__hover'] ) ? $this->props['background_pattern_vertical_offset__hover'] : '',
'background_pattern_repeat' => $this->props['background_pattern_repeat'],
'background_pattern_repeat_tablet' => $this->props['background_pattern_repeat_tablet'],
'background_pattern_repeat_phone' => $this->props['background_pattern_repeat_phone'],
'background_pattern_repeat__hover' => isset( $this->props['background_pattern_repeat__hover'] ) ? $this->props['background_pattern_repeat__hover'] : '',
'background_pattern_blend_mode' => $this->props['background_pattern_blend_mode'],
'background_pattern_blend_mode_tablet' => $this->props['background_pattern_blend_mode_tablet'],
'background_pattern_blend_mode_phone' => $this->props['background_pattern_blend_mode_phone'],
'background_pattern_blend_mode__hover' => isset( $this->props['background_pattern_blend_mode__hover'] ) ? $this->props['background_pattern_blend_mode__hover'] : '',
'background_enable_pattern_style' => $this->props['background_enable_pattern_style'],
'background_enable_pattern_style_tablet' => $this->props['background_enable_pattern_style_tablet'],
'background_enable_pattern_style_phone' => $this->props['background_enable_pattern_style_phone'],
'background_enable_pattern_style__hover' => isset( $this->props['background_enable_pattern_style__hover'] ) ? $this->props['background_enable_pattern_style__hover'] : '',
// Background Mask.
'background_mask_style' => $this->props['background_mask_style'],
'background_mask_style_tablet' => $this->props['background_mask_style_tablet'],
'background_mask_style_phone' => $this->props['background_mask_style_phone'],
'background_mask_style__hover' => isset( $this->props['background_mask_style__hover'] ) ? $this->props['background_mask_style__hover'] : '',
'background_mask_color' => $this->props['background_mask_color'],
'background_mask_color_tablet' => $this->props['background_mask_color_tablet'],
'background_mask_color_phone' => $this->props['background_mask_color_phone'],
'background_mask_color__hover' => isset( $this->props['background_mask_color__hover'] ) ? $this->props['background_mask_color__hover'] : '',
'background_mask_transform' => $this->props['background_mask_transform'],
'background_mask_transform_tablet' => $this->props['background_mask_transform_tablet'],
'background_mask_transform_phone' => $this->props['background_mask_transform_phone'],
'background_mask_transform__hover' => isset( $this->props['background_mask_transform__hover'] ) ? $this->props['background_mask_transform__hover'] : '',
'background_mask_aspect_ratio' => $this->props['background_mask_aspect_ratio'],
'background_mask_aspect_ratio_tablet' => $this->props['background_mask_aspect_ratio_tablet'],
'background_mask_aspect_ratio_phone' => $this->props['background_mask_aspect_ratio_phone'],
'background_mask_aspect_ratio__hover' => isset( $this->props['background_mask_aspect_ratio__hover'] ) ? $this->props['background_mask_aspect_ratio__hover'] : '',
'background_mask_size' => $this->props['background_mask_size'],
'background_mask_size_tablet' => $this->props['background_mask_size_tablet'],
'background_mask_size_phone' => $this->props['background_mask_size_phone'],
'background_mask_size__hover' => isset( $this->props['background_mask_size__hover'] ) ? $this->props['background_mask_size__hover'] : '',
'background_mask_width' => $this->props['background_mask_width'],
'background_mask_width_tablet' => $this->props['background_mask_width_tablet'],
'background_mask_width_phone' => $this->props['background_mask_width_phone'],
'background_mask_width__hover' => isset( $this->props['background_mask_width__hover'] ) ? $this->props['background_mask_width__hover'] : '',
'background_mask_height' => $this->props['background_mask_height'],
'background_mask_height_tablet' => $this->props['background_mask_height_tablet'],
'background_mask_height_phone' => $this->props['background_mask_height_phone'],
'background_mask_height__hover' => isset( $this->props['background_mask_height__hover'] ) ? $this->props['background_mask_height__hover'] : '',
'background_mask_position' => $this->props['background_mask_position'],
'background_mask_position_tablet' => $this->props['background_mask_position_tablet'],
'background_mask_position_phone' => $this->props['background_mask_position_phone'],
'background_mask_position__hover' => isset( $this->props['background_mask_position__hover'] ) ? $this->props['background_mask_position__hover'] : '',
'background_mask_horizontal_offset' => $this->props['background_mask_horizontal_offset'],
'background_mask_horizontal_offset_tablet' => $this->props['background_mask_horizontal_offset_tablet'],
'background_mask_horizontal_offset_phone' => $this->props['background_mask_horizontal_offset_phone'],
'background_mask_horizontal_offset__hover' => isset( $this->props['background_mask_horizontal_offset__hover'] ) ? $this->props['background_mask_horizontal_offset__hover'] : '',
'background_mask_vertical_offset' => $this->props['background_mask_vertical_offset'],
'background_mask_vertical_offset_tablet' => $this->props['background_mask_vertical_offset_tablet'],
'background_mask_vertical_offset_phone' => $this->props['background_mask_vertical_offset_phone'],
'background_mask_vertical_offset__hover' => isset( $this->props['background_mask_vertical_offset__hover'] ) ? $this->props['background_mask_vertical_offset__hover'] : '',
'background_mask_blend_mode' => $this->props['background_mask_blend_mode'],
'background_mask_blend_mode_tablet' => $this->props['background_mask_blend_mode_tablet'],
'background_mask_blend_mode_phone' => $this->props['background_mask_blend_mode_phone'],
'background_mask_blend_mode__hover' => isset( $this->props['background_mask_blend_mode__hover'] ) ? $this->props['background_mask_blend_mode__hover'] : '',
'background_enable_mask_style' => $this->props['background_enable_mask_style'],
'background_enable_mask_style_tablet' => $this->props['background_enable_mask_style_tablet'],
'background_enable_mask_style_phone' => $this->props['background_enable_mask_style_phone'],
'background_enable_mask_style__hover' => isset( $this->props['background_enable_mask_style__hover'] ) ? $this->props['background_enable_mask_style__hover'] : '',
'bar_bg_color' => isset( $bar_bg_color_values['desktop'] ) ? $bar_bg_color_values['desktop'] : '',
'bar_bg_color_tablet' => isset( $bar_bg_color_values['tablet'] ) ? $bar_bg_color_values['tablet'] : '',
'bar_bg_color_phone' => isset( $bar_bg_color_values['phone'] ) ? $bar_bg_color_values['phone'] : '',
'use_percentages' => $multi_view->get_values( 'use_percentages' ),
// Sticky Element.
'is_sticky_module' => et_pb_sticky_options()->is_sticky_module( $this->props ),
);
}
@@ -234,7 +399,7 @@ class ET_Builder_Module_Bar_Counters extends ET_Builder_Module {
* @return string
*/
public function render( $attrs, $content, $render_slug ) {
$video_background = $this->video_background();
global $et_pb_counters_settings;
// Module classname
$this->add_classname(
@@ -255,11 +420,13 @@ class ET_Builder_Module_Bar_Counters extends ET_Builder_Module {
// Sticky & Hover style rendering.
$this->generate_styles(
array(
'responsive' => false,
'render_slug' => $render_slug,
'base_attr_name' => 'background_color',
'css_property' => 'background-color',
'selector' => '%%order_class%% .et_pb_counter_container',
'responsive' => false,
'render_slug' => $render_slug,
'base_attr_name' => 'background_color',
'css_property' => 'background-color',
'hover_pseudo_selector_location' => 'suffix',
'sticky_pseudo_selector_location' => 'prefix',
'selector' => '%%order_class%% .et_pb_counter_container',
)
);
@@ -283,6 +450,9 @@ class ET_Builder_Module_Bar_Counters extends ET_Builder_Module {
et_core_esc_previously( $data_background_layout )
);
// Reset passed value.
$et_pb_counters_settings = array();
return $output;
}
}
+100 -82
View File
@@ -49,7 +49,8 @@ class ET_Builder_Module_Bar_Counters_Item extends ET_Builder_Module {
'background' => array(
'use_background_color' => 'fields_only',
'css' => array(
'main' => ".et_pb_counters li{$this->main_css_element} .et_pb_counter_container",
'main' => ".et_pb_counters li{$this->main_css_element} .et_pb_counter_container",
'important' => 'all',
),
),
'margin_padding' => array(
@@ -155,88 +156,96 @@ class ET_Builder_Module_Bar_Counters_Item extends ET_Builder_Module {
return $fields;
}
function get_parallax_image_background( $base_name = 'background' ) {
/**
* Checks if module has background.
*
* @since 4.15.0
*
* @return bool
*/
protected function _has_background() {
global $et_pb_counters_settings;
// Parallax setting is only derived from parent if bar counter item has no background
$use_counter_value = '' !== $this->props['background_color'] || 'on' === $this->props['use_background_color_gradient'] || '' !== $this->props['background_image'] || '' !== $this->props['background_video_mp4'] || '' !== $this->props['background_video_webm'];
$background_image = $use_counter_value ? $this->props['background_image'] : $et_pb_counters_settings['background_image'];
$parallax = $use_counter_value ? $this->props['parallax'] : $et_pb_counters_settings['parallax'];
$parallax_method = $use_counter_value ? $this->props['parallax_method'] : $et_pb_counters_settings['parallax_method'];
$parallax_background = '';
// Since background color might inherit from parent, checking for different value in child.
$has_background_color = ! empty( $this->props['background_color'] ) && ( isset( $et_pb_counters_settings['background_color'] ) && $this->props['background_color'] !== $et_pb_counters_settings['background_color'] );
$has_background_gradient = isset( $this->props['use_background_color_gradient'] ) && 'on' === $this->props['use_background_color_gradient'];
$has_background_image = ! empty( $this->props['background_image'] );
$has_background_video_mp4 = ! empty( $this->props['background_video_mp4'] );
$has_background_video_webm = ! empty( $this->props['background_video_webm'] );
$has_background_pattern = isset( $this->props['background_enable_pattern_style'] ) && 'on' === $this->props['background_enable_pattern_style'] && ! empty( $this->props['background_pattern_style'] );
$has_background_mask = isset( $this->props['background_enable_mask_style'] ) && 'on' === $this->props['background_enable_mask_style'] && ! empty( $this->props['background_mask_style'] );
if ( '' !== $background_image && 'on' == $parallax ) {
$parallax_classname = array(
'et_parallax_bg',
);
if ( 'off' === $parallax_method ) {
$parallax_classname[] = 'et_pb_parallax_css';
}
$parallax_background = sprintf(
'<div class="et_parallax_bg_wrap"><div
class="%1$s"
style="background-image: url(%2$s);"
></div></div>',
esc_attr( implode( ' ', $parallax_classname ) ),
esc_attr( $background_image )
);
}
return $parallax_background;
return $has_background_color
|| $has_background_gradient
|| $has_background_image
|| $has_background_video_mp4
|| $has_background_video_webm
|| $has_background_pattern
|| $has_background_mask;
}
function video_background( $args = array(), $base_name = 'background' ) {
/**
* Returns Parallax element.
*
* @since 4.15.0
*
* @return string JSX
*/
public function get_background_parallax() {
global $et_pb_counters_settings;
$use_counter_value = '' !== $this->props['background_color'] || 'on' === $this->props['use_background_color_gradient'] || '' !== $this->props['background_image'] || '' !== $this->props['background_video_mp4'] || '' !== $this->props['background_video_webm'];
$background_video_mp4 = $use_counter_value && isset( $this->props['background_video_mp4'] ) ? $this->props['background_video_mp4'] : $et_pb_counters_settings['background_video_mp4'];
$background_video_webm = $use_counter_value && isset( $this->props['background_video_webm'] ) ? $this->props['background_video_webm'] : $et_pb_counters_settings['background_video_webm'];
$background_video_width = $use_counter_value && isset( $this->props['background_video_width'] ) ? $this->props['background_video_width'] : $et_pb_counters_settings['background_video_width'];
$background_video_height = $use_counter_value && isset( $this->props['background_video_height'] ) ? $this->props['background_video_height'] : $et_pb_counters_settings['background_video_height'];
// Parallax settings derived from parent if bar counter item has no background.
$background_props = $this->_has_background() ? $this->props : $et_pb_counters_settings;
if ( ! empty( $args ) ) {
$background_video = self::get_video_background( $args );
return $this->get_parallax_image_background( 'background', $background_props );
}
$allow_player_pause = isset( $args['allow_player_pause'] ) ? $args['allow_player_pause'] : 'off';
$pause_outside_viewport = isset( $args['background_video_pause_outside_viewport'] ) ? $args['background_video_pause_outside_viewport'] : 'on';
} else {
$background_video = self::get_video_background(
array(
'background_video_mp4' => $background_video_mp4,
'background_video_webm' => $background_video_webm,
'background_video_width' => $background_video_width,
'background_video_height' => $background_video_height,
)
);
/**
* Returns Video element.
*
* @since 4.15.0
*
* @return string JSX
*/
public function get_background_video() {
global $et_pb_counters_settings;
$allow_player_pause = $use_counter_value ? $this->props['allow_player_pause'] : $et_pb_counters_settings['allow_player_pause'];
$pause_outside_viewport = $use_counter_value ? $this->props['background_video_pause_outside_viewport'] : $et_pb_counters_settings['background_video_pause_outside_viewport'];
}
// Video settings derived from parent if bar counter item has no background.
$background_props = $this->_has_background() ? $this->props : $et_pb_counters_settings;
$video_background = '';
return $this->video_background( $background_props );
}
if ( $background_video ) {
$video_background = sprintf(
'<div class="et_pb_section_video_bg%2$s">
%1$s
</div>',
$background_video,
( 'on' === $allow_player_pause ? ' et_pb_allow_player_pause' : '' ),
( 'off' === $pause_outside_viewport ? ' et_pb_video_play_outside_viewport' : '' )
);
/**
* Returns Pattern element.
*
* @since 4.15.0
*
* @return string JSX
*/
public function get_background_pattern() {
global $et_pb_counters_settings;
wp_enqueue_style( 'wp-mediaelement' );
wp_enqueue_script( 'wp-mediaelement' );
}
// Pattern settings derived from parent if bar counter item has no background.
$background_props = $this->_has_background() ? $this->props : $et_pb_counters_settings;
// Added classname for module wrapper
if ( '' !== $video_background ) {
$this->add_classname( array( 'et_pb_section_video', 'et_pb_preload' ) );
}
return $this->background_pattern( $background_props );
}
return $video_background;
/**
* Returns Mask element.
*
* @since 4.15.0
*
* @return string JSX
*/
public function get_background_mask() {
global $et_pb_counters_settings;
// Pattern settings derived from parent if bar counter item has no background.
$background_props = $this->_has_background() ? $this->props : $et_pb_counters_settings;
return $this->background_mask( $background_props );
}
/**
@@ -306,11 +315,9 @@ class ET_Builder_Module_Bar_Counters_Item extends ET_Builder_Module {
$multi_view = et_pb_multi_view_options( $this );
$multi_view->set_custom_prop( 'use_percentages', $et_pb_counters_settings['use_percentages'] );
$percent = $multi_view->get_value( 'percent' );
$bar_background_color = self::$_->array_get( $this->props, 'bar_background_color' );
$bar_background_color = empty( $bar_background_color ) ? $et_pb_counters_settings['bar_bg_color'] : $bar_background_color;
$background_image = $this->props['background_image'];
$use_background_color_gradient = $this->props['use_background_color_gradient'];
$percent = $multi_view->get_value( 'percent', 'desktop', '' );
$bar_background_color = self::$_->array_get( $this->props, 'bar_background_color' );
$bar_background_color = empty( $bar_background_color ) ? $et_pb_counters_settings['bar_bg_color'] : $bar_background_color;
// Background Color.
$background_color = et_pb_responsive_options()->get_inheritance_background_value( $this->props, 'background_color', 'desktop' );
@@ -334,17 +341,22 @@ class ET_Builder_Module_Bar_Counters_Item extends ET_Builder_Module {
}
$background_color_style = $bar_bg_color_style = '';
$parent_bg_image = isset( $et_pb_counters_settings['background_image'] ) ? $et_pb_counters_settings['background_image'] : '';
$parent_use_bg_gradient = isset( $et_pb_counters_settings['use_background_color_gradient'] ) ? $et_pb_counters_settings['use_background_color_gradient'] : 'off';
$parent_enable_bg_image = ! empty( $parent_bg_image ) || 'on' === $parent_use_bg_gradient;
if ( '' !== $background_color && $parent_enable_bg_image ) {
$background_image = $this->props['background_image'];
$use_background_color_gradient = $this->props['use_background_color_gradient'];
$parent_bg_image = isset( $et_pb_counters_settings['background_image'] ) ? $et_pb_counters_settings['background_image'] : '';
$parent_use_bg_gradient = isset( $et_pb_counters_settings['use_background_color_gradient'] ) ? $et_pb_counters_settings['use_background_color_gradient'] : 'off';
$parent_enable_bg_image = ! empty( $parent_bg_image ) || 'on' === $parent_use_bg_gradient;
// In frontend, background color might inherit from parent.
if ( $this->_has_background() && '' !== $this->props['background_color'] && $parent_enable_bg_image ) {
// Need to override parent image that could be set, so inherited bg color can show up.
if ( empty( $background_image ) && 'on' !== $use_background_color_gradient ) {
ET_Builder_Element::set_style(
$render_slug,
array(
'selector' => '.et_pb_counters %%order_class%% .et_pb_counter_container',
'declaration' => 'background-image: none!important;',
'declaration' => 'background-image: none !important;',
)
);
}
@@ -356,7 +368,7 @@ class ET_Builder_Module_Bar_Counters_Item extends ET_Builder_Module {
'tablet' => esc_html( $background_color_tablet ),
'phone' => esc_html( $background_color_phone ),
);
et_pb_responsive_options()->generate_responsive_css( $background_color_values, '%%order_class%% .et_pb_counter_container', 'background-color', $render_slug, '', 'color' );
et_pb_responsive_options()->generate_responsive_css( $background_color_values, '.et_pb_counters %%order_class%% .et_pb_counter_container', 'background-color', $render_slug, ' !important; ', 'color' );
// Bar background color.
$bar_background_color_values = array(
@@ -410,8 +422,10 @@ class ET_Builder_Module_Bar_Counters_Item extends ET_Builder_Module {
)
);
$video_background = $this->video_background();
$parallax_image_background = $this->get_parallax_image_background();
$video_background = $this->get_background_video();
$parallax_image_background = $this->get_background_parallax();
$pattern_background = $this->get_background_pattern();
$mask_background = $this->get_background_mask();
// Module classname
$this->add_classname( $this->get_text_orientation_classname() );
@@ -454,6 +468,8 @@ class ET_Builder_Module_Bar_Counters_Item extends ET_Builder_Module {
<span class="et_pb_counter_container"%4$s%10$s>
%8$s
%7$s
%12$s
%13$s
<span class="et_pb_counter_amount" style="%5$s" data-width="%3$s"><span class="et_pb_counter_amount_number"><span class="et_pb_counter_amount_number_inner"%11$s>%2$s</span></span></span>
<span class="et_pb_counter_amount overlay" style="%5$s" data-width="%3$s"><span class="et_pb_counter_amount_number"><span class="et_pb_counter_amount_number_inner"%11$s>%2$s</span></span></span>
</span>
@@ -468,7 +484,9 @@ class ET_Builder_Module_Bar_Counters_Item extends ET_Builder_Module {
$parallax_image_background,
$multi_view_data_title,
$multi_view_data_percent_attrs, // #10
$multi_view_data_percent_content
$multi_view_data_percent_content,
et_core_esc_previously( $pattern_background ), // #12
et_core_esc_previously( $mask_background ) // #13
);
return $output;
+13 -3
View File
@@ -998,9 +998,11 @@ class ET_Builder_Module_Blog extends ET_Builder_Module_Type_PostBased {
? ' | '
: '';
// phpcs:disable WordPress.WP.I18n.NoEmptyStrings -- intentionally used.
$date = 'on' === $args['show_date']
? et_get_safe_localization( sprintf( __( '%s', 'et_builder' ), '<span class="published">' . esc_html( get_the_date( $args['meta_date'] ) ) . '</span>' ) )
? et_get_safe_localization( sprintf( __( '%s', 'et_builder' ), '<span class="published">' . esc_html( get_the_date( str_replace( '\\\\', '\\', $args['meta_date'] ) ) ) . '</span>' ) )
: '';
// phpcs:enable
$date_separator = ( ( 'on' === $args['show_author'] || 'on' === $args['show_date'] ) && 'on' === $args['show_categories'] )
? ' | '
@@ -1773,6 +1775,8 @@ class ET_Builder_Module_Blog extends ET_Builder_Module_Type_PostBased {
<div class="%1$s">
%7$s
%6$s
%10$s
%11$s
<div class="et_pb_ajax_pagination_container">
%2$s
</div>
@@ -1786,7 +1790,9 @@ class ET_Builder_Module_Blog extends ET_Builder_Module_Type_PostBased {
$video_background,
$parallax_image_background,
$this->drop_shadow_back_compatibility( $render_slug ),
et_core_esc_previously( $data_background_layout )
et_core_esc_previously( $data_background_layout ),
et_core_esc_previously( $this->background_pattern() ), // #10
et_core_esc_previously( $this->background_mask() ) // #11
);
} else {
// Module classname
@@ -1810,6 +1816,8 @@ class ET_Builder_Module_Blog extends ET_Builder_Module_Type_PostBased {
'<div%4$s class="%1$s"%8$s>
%6$s
%5$s
%9$s
%10$s
<div class="et_pb_ajax_pagination_container">
%2$s
</div>
@@ -1821,7 +1829,9 @@ class ET_Builder_Module_Blog extends ET_Builder_Module_Type_PostBased {
$video_background, // #5
$parallax_image_background,
$this->drop_shadow_back_compatibility( $render_slug ),
et_core_esc_previously( $data_background_layout )
et_core_esc_previously( $data_background_layout ),
et_core_esc_previously( $this->background_pattern() ), // #9
et_core_esc_previously( $this->background_mask() ) // #10
);
}
+9 -1
View File
@@ -420,6 +420,10 @@ class ET_Builder_Module_Blurb extends ET_Builder_Module {
'background-color' => '%%order_class%% .et_pb_only_image_mode_wrap, %%order_class%% .et-pb-icon',
);
$fields['background_layout'] = array(
'color' => '%%order_class%% .et_pb_module_header, %%order_class%% .et_pb_blurb_description',
);
$fields['body_text_color'] = array(
'color' => '%%order_class%% .et_pb_blurb_description',
);
@@ -942,6 +946,8 @@ class ET_Builder_Module_Blurb extends ET_Builder_Module {
'<div%5$s class="%4$s"%8$s>
%7$s
%6$s
%9$s
%10$s
<div class="et_pb_blurb_content">
%2$s
<div class="et_pb_blurb_container">
@@ -957,7 +963,9 @@ class ET_Builder_Module_Blurb extends ET_Builder_Module {
$this->module_id(), // #5
$video_background,
$parallax_image_background,
et_core_esc_previously( $data_background_layout )
et_core_esc_previously( $data_background_layout ),
et_core_esc_previously( $this->background_pattern() ), // #9
et_core_esc_previously( $this->background_mask() ) // #10
);
return $output;
+30 -3
View File
@@ -47,6 +47,11 @@ class ET_Builder_Module_Circle_Counter extends ET_Builder_Module {
),
),
),
'background' => array(
'css' => array(
'main' => "{$this->main_css_element} .et_pb_circle_counter_inner",
),
),
'margin_padding' => array(
'css' => array(
'important' => array( 'custom_margin' ),
@@ -219,7 +224,7 @@ class ET_Builder_Module_Circle_Counter extends ET_Builder_Module {
$sticky = et_pb_sticky_options();
$multi_view = et_pb_multi_view_options( $this );
$number = $multi_view->get_value( 'number' );
$number = $multi_view->get_value( 'number', 'desktop', '' );
$percent_sign = $this->props['percent_sign'];
$title = $multi_view->render_element(
array(
@@ -347,11 +352,30 @@ class ET_Builder_Module_Circle_Counter extends ET_Builder_Module {
$this->add_classname( 'et_pb_with_title' );
}
// Check Background Image.
$is_background_responsive = et_pb_responsive_options()->is_responsive_enabled( $this->props, 'background' );
$background_image = $this->props['background_image'];
$counter_inner_classname = '';
if ( '' === $background_image && $is_background_responsive ) {
$background_image_tablet = et_pb_responsive_options()->get_inheritance_background_value( $this->props, 'background_image', 'tablet' );
$background_image_phone = et_pb_responsive_options()->get_inheritance_background_value( $this->props, 'background_image', 'phone' );
$background_image = '' !== $background_image_tablet ? $background_image_tablet : $background_image_phone;
}
// We need to add et_pb_with_background class for the et_pb_circle_counter_inner element,
// when Background Image is used, so that would apply default styles for background image.
if ( ! empty( $video_background ) || '' !== $background_image ) {
$counter_inner_classname = ' et_pb_with_background';
};
$output = sprintf(
'<div%1$s class="%2$s"%11$s>
<div class="et_pb_circle_counter_inner" data-number-value="%3$s" data-bar-bg-color="%4$s"%7$s%8$s%12$s%13$s%14$s%15$s%16$s%17$s%18$s%19$s%20$s%21$s%22$s%23$s%24$s%25$s>
<div class="et_pb_circle_counter_inner%28$s" data-number-value="%3$s" data-bar-bg-color="%4$s"%7$s%8$s%12$s%13$s%14$s%15$s%16$s%17$s%18$s%19$s%20$s%21$s%22$s%23$s%24$s%25$s>
%10$s
%9$s
%26$s
%27$s
<div class="percent"%19$s><p><span class="percent-value"></span><span class="percent-sign">%5$s</span></p></div>
%6$s
</div>
@@ -380,7 +404,10 @@ class ET_Builder_Module_Circle_Counter extends ET_Builder_Module {
$bar_bg_color_data_sticky,
$circle_color_data_sticky,
$circle_color_alpha_data_sticky,
$data_sticky_id // #25
$data_sticky_id, // #25
et_core_esc_previously( $this->background_pattern() ), // #26
et_core_esc_previously( $this->background_mask() ), // #27
esc_attr( $counter_inner_classname ) // #28
);
return $output;
+5 -1
View File
@@ -95,13 +95,17 @@ class ET_Builder_Module_Code extends ET_Builder_Module {
'<div%2$s class="%3$s">
%5$s
%4$s
%6$s
%7$s
%1$s
</div>',
$raw_content,
$this->module_id(),
$this->module_classname( $render_slug ),
$video_background,
$parallax_image_background
$parallax_image_background,
et_core_esc_previously( $this->background_pattern() ), // #6
et_core_esc_previously( $this->background_mask() ) // #7
);
return $output;
+39 -4
View File
@@ -340,6 +340,20 @@ class ET_Builder_Module_Comments extends ET_Builder_Module {
'mobile_options' => true,
'hover' => 'tabs',
),
'show_meta' => array(
'label' => esc_html__( 'Show Meta', 'et_builder' ),
'type' => 'yes_no_button',
'option_category' => 'configuration',
'options' => array(
'on' => esc_html__( 'Yes', 'et_builder' ),
'off' => esc_html__( 'No', 'et_builder' ),
),
'default_on_front' => 'on',
'toggle_slug' => 'elements',
'description' => esc_html__( 'Turn meta on or off.', 'et_builder' ),
'mobile_options' => true,
'hover' => 'tabs',
),
);
return $fields;
@@ -466,6 +480,8 @@ class ET_Builder_Module_Comments extends ET_Builder_Module {
$show_avatar = $this->props['show_avatar'];
$show_reply = $this->props['show_reply'];
$show_count = $this->props['show_count'];
$show_meta = $this->props['show_meta'];
$show_rating = et_()->array_get( $this->props, 'show_rating', '' );
$header_level = $this->props['header_level'];
$video_background = $this->video_background();
$parallax_image_background = $this->get_parallax_image_background();
@@ -528,21 +544,36 @@ class ET_Builder_Module_Comments extends ET_Builder_Module {
$this->add_classname( 'et_pb_no_comments_count' );
}
if ( 'off' === $show_meta ) {
$this->add_classname( 'et_pb_no_comments_meta' );
}
if ( 'off' === $show_rating ) {
$this->add_classname( 'et_pb_no_comments_rating' );
}
// Removed automatically added classname
$this->remove_classname( $render_slug );
$multi_view_data_attr = $multi_view->render_attrs(
array(
'classes' => array(
'et_pb_no_avatar' => array(
'et_pb_no_avatar' => array(
'show_avatar' => 'off',
),
'et_pb_no_reply_button' => array(
'et_pb_no_reply_button' => array(
'show_reply' => 'off',
),
'et_pb_no_comments_count' => array(
'et_pb_no_comments_count' => array(
'show_count' => 'off',
),
'et_pb_no_comments_meta' => array(
'show_meta' => 'off',
),
/* WooCommerce Reviews Module uses the following class. */
'et_pb_no_comments_rating' => array(
'show_rating' => 'off',
),
),
)
);
@@ -550,6 +581,8 @@ class ET_Builder_Module_Comments extends ET_Builder_Module {
$output = sprintf(
'<div%3$s class="%2$s"%4$s%7$s%8$s%9$s%10$s>
%5$s
%11$s
%12$s
%6$s
%1$s
</div>',
@@ -562,7 +595,9 @@ class ET_Builder_Module_Comments extends ET_Builder_Module {
et_core_esc_previously( $data_background_layout ),
'' !== $comments_custom_icon_tablet ? sprintf( ' data-icon-tablet="%1$s"', esc_attr( et_pb_process_font_icon( $comments_custom_icon_tablet ) ) ) : '',
'' !== $comments_custom_icon_phone ? sprintf( ' data-icon-phone="%1$s"', esc_attr( et_pb_process_font_icon( $comments_custom_icon_phone ) ) ) : '',
$multi_view_data_attr // #10
$multi_view_data_attr, // #10
et_core_esc_previously( $this->background_pattern() ), // #11
et_core_esc_previously( $this->background_mask() ) // #12
);
return $output;
+40 -7
View File
@@ -11,6 +11,7 @@ class ET_Builder_Module_Contact_Form extends ET_Builder_Module_Type_WithSpamProt
$this->vb_support = 'on';
$this->child_slug = 'et_pb_contact_field';
$this->child_item_text = esc_html__( 'Field', 'et_builder' );
$this->_use_unique_id = true;
$this->main_css_element = '%%order_class%%.et_pb_contact_form_container';
@@ -588,7 +589,7 @@ class ET_Builder_Module_Contact_Form extends ET_Builder_Module_Type_WithSpamProt
? $email
: get_site_option( 'admin_email' );
$et_site_name = get_option( 'blogname' );
$et_site_name = strval( get_option( 'blogname' ) );
$contact_name = isset( $processed_fields_values['name'] ) ? stripslashes( sanitize_text_field( $processed_fields_values['name']['value'] ) ) : '';
@@ -660,6 +661,36 @@ class ET_Builder_Module_Contact_Form extends ET_Builder_Module_Type_WithSpamProt
$et_error_message = sprintf( '<p>%1$s</p>', et_core_esc_previously( $success_message ) );
}
// Contact form should always have the ID. Use saved ID or generate automatically.
$module_id = '' !== $this->module_id( false ) ? $this->module_id( false ) : 'et_pb_contact_form_' . $et_pb_contact_form_num;
$unique_id = self::$_->array_get( $this->props, '_unique_id' );
if ( $nonce_result ) {
// Additional info to be passed on the `et_pb_contact_form_submit` hook.
$contact_form_info = array(
'contact_form_id' => $module_id,
'contact_form_number' => $et_pb_contact_form_num,
'contact_form_unique_id' => $unique_id,
'module_slug' => $render_slug,
'post_id' => $this->get_the_ID(),
);
/**
* Fires after contact form is submitted.
*
* Use $et_contact_error variable to check whether there is an error on the form
* entry submit process or not.
*
* @since 4.13.1
*
* @param array $processed_fields_values Processed fields values.
* @param array $et_contact_error Whether there is an error on the form
* entry submit process or not.
* @param array $contact_form_info Additional contact form info.
*/
do_action( 'et_pb_contact_form_submit', $processed_fields_values, $et_contact_error, $contact_form_info );
}
$form = '';
$current_url = ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
@@ -728,14 +759,13 @@ class ET_Builder_Module_Contact_Form extends ET_Builder_Module_Type_WithSpamProt
// Remove automatically added classname
$this->remove_classname( $render_slug );
// Contact form should always have the ID. Use saved ID or generate automatically
$module_id = '' !== $this->module_id( false ) ? $this->module_id( false ) : 'et_pb_contact_form_' . $et_pb_contact_form_num;
$output = sprintf(
'
<div id="%4$s" class="%5$s" data-form_unique_num="%6$s"%7$s>
<div id="%4$s" class="%5$s" data-form_unique_num="%6$s" data-form_unique_id="%10$s"%7$s>
%9$s
%8$s
%11$s
%12$s
%1$s
<div class="et-pb-contact-message">%2$s</div>
%3$s
@@ -745,11 +775,14 @@ class ET_Builder_Module_Contact_Form extends ET_Builder_Module_Type_WithSpamProt
$et_error_message,
$form,
esc_attr( $module_id ),
$this->module_classname( $render_slug ),
$this->module_classname( $render_slug ), // #5
esc_attr( $et_pb_contact_form_num ),
'on' === $use_redirect && '' !== $redirect_url ? sprintf( ' data-redirect_url="%1$s"', esc_attr( $redirect_url ) ) : '',
$video_background,
$parallax_image_background
$parallax_image_background,
esc_attr( $unique_id ), // #10
et_core_esc_previously( $this->background_pattern() ), // #11
et_core_esc_previously( $this->background_mask() ) // #12
);
return $output;
+8 -2
View File
@@ -901,6 +901,8 @@ class ET_Builder_Module_Contact_Form_Item extends ET_Builder_Module {
'<p class="%5$s"%6$s data-id="%3$s" data-type="%7$s">
%9$s
%8$s
%11$s
%12$s
<label for="et_pb_contact_%3$s_%2$s" class="et_pb_contact_form_label"%10$s>%1$s</label>
%4$s
</p>',
@@ -917,7 +919,9 @@ class ET_Builder_Module_Contact_Form_Item extends ET_Builder_Module {
array(
'content' => '{{field_title}}',
)
)
),
et_core_esc_previously( $this->background_pattern() ), // #11
et_core_esc_previously( $this->background_mask() ) // #12
);
return $output;
@@ -934,7 +938,9 @@ class ET_Builder_Module_Contact_Form_Item extends ET_Builder_Module {
return 'on' === self::$_->array_get( $this->props, 'background_enable_color' )
|| 'on' === self::$_->array_get( $this->props, 'background_enable_image' )
|| 'on' === self::$_->array_get( $this->props, 'background_enable_video_mp4' )
|| 'on' === self::$_->array_get( $this->props, 'background_enable_video_webm' );
|| 'on' === self::$_->array_get( $this->props, 'background_enable_video_webm' )
|| 'on' === self::$_->array_get( $this->props, 'background_enable_pattern_style' )
|| 'on' === self::$_->array_get( $this->props, 'background_enable_mask_style' );
}
}
+6 -2
View File
@@ -188,7 +188,7 @@ class ET_Builder_Module_Countdown_Timer extends ET_Builder_Module {
$date_time = $this->props['date_time'];
$use_background_color = $this->props['use_background_color'];
$end_date = gmdate( 'M d, Y H:i:s', strtotime( $date_time ) );
$gmt_offset = get_option( 'gmt_offset' );
$gmt_offset = strval( get_option( 'gmt_offset' ) );
$gmt_divider = '-' === substr( $gmt_offset, 0, 1 ) ? '-' : '+';
$gmt_offset_hour = str_pad( abs( intval( $gmt_offset ) ), 2, '0', STR_PAD_LEFT );
$gmt_offset_minute = str_pad( ( ( abs( $gmt_offset ) * 100 ) % 100 ) * ( 60 / 100 ), 2, '0', STR_PAD_LEFT );
@@ -213,6 +213,8 @@ class ET_Builder_Module_Countdown_Timer extends ET_Builder_Module {
'<div%1$s class="%2$s"%3$s data-end-timestamp="%4$s"%16$s>
%15$s
%14$s
%17$s
%18$s
<div class="et_pb_countdown_timer_container clearfix">
%5$s
<div class="days section values" data-short="%13$s" data-full="%6$s">
@@ -251,7 +253,9 @@ class ET_Builder_Module_Countdown_Timer extends ET_Builder_Module {
esc_attr__( 'Day', 'et_builder' ),
$video_background,
$parallax_image_background, // #15
et_core_esc_previously( $data_background_layout )
et_core_esc_previously( $data_background_layout ),
et_core_esc_previously( $this->background_pattern() ), // #17
et_core_esc_previously( $this->background_mask() ) // #18
);
return $output;
+5 -1
View File
@@ -339,6 +339,8 @@ class ET_Builder_Module_Cta extends ET_Builder_Module {
'<div%5$s class="%4$s"%8$s>
%7$s
%6$s
%10$s
%11$s
%9$s
%3$s
</div>',
@@ -350,7 +352,9 @@ class ET_Builder_Module_Cta extends ET_Builder_Module {
$video_background,
$parallax_image_background,
et_core_esc_previously( $data_background_layout ),
et_core_esc_previously( $content_wrapper )
et_core_esc_previously( $content_wrapper ),
et_core_esc_previously( $this->background_pattern() ), // #10
et_core_esc_previously( $this->background_mask() ) // #11
);
return $output;
+4 -2
View File
@@ -386,12 +386,14 @@ class ET_Builder_Module_Divider extends ET_Builder_Module {
);
$output = sprintf(
'<div%2$s class="%1$s"%5$s>%4$s%3$s<div class="et_pb_divider_internal"></div></div>',
'<div%2$s class="%1$s"%5$s>%4$s%3$s%6$s%7$s<div class="et_pb_divider_internal"></div></div>',
$this->module_classname( $render_slug ),
$this->module_id(),
$video_background,
$parallax_image_background,
$multi_view_data_attr
$multi_view_data_attr,
et_core_esc_previously( $this->background_pattern() ), // #6
et_core_esc_previously( $this->background_mask() ) // #7
);
return $output;
@@ -761,6 +761,8 @@ class ET_Builder_Module_Filterable_Portfolio extends ET_Builder_Module_Type_Post
'<div%4$s class="%1$s" data-posts-number="%5$d"%8$s%11$s>
%10$s
%9$s
%13$s
%14$s
<div class="et_pb_portfolio_filters clearfix">%2$s</div>
<div class="et_pb_portfolio_items_wrapper %6$s"%12$s>
@@ -779,7 +781,9 @@ class ET_Builder_Module_Filterable_Portfolio extends ET_Builder_Module_Type_Post
$video_background,
$parallax_image_background, // #10
et_core_esc_previously( $data_background_layout ),
$pagination_classes_multi_view_attr
$pagination_classes_multi_view_attr,
et_core_esc_previously( $this->background_pattern() ), // #13
et_core_esc_previously( $this->background_mask() ) // #14
);
return $output;
+5 -1
View File
@@ -88,13 +88,17 @@ class ET_Builder_Module_Fullwidth_Code extends ET_Builder_Module {
'<div%2$s class="%3$s">
%5$s
%4$s
%6$s
%7$s
%1$s
</div>',
$raw_content,
$this->module_id(),
$this->module_classname( $render_slug ),
$video_background,
$parallax_image_background
$parallax_image_background,
et_core_esc_previously( $this->background_pattern() ), // #6
et_core_esc_previously( $this->background_mask() ) // #7
);
return $output;
+5 -1
View File
@@ -935,6 +935,8 @@ class ET_Builder_Module_Fullwidth_Header extends ET_Builder_Module {
'<section%7$s class="%1$s"%9$s%10$s>
%6$s
%8$s
%11$s
%12$s
<div class="et_pb_fullwidth_header_container%5$s">
%2$s
%3$s
@@ -951,7 +953,9 @@ class ET_Builder_Module_Fullwidth_Header extends ET_Builder_Module {
$this->module_id(),
$video_background,
et_core_esc_previously( $data_background_layout ),
et_core_esc_previously( $muti_view_data_attr ) // #10
et_core_esc_previously( $muti_view_data_attr ), // #10
et_core_esc_previously( $this->background_pattern() ), // #11
et_core_esc_previously( $this->background_mask() ) // #12
);
return $output;
+5 -1
View File
@@ -383,13 +383,17 @@ class ET_Builder_Module_Fullwidth_Image extends ET_Builder_Module {
'<div%3$s class="%2$s">
%5$s
%4$s
%6$s
%7$s
%1$s
</div>',
$output,
$this->module_classname( $render_slug ),
$this->module_id(),
$video_background,
$parallax_image_background
$parallax_image_background,
et_core_esc_previously( $this->background_pattern() ), // #6
et_core_esc_previously( $this->background_mask() ) // #7
);
return $output;
+5 -1
View File
@@ -255,6 +255,8 @@ class ET_Builder_Module_Fullwidth_Map extends ET_Builder_Module {
'<div%5$s class="%6$s"%11$s>
%10$s
%9$s
%12$s
%13$s
<div class="et_pb_map" data-center-lat="%1$s" data-center-lng="%2$s" data-zoom="%3$d" data-mouse-wheel="%7$s" data-mobile-dragging="%8$s"></div>
%4$s
</div>',
@@ -268,7 +270,9 @@ class ET_Builder_Module_Fullwidth_Map extends ET_Builder_Module {
esc_attr( $mobile_dragging ),
$video_background,
$parallax_image_background,
$grayscale_filter_data
$grayscale_filter_data,
et_core_esc_previously( $this->background_pattern() ), // #12
et_core_esc_previously( $this->background_mask() ) // #13
);
return $output;
+13 -5
View File
@@ -606,8 +606,8 @@ class ET_Builder_Module_Fullwidth_Menu extends ET_Builder_Module {
$fields['dropdown_menu_text_color'] = array( 'color' => "%%order_class%%.{$menu_slug} .nav li ul a" );
$fields['dropdown_menu_active_link_color'] = array( 'color' => "%%order_class%%.{$menu_slug} .nav li ul li.current-menu-item a" );
$fields['logo_width'] = array( 'width' => '%%order_class%% .et_pb_row > .et_pb_menu__logo-wrap .et_pb_menu__logo, %%order_class%% .et_pb_menu__logo-slot' );
$fields['logo_max_width'] = array( 'max-width' => '%%order_class%% .et_pb_row > .et_pb_menu__logo-wrap .et_pb_menu__logo, %%order_class%% .et_pb_menu__logo-slot' );
$fields['logo_width'] = array( 'width' => '%%order_class%% .et_pb_row > .et_pb_menu__logo-wrap, %%order_class%% .et_pb_menu__logo-slot' );
$fields['logo_max_width'] = array( 'max-width' => '%%order_class%% .et_pb_row > .et_pb_menu__logo-wrap, %%order_class%% .et_pb_menu__logo-slot' );
$fields['logo_height'] = array( 'height' => '%%order_class%% .et_pb_row > .et_pb_menu__logo-wrap .et_pb_menu__logo img, %%order_class%% .et_pb_menu__logo-slot .et_pb_menu__logo-wrap img' );
$fields['logo_max_height'] = array( 'max-height' => '%%order_class%% .et_pb_row > .et_pb_menu__logo-wrap .et_pb_menu__logo img, %%order_class%% .et_pb_menu__logo-slot .et_pb_menu__logo-wrap img' );
@@ -797,7 +797,7 @@ class ET_Builder_Module_Fullwidth_Menu extends ET_Builder_Module {
ET_Builder_Element::set_style( $render_slug, $el_style );
}
$logo_width_selector = '%%order_class%% .et_pb_row > .et_pb_menu__logo-wrap .et_pb_menu__logo, %%order_class%% .et_pb_menu__logo-slot';
$logo_width_selector = '%%order_class%% .et_pb_row > .et_pb_menu__logo-wrap, %%order_class%% .et_pb_menu__logo-slot';
$logo_height_selector = '%%order_class%% .et_pb_row > .et_pb_menu__logo-wrap .et_pb_menu__logo img, %%order_class%% .et_pb_menu__logo-slot .et_pb_menu__logo-wrap img';
// Width.
@@ -1326,6 +1326,8 @@ class ET_Builder_Module_Fullwidth_Menu extends ET_Builder_Module {
'<div%4$s class="%3$s"%2$s%7$s>
%6$s
%5$s
%13$s
%14$s
<div class="et_pb_row clearfix">
%8$s
<div class="et_pb_menu__wrap">
@@ -1350,13 +1352,17 @@ class ET_Builder_Module_Fullwidth_Menu extends ET_Builder_Module {
et_core_esc_previously( $this->render_cart() ),
et_core_esc_previously( $this->render_search() ),
et_core_esc_previously( $mobile_menu ),
et_core_esc_previously( $this->render_search_form() )
et_core_esc_previously( $this->render_search_form() ),
et_core_esc_previously( $this->background_pattern() ), // #13
et_core_esc_previously( $this->background_mask() ) // #14
);
} else {
$output = sprintf(
'<div%4$s class="%3$s"%2$s%7$s>
%6$s
%5$s
%13$s
%14$s
<div class="et_pb_row clearfix">
%8$s
<div class="et_pb_menu__wrap">
@@ -1381,7 +1387,9 @@ class ET_Builder_Module_Fullwidth_Menu extends ET_Builder_Module {
et_core_esc_previously( $this->render_cart() ),
et_core_esc_previously( $this->render_search() ),
et_core_esc_previously( $mobile_menu ),
et_core_esc_previously( $this->render_search_form() )
et_core_esc_previously( $this->render_search_form() ),
et_core_esc_previously( $this->background_pattern() ), // #13
et_core_esc_previously( $this->background_mask() ) // #14
);
}
@@ -642,6 +642,8 @@ class ET_Builder_Module_Fullwidth_Portfolio extends ET_Builder_Module_Type_PostB
%8$s
%7$s
%6$s
%10$s
%11$s
<div class="et_pb_portfolio_items clearfix" data-portfolio-columns="">
%2$s
</div>
@@ -654,7 +656,9 @@ class ET_Builder_Module_Fullwidth_Portfolio extends ET_Builder_Module_Type_PostB
$title,
$video_background,
$parallax_image_background,
et_core_esc_previously( $data_background_layout )
et_core_esc_previously( $data_background_layout ),
et_core_esc_previously( $this->background_pattern() ), // #10
et_core_esc_previously( $this->background_mask() ) // #11
);
return $output;
@@ -989,6 +989,18 @@ class ET_Builder_Module_Fullwidth_Post_Slider extends ET_Builder_Module_Type_Pos
$header_level = $this->props['header_level'];
$offset_number = $this->props['offset_number'];
$use_gradient_options = $this->props['use_background_color_gradient'];
$gradient_overlays_image = $this->props['background_color_gradient_overlays_image'];
$background_options = et_pb_background_options();
$gradient_properties = $background_options->get_gradient_properties( $this->props, 'background', '' );
$background_gradient_style = $background_options->get_gradient_style( $gradient_properties );
$is_gradient_on = false;
if ( 'on' === $use_gradient_options && 'on' === $gradient_overlays_image && 'on' === $parallax ) {
$is_gradient_on = '' !== $background_gradient_style;
}
$custom_icon_values = et_pb_responsive_options()->get_property_values( $this->props, 'button_icon' );
$custom_icon = isset( $custom_icon_values['desktop'] ) ? $custom_icon_values['desktop'] : '';
$custom_icon_tablet = isset( $custom_icon_values['tablet'] ) ? $custom_icon_values['tablet'] : '';
@@ -1212,6 +1224,21 @@ class ET_Builder_Module_Fullwidth_Post_Slider extends ET_Builder_Module_Type_Pos
echo ' et_pb_parallax_css'; }
?>
" style="background-image: url(<?php echo esc_url( $query->posts[ $post_index ]->post_featured_image ); ?>);"<?php echo et_core_esc_previously( $multi_view_attrs_parallax_bg ); ?>></div>
<?php
if ( $is_gradient_on ) {
printf(
'<span class="et_parallax_gradient" style="%1$s%2$s"></span>',
sprintf(
'background-image: %1$s;',
esc_html( $background_gradient_style )
),
( '' !== $background_blend && 'normal' !== $background_blend ) ? sprintf(
'mix-blend-mode: %1$s;',
esc_html( $background_blend )
) : ''
);
}
?>
</div>
<?php } ?>
<?php if ( 'on' === $use_bg_overlay ) { ?>
@@ -1398,6 +1425,8 @@ class ET_Builder_Module_Fullwidth_Post_Slider extends ET_Builder_Module_Type_Pos
'<div%3$s class="%1$s"%7$s%8$s>
%5$s
%4$s
%9$s
%10$s
<div class="et_pb_slides">
%2$s
</div>
@@ -1411,7 +1440,9 @@ class ET_Builder_Module_Fullwidth_Post_Slider extends ET_Builder_Module_Type_Pos
$parallax_image_background, // #5
$this->inner_shadow_back_compatibility( $render_slug ),
et_core_esc_previously( $data_background_layout ),
$muti_view_data_attr
$muti_view_data_attr,
et_core_esc_previously( $this->background_pattern() ), // #9
et_core_esc_previously( $this->background_mask() ) // #10
);
// Restore $wp_filter
@@ -745,6 +745,8 @@ class ET_Builder_Module_Fullwidth_Post_Title extends ET_Builder_Module {
'<div%3$s class="%2$s" %8$s %9$s %10$s>
%4$s
%7$s
%11$s
%12$s
%5$s
<div class="et_pb_title_container">
%1$s
@@ -760,7 +762,9 @@ class ET_Builder_Module_Fullwidth_Post_Title extends ET_Builder_Module {
$video_background,
$data_background_layout,
$data_background_layout_hover,
et_core_esc_previously( $muti_view_data_attr ) // #10
et_core_esc_previously( $muti_view_data_attr ), // #10
et_core_esc_previously( $this->background_pattern() ), // #11
et_core_esc_previously( $this->background_mask() ) // #12
);
return $output;
+123 -17
View File
@@ -498,6 +498,10 @@ class ET_Builder_Module_Fullwidth_Slider extends ET_Builder_Module {
'use_background_color_gradient_tablet' => $this->props['use_background_color_gradient_tablet'],
'use_background_color_gradient_phone' => $this->props['use_background_color_gradient_phone'],
'use_background_color_gradient__hover' => isset( $this->props['use_background_color_gradient__hover'] ) ? $this->props['use_background_color_gradient__hover'] : '',
'background_color_gradient_repeat' => isset( $this->props['background_color_gradient_repeat'] ) ? $this->props['background_color_gradient_repeat'] : '',
'background_color_gradient_repeat_tablet' => isset( $this->props['background_color_gradient_repeat_tablet'] ) ? $this->props['background_color_gradient_repeat_tablet'] : '',
'background_color_gradient_repeat_phone' => isset( $this->props['background_color_gradient_repeat_phone'] ) ? $this->props['background_color_gradient_repeat_phone'] : '',
'background_color_gradient_repeat__hover' => isset( $this->props['background_color_gradient_repeat__hover'] ) ? $this->props['background_color_gradient_repeat__hover'] : '',
'background_color_gradient_type' => $this->props['background_color_gradient_type'],
'background_color_gradient_type_tablet' => $this->props['background_color_gradient_type_tablet'],
'background_color_gradient_type_phone' => $this->props['background_color_gradient_type_phone'],
@@ -510,26 +514,31 @@ class ET_Builder_Module_Fullwidth_Slider extends ET_Builder_Module {
'background_color_gradient_direction_radial_tablet' => $this->props['background_color_gradient_direction_radial_tablet'],
'background_color_gradient_direction_radial_phone' => $this->props['background_color_gradient_direction_radial_phone'],
'background_color_gradient_direction_radial__hover' => isset( $this->props['background_color_gradient_direction_radial__hover'] ) ? $this->props['background_color_gradient_direction_radial__hover'] : '',
'background_color_gradient_start' => $this->props['background_color_gradient_start'],
'background_color_gradient_start_tablet' => $this->props['background_color_gradient_start_tablet'],
'background_color_gradient_start_phone' => $this->props['background_color_gradient_start_phone'],
'background_color_gradient_start__hover' => isset( $this->props['background_color_gradient_start__hover'] ) ? $this->props['background_color_gradient_start__hover'] : '',
'background_color_gradient_end' => $this->props['background_color_gradient_end'],
'background_color_gradient_end_tablet' => $this->props['background_color_gradient_end_tablet'],
'background_color_gradient_end_phone' => $this->props['background_color_gradient_end_phone'],
'background_color_gradient_end__hover' => isset( $this->props['background_color_gradient_end__hover'] ) ? $this->props['background_color_gradient_end__hover'] : '',
'background_color_gradient_start_position' => $this->props['background_color_gradient_start_position'],
'background_color_gradient_start_position_tablet' => $this->props['background_color_gradient_start_position_tablet'],
'background_color_gradient_start_position_phone' => $this->props['background_color_gradient_start_position_phone'],
'background_color_gradient_start_position__hover' => isset( $this->props['background_color_gradient_start_position__hover'] ) ? $this->props['background_color_gradient_start_position__hover'] : '',
'background_color_gradient_end_position' => $this->props['background_color_gradient_end_position'],
'background_color_gradient_end_position_tablet' => $this->props['background_color_gradient_end_position_tablet'],
'background_color_gradient_end_position_phone' => $this->props['background_color_gradient_end_position_phone'],
'background_color_gradient_end_position__hover' => isset( $this->props['background_color_gradient_end_position__hover'] ) ? $this->props['background_color_gradient_end_position__hover'] : '',
'background_color_gradient_stops' => isset( $this->props['background_color_gradient_stops'] ) ? $this->props['background_color_gradient_stops'] : '',
'background_color_gradient_stops_tablet' => isset( $this->props['background_color_gradient_stops_tablet'] ) ? $this->props['background_color_gradient_stops_tablet'] : '',
'background_color_gradient_stops_phone' => isset( $this->props['background_color_gradient_stops_phone'] ) ? $this->props['background_color_gradient_stops_phone'] : '',
'background_color_gradient_stops__hover' => isset( $this->props['background_color_gradient_stops__hover'] ) ? $this->props['background_color_gradient_stops__hover'] : '',
'background_color_gradient_overlays_image' => $this->props['background_color_gradient_overlays_image'],
'background_color_gradient_overlays_image_tablet' => $this->props['background_color_gradient_overlays_image_tablet'],
'background_color_gradient_overlays_image_phone' => $this->props['background_color_gradient_overlays_image_phone'],
'background_color_gradient_overlays_image__hover' => isset( $this->props['background_color_gradient_overlays_image__hover'] ) ? $this->props['background_color_gradient_overlays_image__hover'] : '',
// Background Gradient [deprecated].
'background_color_gradient_start' => isset( $this->props['background_color_gradient_start'] ) ? $this->props['background_color_gradient_start'] : '',
'background_color_gradient_start_tablet' => isset( $this->props['background_color_gradient_start_tablet'] ) ? $this->props['background_color_gradient_start_tablet'] : '',
'background_color_gradient_start_phone' => isset( $this->props['background_color_gradient_start_phone'] ) ? $this->props['background_color_gradient_start_phone'] : '',
'background_color_gradient_start__hover' => isset( $this->props['background_color_gradient_start__hover'] ) ? $this->props['background_color_gradient_start__hover'] : '',
'background_color_gradient_end' => isset( $this->props['background_color_gradient_end'] ) ? $this->props['background_color_gradient_end'] : '',
'background_color_gradient_end_tablet' => isset( $this->props['background_color_gradient_end_tablet'] ) ? $this->props['background_color_gradient_end_tablet'] : '',
'background_color_gradient_end_phone' => isset( $this->props['background_color_gradient_end_phone'] ) ? $this->props['background_color_gradient_end_phone'] : '',
'background_color_gradient_end__hover' => isset( $this->props['background_color_gradient_end__hover'] ) ? $this->props['background_color_gradient_end__hover'] : '',
'background_color_gradient_start_position' => isset( $this->props['background_color_gradient_start_position'] ) ? $this->props['background_color_gradient_start_position'] : '',
'background_color_gradient_start_position_tablet' => isset( $this->props['background_color_gradient_start_position_tablet'] ) ? $this->props['background_color_gradient_start_position_tablet'] : '',
'background_color_gradient_start_position_phone' => isset( $this->props['background_color_gradient_start_position_phone'] ) ? $this->props['background_color_gradient_start_position_phone'] : '',
'background_color_gradient_start_position__hover' => isset( $this->props['background_color_gradient_start_position__hover'] ) ? $this->props['background_color_gradient_start_position__hover'] : '',
'background_color_gradient_end_position' => isset( $this->props['background_color_gradient_end_position'] ) ? $this->props['background_color_gradient_end_position'] : '',
'background_color_gradient_end_position_tablet' => isset( $this->props['background_color_gradient_end_position_tablet'] ) ? $this->props['background_color_gradient_end_position_tablet'] : '',
'background_color_gradient_end_position_phone' => isset( $this->props['background_color_gradient_end_position_phone'] ) ? $this->props['background_color_gradient_end_position_phone'] : '',
'background_color_gradient_end_position__hover' => isset( $this->props['background_color_gradient_end_position__hover'] ) ? $this->props['background_color_gradient_end_position__hover'] : '',
// Background Image.
'background_enable_image' => $this->props['background_enable_image'],
'background_enable_image_tablet' => $this->props['background_enable_image_tablet'],
@@ -588,6 +597,104 @@ class ET_Builder_Module_Fullwidth_Slider extends ET_Builder_Module {
'background_video_height_tablet' => $this->props['background_video_height_tablet'],
'background_video_height_phone' => $this->props['background_video_height_phone'],
'background_video_height__hover' => isset( $this->props['background_video_height__hover'] ) ? $this->props['background_video_height__hover'] : '',
// Background Pattern.
'background_pattern_style' => $this->props['background_pattern_style'],
'background_pattern_style_tablet' => $this->props['background_pattern_style_tablet'],
'background_pattern_style_phone' => $this->props['background_pattern_style_phone'],
'background_pattern_style__hover' => isset( $this->props['background_pattern_style__hover'] ) ? $this->props['background_pattern_style__hover'] : '',
'background_pattern_color' => $this->props['background_pattern_color'],
'background_pattern_color_tablet' => $this->props['background_pattern_color_tablet'],
'background_pattern_color_phone' => $this->props['background_pattern_color_phone'],
'background_pattern_color__hover' => isset( $this->props['background_pattern_color__hover'] ) ? $this->props['background_pattern_color__hover'] : '',
'background_pattern_transform' => $this->props['background_pattern_transform'],
'background_pattern_transform_tablet' => $this->props['background_pattern_transform_tablet'],
'background_pattern_transform_phone' => $this->props['background_pattern_transform_phone'],
'background_pattern_transform__hover' => isset( $this->props['background_pattern_transform__hover'] ) ? $this->props['background_pattern_transform__hover'] : '',
'background_pattern_size' => $this->props['background_pattern_size'],
'background_pattern_size_tablet' => $this->props['background_pattern_size_tablet'],
'background_pattern_size_phone' => $this->props['background_pattern_size_phone'],
'background_pattern_size__hover' => isset( $this->props['background_pattern_size__hover'] ) ? $this->props['background_pattern_size__hover'] : '',
'background_pattern_width' => $this->props['background_pattern_width'],
'background_pattern_width_tablet' => $this->props['background_pattern_width_tablet'],
'background_pattern_width_phone' => $this->props['background_pattern_width_phone'],
'background_pattern_width__hover' => isset( $this->props['background_pattern_width__hover'] ) ? $this->props['background_pattern_width__hover'] : '',
'background_pattern_height' => $this->props['background_pattern_height'],
'background_pattern_height_tablet' => $this->props['background_pattern_height_tablet'],
'background_pattern_height_phone' => $this->props['background_pattern_height_phone'],
'background_pattern_height__hover' => isset( $this->props['background_pattern_height__hover'] ) ? $this->props['background_pattern_height__hover'] : '',
'background_pattern_repeat_origin' => $this->props['background_pattern_repeat_origin'],
'background_pattern_repeat_origin_tablet' => $this->props['background_pattern_repeat_origin_tablet'],
'background_pattern_repeat_origin_phone' => $this->props['background_pattern_repeat_origin_phone'],
'background_pattern_repeat_origin__hover' => isset( $this->props['background_pattern_repeat_origin__hover'] ) ? $this->props['background_pattern_repeat_origin__hover'] : '',
'background_pattern_horizontal_offset' => $this->props['background_pattern_horizontal_offset'],
'background_pattern_horizontal_offset_tablet' => $this->props['background_pattern_horizontal_offset_tablet'],
'background_pattern_horizontal_offset_phone' => $this->props['background_pattern_horizontal_offset_phone'],
'background_pattern_horizontal_offset__hover' => isset( $this->props['background_pattern_horizontal_offset__hover'] ) ? $this->props['background_pattern_horizontal_offset__hover'] : '',
'background_pattern_vertical_offset' => $this->props['background_pattern_vertical_offset'],
'background_pattern_vertical_offset_tablet' => $this->props['background_pattern_vertical_offset_tablet'],
'background_pattern_vertical_offset_phone' => $this->props['background_pattern_vertical_offset_phone'],
'background_pattern_vertical_offset__hover' => isset( $this->props['background_pattern_vertical_offset__hover'] ) ? $this->props['background_pattern_vertical_offset__hover'] : '',
'background_pattern_repeat' => $this->props['background_pattern_repeat'],
'background_pattern_repeat_tablet' => $this->props['background_pattern_repeat_tablet'],
'background_pattern_repeat_phone' => $this->props['background_pattern_repeat_phone'],
'background_pattern_repeat__hover' => isset( $this->props['background_pattern_repeat__hover'] ) ? $this->props['background_pattern_repeat__hover'] : '',
'background_pattern_blend_mode' => $this->props['background_pattern_blend_mode'],
'background_pattern_blend_mode_tablet' => $this->props['background_pattern_blend_mode_tablet'],
'background_pattern_blend_mode_phone' => $this->props['background_pattern_blend_mode_phone'],
'background_pattern_blend_mode__hover' => isset( $this->props['background_pattern_blend_mode__hover'] ) ? $this->props['background_pattern_blend_mode__hover'] : '',
'background_enable_pattern_style' => $this->props['background_enable_pattern_style'],
'background_enable_pattern_style_tablet' => $this->props['background_enable_pattern_style_tablet'],
'background_enable_pattern_style_phone' => $this->props['background_enable_pattern_style_phone'],
'background_enable_pattern_style__hover' => isset( $this->props['background_enable_pattern_style__hover'] ) ? $this->props['background_enable_pattern_style__hover'] : '',
// Background Mask.
'background_mask_style' => $this->props['background_mask_style'],
'background_mask_style_tablet' => $this->props['background_mask_style_tablet'],
'background_mask_style_phone' => $this->props['background_mask_style_phone'],
'background_mask_style__hover' => isset( $this->props['background_mask_style__hover'] ) ? $this->props['background_mask_style__hover'] : '',
'background_mask_color' => $this->props['background_mask_color'],
'background_mask_color_tablet' => $this->props['background_mask_color_tablet'],
'background_mask_color_phone' => $this->props['background_mask_color_phone'],
'background_mask_color__hover' => isset( $this->props['background_mask_color__hover'] ) ? $this->props['background_mask_color__hover'] : '',
'background_mask_transform' => $this->props['background_mask_transform'],
'background_mask_transform_tablet' => $this->props['background_mask_transform_tablet'],
'background_mask_transform_phone' => $this->props['background_mask_transform_phone'],
'background_mask_transform__hover' => isset( $this->props['background_mask_transform__hover'] ) ? $this->props['background_mask_transform__hover'] : '',
'background_mask_aspect_ratio' => $this->props['background_mask_aspect_ratio'],
'background_mask_aspect_ratio_tablet' => $this->props['background_mask_aspect_ratio_tablet'],
'background_mask_aspect_ratio_phone' => $this->props['background_mask_aspect_ratio_phone'],
'background_mask_aspect_ratio__hover' => isset( $this->props['background_mask_aspect_ratio__hover'] ) ? $this->props['background_mask_aspect_ratio__hover'] : '',
'background_mask_size' => $this->props['background_mask_size'],
'background_mask_size_tablet' => $this->props['background_mask_size_tablet'],
'background_mask_size_phone' => $this->props['background_mask_size_phone'],
'background_mask_size__hover' => isset( $this->props['background_mask_size__hover'] ) ? $this->props['background_mask_size__hover'] : '',
'background_mask_width' => $this->props['background_mask_width'],
'background_mask_width_tablet' => $this->props['background_mask_width_tablet'],
'background_mask_width_phone' => $this->props['background_mask_width_phone'],
'background_mask_width__hover' => isset( $this->props['background_mask_width__hover'] ) ? $this->props['background_mask_width__hover'] : '',
'background_mask_height' => $this->props['background_mask_height'],
'background_mask_height_tablet' => $this->props['background_mask_height_tablet'],
'background_mask_height_phone' => $this->props['background_mask_height_phone'],
'background_mask_height__hover' => isset( $this->props['background_mask_height__hover'] ) ? $this->props['background_mask_height__hover'] : '',
'background_mask_position' => $this->props['background_mask_position'],
'background_mask_position_tablet' => $this->props['background_mask_position_tablet'],
'background_mask_position_phone' => $this->props['background_mask_position_phone'],
'background_mask_position__hover' => isset( $this->props['background_mask_position__hover'] ) ? $this->props['background_mask_position__hover'] : '',
'background_mask_horizontal_offset' => $this->props['background_mask_horizontal_offset'],
'background_mask_horizontal_offset_tablet' => $this->props['background_mask_horizontal_offset_tablet'],
'background_mask_horizontal_offset_phone' => $this->props['background_mask_horizontal_offset_phone'],
'background_mask_horizontal_offset__hover' => isset( $this->props['background_mask_horizontal_offset__hover'] ) ? $this->props['background_mask_horizontal_offset__hover'] : '',
'background_mask_vertical_offset' => $this->props['background_mask_vertical_offset'],
'background_mask_vertical_offset_tablet' => $this->props['background_mask_vertical_offset_tablet'],
'background_mask_vertical_offset_phone' => $this->props['background_mask_vertical_offset_phone'],
'background_mask_vertical_offset__hover' => isset( $this->props['background_mask_vertical_offset__hover'] ) ? $this->props['background_mask_vertical_offset__hover'] : '',
'background_mask_blend_mode' => $this->props['background_mask_blend_mode'],
'background_mask_blend_mode_tablet' => $this->props['background_mask_blend_mode_tablet'],
'background_mask_blend_mode_phone' => $this->props['background_mask_blend_mode_phone'],
'background_mask_blend_mode__hover' => isset( $this->props['background_mask_blend_mode__hover'] ) ? $this->props['background_mask_blend_mode__hover'] : '',
'background_enable_mask_style' => $this->props['background_enable_mask_style'],
'background_enable_mask_style_tablet' => $this->props['background_enable_mask_style_tablet'],
'background_enable_mask_style_phone' => $this->props['background_enable_mask_style_phone'],
'background_enable_mask_style__hover' => isset( $this->props['background_enable_mask_style__hover'] ) ? $this->props['background_enable_mask_style__hover'] : '',
'header_level' => $this->props['header_level'],
'use_bg_overlay' => $this->props['use_bg_overlay'],
'bg_overlay_color' => $bg_overlay_color,
@@ -731,7 +838,6 @@ class ET_Builder_Module_Fullwidth_Slider extends ET_Builder_Module {
if ( 'on' === $show_image_video_mobile ) {
$this->add_classname( 'et_pb_slider_show_image' );
}
$this->generate_responsive_hover_style( 'arrows_custom_color', et_pb_slider_options()->get_arrows_selector(), 'color' );
$this->generate_responsive_hover_style( 'dot_nav_custom_color', et_pb_slider_options()->get_dots_selector(), 'background-color' );
+4 -2
View File
@@ -607,14 +607,16 @@ class ET_Builder_Module_Gallery extends ET_Builder_Module {
$data_background_layout = et_pb_background_layout_options()->get_background_layout_attrs( $this->props );
$output = sprintf(
'<div%1$s class="%2$s"%4$s>%5$s%6$s
'<div%1$s class="%2$s"%4$s>%5$s%6$s%7$s%8$s
<div class="et_pb_gallery_items et_post_gallery clearfix" data-per_page="%3$d">',
$this->module_id(),
$this->module_classname( $render_slug ),
esc_attr( $posts_number ),
et_core_esc_previously( $data_background_layout ),
$parallax_image_background,
$video_background
$video_background,
et_core_esc_previously( $this->background_pattern() ), // #7
et_core_esc_previously( $this->background_mask() ) // #8
);
// Images: Add CSS Filters and Mix Blend Mode rules (if set)
+9 -7
View File
@@ -58,10 +58,10 @@ class ET_Builder_Module_Icon extends ET_Builder_Module {
$this->advanced_fields = array(
'margin_padding' => array(
'css' => array(
'main' => '%%order_class%% .et_pb_icon_wrap',
'hover' => '%%order_class%% .et_pb_icon_wrap:hover',
'padding' => '%%order_class%% .et_pb_icon_wrap',
'margin' => '%%order_class%% .et_pb_icon_wrap',
'main' => '%%order_class%%',
'padding' => '%%order_class%% .et_pb_icon_wrap',
'margin' => '%%order_class%%',
'important' => 'all',
),
),
'borders' => array(
@@ -267,7 +267,7 @@ class ET_Builder_Module_Icon extends ET_Builder_Module {
*
* @return string
*/
public function render( $attrs, $content = null, $render_slug ) {
public function render( $attrs, $content, $render_slug ) {
$multi_view = et_pb_multi_view_options( $this );
$title_text = $this->props['title_text'];
$url = $this->props['url'];
@@ -368,10 +368,12 @@ class ET_Builder_Module_Icon extends ET_Builder_Module {
: '';
$output = sprintf(
'<span class="et_pb_icon_wrap %1$s">%2$s%3$s</span>',
'<span class="et_pb_icon_wrap %1$s">%2$s%4$s%5$s%3$s</span>',
$box_shadow_overlay_wrap_class,
$box_shadow_overlay_element,
$output
$output,
et_core_esc_previously( $this->background_pattern() ), // #4
et_core_esc_previously( $this->background_mask() ) // #5
);
$title_text = ! empty( $title_text ) ? sprintf( 'title="%1$s"', esc_attr( $title_text ) ) : '';
+21 -8
View File
@@ -482,14 +482,23 @@ class ET_Builder_Module_Image extends ET_Builder_Module {
// Only if force fullwidth is not set.
if ( 'on' !== $force_fullwidth ) {
// Only height or max-height is set, no width set.
if ( 'auto' === $width && 'auto' !== $height || 'none' !== $max_height ) {
$el_style = array(
'selector' => '%%order_class%% .et_pb_image_wrap img',
'declaration' => 'width: auto;',
);
ET_Builder_Element::set_style( $render_slug, $el_style );
$responsive_width = et_pb_responsive_options()->get_property_values( $this->props, 'width' );
$responsive_height = et_pb_responsive_options()->get_property_values( $this->props, 'height' );
$responsive_max_width = et_pb_responsive_options()->get_property_values( $this->props, 'max_height' );
$image_style_width = [];
$modes = [ 'desktop', 'tablet', 'phone' ];
foreach ( $modes as $mode ) {
// Only height or max-height is set, no width set.
if ( 'auto' === $responsive_width[ $mode ] && 'auto' !== $responsive_height[ $mode ] || 'none' !== $responsive_max_width[ $mode ] ) {
$image_style_width[ $mode ] = [
'width' => 'auto',
];
}
}
et_pb_responsive_options()->generate_responsive_css( $image_style_width, '%%order_class%% .et_pb_image_wrap img', '', $render_slug, '', '' );
}
$image_attachment_class = et_pb_media_options()->get_image_attachment_class( $this->props, 'src' );
@@ -563,13 +572,17 @@ class ET_Builder_Module_Image extends ET_Builder_Module {
'<div%3$s class="%2$s">
%5$s
%4$s
%6$s
%7$s
%1$s
</div>',
$output,
$this->module_classname( $render_slug ),
$this->module_id(),
$video_background,
$parallax_image_background
$parallax_image_background,
et_core_esc_previously( $this->background_pattern() ), // #6
et_core_esc_previously( $this->background_mask() ) // #7
);
return $output;
+6 -2
View File
@@ -415,9 +415,11 @@ class ET_Builder_Module_Login extends ET_Builder_Module {
);
$output = sprintf(
'<div%4$s class="%2$s"%7$s%7$s>
'<div%4$s class="%2$s"%7$s%8$s>
%6$s
%5$s
%9$s
%10$s
%3$s
%1$s
</div>',
@@ -428,7 +430,9 @@ class ET_Builder_Module_Login extends ET_Builder_Module {
$video_background, // #5
$parallax_image_background,
et_core_esc_previously( $data_background_layout ),
$wrapper_multi_view_classes
$wrapper_multi_view_classes,
et_core_esc_previously( $this->background_pattern() ), // #9
et_core_esc_previously( $this->background_mask() ) // #10
);
return $output;
+5 -1
View File
@@ -282,6 +282,8 @@ class ET_Builder_Module_Map extends ET_Builder_Module {
'<div%5$s class="%6$s"%8$s%12$s%13$s>
%11$s
%10$s
%14$s
%15$s
<div class="et_pb_map" data-center-lat="%1$s" data-center-lng="%2$s" data-zoom="%3$d" data-mouse-wheel="%7$s" data-mobile-dragging="%9$s"></div>
%4$s
</div>',
@@ -297,7 +299,9 @@ class ET_Builder_Module_Map extends ET_Builder_Module {
$video_background, // #10
$parallax_image_background,
$grayscale_filter_data_tablet,
$grayscale_filter_data_phone
$grayscale_filter_data_phone,
et_core_esc_previously( $this->background_pattern() ), // #14
et_core_esc_previously( $this->background_mask() ) // #15
);
return $output;
+13 -5
View File
@@ -598,8 +598,8 @@ class ET_Builder_Module_Menu extends ET_Builder_Module {
$fields['dropdown_menu_text_color'] = array( 'color' => "%%order_class%%.{$menu_slug} .nav li ul a" );
$fields['dropdown_menu_active_link_color'] = array( 'color' => "%%order_class%%.{$menu_slug} .nav li ul li.current-menu-item a" );
$fields['logo_width'] = array( 'width' => '%%order_class%% .et_pb_menu_inner_container > .et_pb_menu__logo-wrap .et_pb_menu__logo, %%order_class%% .et_pb_menu__logo-slot' );
$fields['logo_max_width'] = array( 'max-width' => '%%order_class%% .et_pb_menu_inner_container > .et_pb_menu__logo-wrap .et_pb_menu__logo, %%order_class%% .et_pb_menu__logo-slot' );
$fields['logo_width'] = array( 'width' => '%%order_class%% .et_pb_menu_inner_container > .et_pb_menu__logo-wrap, %%order_class%% .et_pb_menu__logo-slot' );
$fields['logo_max_width'] = array( 'max-width' => '%%order_class%% .et_pb_menu_inner_container > .et_pb_menu__logo-wrap, %%order_class%% .et_pb_menu__logo-slot' );
$fields['logo_height'] = array( 'height' => '%%order_class%% .et_pb_menu_inner_container > .et_pb_menu__logo-wrap .et_pb_menu__logo img, %%order_class%% .et_pb_menu__logo-slot .et_pb_menu__logo-wrap img' );
$fields['logo_max_height'] = array( 'max-height' => '%%order_class%% .et_pb_menu_inner_container > .et_pb_menu__logo-wrap .et_pb_menu__logo img, %%order_class%% .et_pb_menu__logo-slot .et_pb_menu__logo-wrap img' );
@@ -788,7 +788,7 @@ class ET_Builder_Module_Menu extends ET_Builder_Module {
ET_Builder_Element::set_style( $render_slug, $el_style );
}
$logo_width_selector = '%%order_class%% .et_pb_menu_inner_container > .et_pb_menu__logo-wrap .et_pb_menu__logo, %%order_class%% .et_pb_menu__logo-slot';
$logo_width_selector = '%%order_class%% .et_pb_menu_inner_container > .et_pb_menu__logo-wrap, %%order_class%% .et_pb_menu__logo-slot';
$logo_height_selector = '%%order_class%% .et_pb_menu_inner_container > .et_pb_menu__logo-wrap .et_pb_menu__logo img, %%order_class%% .et_pb_menu__logo-slot .et_pb_menu__logo-wrap img';
// Width.
@@ -1317,6 +1317,8 @@ class ET_Builder_Module_Menu extends ET_Builder_Module {
'<div%4$s class="%3$s"%2$s%7$s>
%6$s
%5$s
%13$s
%14$s
<div class="et_pb_menu_inner_container clearfix">
%8$s
<div class="et_pb_menu__wrap">
@@ -1341,13 +1343,17 @@ class ET_Builder_Module_Menu extends ET_Builder_Module {
et_core_esc_previously( $this->render_cart() ),
et_core_esc_previously( $this->render_search() ),
et_core_esc_previously( $mobile_menu ),
et_core_esc_previously( $this->render_search_form() )
et_core_esc_previously( $this->render_search_form() ),
et_core_esc_previously( $this->background_pattern() ), // #13
et_core_esc_previously( $this->background_mask() ) // #14
);
} else {
$output = sprintf(
'<div%4$s class="%3$s"%2$s%7$s>
%6$s
%5$s
%13$s
%14$s
<div class="et_pb_menu_inner_container clearfix">
%8$s
<div class="et_pb_menu__wrap">
@@ -1372,7 +1378,9 @@ class ET_Builder_Module_Menu extends ET_Builder_Module {
et_core_esc_previously( $this->render_cart() ),
et_core_esc_previously( $this->render_search() ),
et_core_esc_previously( $mobile_menu ),
et_core_esc_previously( $this->render_search_form() )
et_core_esc_previously( $this->render_search_form() ),
et_core_esc_previously( $this->background_pattern() ), // #13
et_core_esc_previously( $this->background_mask() ) // #14
);
}
+5 -1
View File
@@ -231,6 +231,8 @@ class ET_Builder_Module_Number_Counter extends ET_Builder_Module {
'<div%1$s class="%2$s" data-number-value="%3$s" data-number-separator="%7$s"%10$s>
%9$s
%8$s
%12$s
%13$s
<div class="percent" %4$s%11$s><p><span class="percent-value"></span><span class="percent-sign">%5$s</span></p></div>
%6$s
</div>',
@@ -244,7 +246,9 @@ class ET_Builder_Module_Number_Counter extends ET_Builder_Module {
$video_background,
$parallax_image_background,
et_core_esc_previously( $data_background_layout ), // #10
$multi_view_data_attr
$multi_view_data_attr,
et_core_esc_previously( $this->background_pattern() ), // #12
et_core_esc_previously( $this->background_mask() ) // #13
);
return $output;
+14 -5
View File
@@ -351,7 +351,7 @@ class ET_Builder_Module_Portfolio extends ET_Builder_Module_Type_PostBased {
* @return mixed portfolio item data
*/
static function get_portfolio_item( $args = array(), $conditional_tags = array(), $current_page = array() ) {
global $et_fb_processing_shortcode_object, $post;
global $et_fb_processing_shortcode_object, $post, $paged, $__et_portfolio_module_paged;
$global_processing_original_value = $et_fb_processing_shortcode_object;
@@ -382,8 +382,13 @@ class ET_Builder_Module_Portfolio extends ET_Builder_Module_Type_PostBased {
$et_paged = $is_front_page ? get_query_var( 'page' ) : get_query_var( 'paged' );
}
if ( $__et_portfolio_module_paged > 1 ) {
$et_paged = $__et_portfolio_module_paged;
$paged = $__et_portfolio_module_paged; //phpcs:ignore WordPress.Variables.GlobalVariables.OverrideProhibited -- Override with ajax pagination.
$args['paged'] = $__et_portfolio_module_paged;
}
if ( $is_front_page ) {
global $paged;
$paged = $et_paged; // phpcs:ignore WordPress.Variables.GlobalVariables.OverrideProhibited
}
@@ -764,7 +769,7 @@ class ET_Builder_Module_Portfolio extends ET_Builder_Module_Type_PostBased {
'<div class="alignleft">
<a href="%1$s">%2$s</a>
</div>',
esc_url( $portfolio->posts_next['url'] ),
add_query_arg( 'et_portfolio', '', esc_url( $portfolio->posts_next['url'] ) ),
esc_html( $portfolio->posts_next['label'] )
);
}
@@ -774,7 +779,7 @@ class ET_Builder_Module_Portfolio extends ET_Builder_Module_Type_PostBased {
'<div class="alignright">
<a href="%1$s">%2$s</a>
</div>',
esc_url( $portfolio->posts_prev['url'] ),
add_query_arg( 'et_portfolio', '', esc_url( $portfolio->posts_prev['url'] ) ),
esc_html( $portfolio->posts_prev['label'] )
);
}
@@ -851,6 +856,8 @@ class ET_Builder_Module_Portfolio extends ET_Builder_Module_Type_PostBased {
<div class="et_pb_ajax_pagination_container">
%6$s
%5$s
%11$s
%12$s
%7$s
%2$s
%8$s
@@ -866,7 +873,9 @@ class ET_Builder_Module_Portfolio extends ET_Builder_Module_Type_PostBased {
$fullwidth ? '' : '<div class="et_pb_portfolio_grid_items">',
$fullwidth ? '' : '</div>',
isset( $pagination ) ? $pagination : '',
et_core_esc_previously( $data_background_layout ) // #10
et_core_esc_previously( $data_background_layout ), // #10
et_core_esc_previously( $this->background_pattern() ), // #11
et_core_esc_previously( $this->background_mask() ) // #12
);
return $output;
+32 -1
View File
@@ -1023,6 +1023,18 @@ class ET_Builder_Module_Post_Slider extends ET_Builder_Module_Type_PostBased {
$header_level = $this->props['header_level'];
$offset_number = $this->props['offset_number'];
$use_gradient_options = $this->props['use_background_color_gradient'];
$gradient_overlays_image = $this->props['background_color_gradient_overlays_image'];
$background_options = et_pb_background_options();
$gradient_properties = $background_options->get_gradient_properties( $this->props, 'background', '' );
$background_gradient_style = $background_options->get_gradient_style( $gradient_properties );
$is_gradient_on = false;
if ( 'on' === $use_gradient_options && 'on' === $gradient_overlays_image && 'on' === $parallax ) {
$is_gradient_on = '' !== $background_gradient_style;
}
$post_index = 0;
$hide_on_mobile_class = self::HIDE_ON_MOBILE;
$is_text_overlay_applied = 'on' === $use_text_overlay;
@@ -1250,6 +1262,21 @@ class ET_Builder_Module_Post_Slider extends ET_Builder_Module_Type_PostBased {
echo ' et_pb_parallax_css'; }
?>
" style="background-image: url(<?php echo esc_url( $query->posts[ $post_index ]->post_featured_image ); ?>);"<?php echo et_core_esc_previously( $multi_view_attrs_parallax_bg ); ?>></div>
<?php
if ( $is_gradient_on ) {
printf(
'<span class="et_parallax_gradient" style="%1$s%2$s"></span>',
sprintf(
'background-image: %1$s;',
esc_html( $background_gradient_style )
),
( '' !== $background_blend && 'normal' !== $background_blend ) ? sprintf(
'mix-blend-mode: %1$s;',
esc_html( $background_blend )
) : ''
);
}
?>
</div>
<?php } ?>
<?php if ( 'on' === $use_bg_overlay ) { ?>
@@ -1461,6 +1488,8 @@ class ET_Builder_Module_Post_Slider extends ET_Builder_Module_Type_PostBased {
'<div%3$s class="%1$s"%7$s%8$s>
%5$s
%4$s
%9$s
%10$s
<div class="et_pb_slides">
%2$s
</div>
@@ -1474,7 +1503,9 @@ class ET_Builder_Module_Post_Slider extends ET_Builder_Module_Type_PostBased {
$parallax_image_background, // #5
$this->inner_shadow_back_compatibility( $render_slug ),
et_core_esc_previously( $data_background_layout ),
$muti_view_data_attr
$muti_view_data_attr,
et_core_esc_previously( $this->background_pattern() ), // #9
et_core_esc_previously( $this->background_mask() ) // #10
);
return $output;
+5 -1
View File
@@ -722,6 +722,8 @@ class ET_Builder_Module_Post_Title extends ET_Builder_Module {
'<div%3$s class="%2$s" %8$s %9$s %10$s>
%4$s
%7$s
%11$s
%12$s
%5$s
<div class="et_pb_title_container">
%1$s
@@ -737,7 +739,9 @@ class ET_Builder_Module_Post_Title extends ET_Builder_Module {
$video_background,
et_core_esc_previously( $data_background_layout ),
et_core_esc_previously( $data_background_layout_hover ),
et_core_esc_previously( $muti_view_data_attr ) // #10
et_core_esc_previously( $muti_view_data_attr ), // #10
et_core_esc_previously( $this->background_pattern() ), // #11
et_core_esc_previously( $this->background_mask() ) // #12
);
return $output;
@@ -383,6 +383,8 @@ class ET_Builder_Module_Posts_Navigation extends ET_Builder_Module {
<?php
echo et_core_esc_previously( $parallax_image_background );
echo et_core_esc_previously( $video_background );
echo et_core_esc_previously( $this->background_pattern() );
echo et_core_esc_previously( $this->background_mask() );
?>
<span class="meta-nav">&larr; </span><span class="nav-label"<?php $multi_view->render_attrs( array( 'content' => '{{prev_text}}' ), true ); ?>><?php echo esc_html( $posts_navigation['prev']->title ); ?></span>
</a>
@@ -408,6 +410,8 @@ class ET_Builder_Module_Posts_Navigation extends ET_Builder_Module {
<?php
echo et_core_esc_previously( $parallax_image_background );
echo et_core_esc_previously( $video_background );
echo et_core_esc_previously( $this->background_pattern() );
echo et_core_esc_previously( $this->background_mask() );
?>
<span class="nav-label"<?php $multi_view->render_attrs( array( 'content' => '{{next_text}}' ), true ); ?>><?php echo esc_html( $posts_navigation['next']->title ); ?></span><span class="meta-nav"> &rarr;</span>
</a>
+5 -1
View File
@@ -828,6 +828,8 @@ class ET_Builder_Module_Pricing_Tables extends ET_Builder_Module {
'<div%3$s class="%2$s"%6$s>
%5$s
%4$s
%7$s
%8$s
<div class="et_pb_pricing_table_wrap">
%1$s
</div>
@@ -837,7 +839,9 @@ class ET_Builder_Module_Pricing_Tables extends ET_Builder_Module {
$this->module_id(),
$video_background,
$parallax_image_background,
$multi_view_data_attr
$multi_view_data_attr,
et_core_esc_previously( $this->background_pattern() ), // #7
et_core_esc_previously( $this->background_mask() ) // #8
);
$output .= $this->keep_box_shadow_compatibility( $attrs, $content, $render_slug );
@@ -92,8 +92,8 @@ class ET_Builder_Module_Pricing_Tables_Item extends ET_Builder_Module {
'body' => array(
'label' => et_builder_i18n( 'Body' ),
'css' => array(
'main' => "{$this->main_css_element} .et_pb_pricing li",
'limited_main' => "{$this->main_css_element} .et_pb_pricing li, {$this->main_css_element} .et_pb_pricing li span, {$this->main_css_element} .et_pb_pricing li a",
'main' => "{$this->main_css_element} ul.et_pb_pricing li",
'limited_main' => "{$this->main_css_element} ul.et_pb_pricing li, {$this->main_css_element} ul.et_pb_pricing li span, {$this->main_css_element} ul.et_pb_pricing li a",
),
'line_height' => array(
'range_settings' => array(
@@ -140,7 +140,7 @@ class ET_Builder_Module_Pricing_Tables_Item extends ET_Builder_Module {
'currency_frequency' => array(
'label' => esc_html__( 'Currency &amp; Frequency', 'et_builder' ),
'css' => array(
'main' => "{$this->main_css_element} .et_pb_dollar_sign, {$this->main_css_element} .et_pb_frequency",
'main' => "{$this->main_css_element} .et_pb_et_price .et_pb_dollar_sign, {$this->main_css_element} .et_pb_et_price .et_pb_frequency",
),
'hide_text_align' => true,
),
@@ -646,6 +646,8 @@ class ET_Builder_Module_Pricing_Tables_Item extends ET_Builder_Module {
'<div class="%1$s">
%10$s
%9$s
%11$s
%12$s
<div class="et_pb_pricing_heading">
%2$s
%3$s
@@ -667,7 +669,9 @@ class ET_Builder_Module_Pricing_Tables_Item extends ET_Builder_Module {
et_core_esc_previously( $sum ),
et_core_esc_previously( $per ),
$video_background,
$parallax_image_background
$parallax_image_background,
et_core_esc_previously( $this->background_pattern() ), // #11
et_core_esc_previously( $this->background_mask() ) // #12
);
return $output;
+6 -2
View File
@@ -61,7 +61,7 @@ class ET_Builder_Module_Search extends ET_Builder_Module {
),
'background' => array(
'css' => array(
'main' => "{$this->main_css_element} input.et_pb_s",
'main' => "{$this->main_css_element} .et_pb_searchform",
),
),
'borders' => array(
@@ -397,6 +397,8 @@ class ET_Builder_Module_Search extends ET_Builder_Module {
'<div%3$s class="%2$s"%12$s%13$s>
%11$s
%10$s
%14$s
%15$s
<form role="search" method="get" class="et_pb_searchform" action="%1$s">
<div>
<label class="screen-reader-text" for="s">%8$s</label>
@@ -421,7 +423,9 @@ class ET_Builder_Module_Search extends ET_Builder_Module {
$video_background, // #10
$parallax_image_background,
et_core_esc_previously( $data_background_layout ),
$multi_view_show_button_data_attr
$multi_view_show_button_data_attr,
et_core_esc_previously( $this->background_pattern() ), // #14
et_core_esc_previously( $this->background_mask() ) // #15
);
return $output;
+5 -1
View File
@@ -242,6 +242,8 @@ class ET_Builder_Module_Sidebar extends ET_Builder_Module {
'<div%3$s class="%2$s"%6$s>
%5$s
%4$s
%7$s
%8$s
%1$s
</div>',
$widgets,
@@ -249,7 +251,9 @@ class ET_Builder_Module_Sidebar extends ET_Builder_Module {
$this->module_id(),
$video_background,
$parallax_image_background, // #5
et_core_esc_previously( $data_background_layout )
et_core_esc_previously( $data_background_layout ),
et_core_esc_previously( $this->background_pattern() ), // #7
et_core_esc_previously( $this->background_mask() ) // #8
);
return $output;
+5 -1
View File
@@ -1245,6 +1245,8 @@ class ET_Builder_Module_Signup extends ET_Builder_Module_Type_WithSpamProtection
'<div%5$s class="%3$s"%4$s%8$s%9$s%10$s%11$s>
%7$s
%6$s
%12$s
%13$s
%1$s
%2$s
</div>',
@@ -1258,7 +1260,9 @@ class ET_Builder_Module_Signup extends ET_Builder_Module_Type_WithSpamProtection
$success_redirect_url,
$success_redirect_query,
et_core_esc_previously( $data_background_layout ), // #10,
$wrapper_multi_view_classes
$wrapper_multi_view_classes,
et_core_esc_previously( $this->background_pattern() ), // #12
et_core_esc_previously( $this->background_mask() ) // #13
);
return $output;
+198 -22
View File
@@ -489,7 +489,7 @@ class ET_Builder_Module_Slider extends ET_Builder_Module {
$dot_nav_custom_color_tablet = isset( $dot_nav_custom_color_values['tablet'] ) ? $dot_nav_custom_color_values['tablet'] : '';
$dot_nav_custom_color_phone = isset( $dot_nav_custom_color_values['phone'] ) ? $dot_nav_custom_color_values['phone'] : '';
// Pass Slider Module setting to Slide Item
// Pass Slider Module setting to Slide Item.
global $et_pb_slider;
$et_pb_slider = array(
@@ -504,43 +504,121 @@ class ET_Builder_Module_Slider extends ET_Builder_Module {
'background_color_tablet' => $this->props['background_color_tablet'],
'background_color_phone' => $this->props['background_color_phone'],
'background_color__hover' => isset( $this->props['background_color__hover'] ) ? $this->props['background_color__hover'] : '',
// Background Gradient.
'use_background_color_gradient' => $this->props['use_background_color_gradient'],
'use_background_color_gradient_tablet' => $this->props['use_background_color_gradient_tablet'],
'use_background_color_gradient_phone' => $this->props['use_background_color_gradient_phone'],
'use_background_color_gradient__hover' => isset( $this->props['use_background_color_gradient__hover'] ) ? $this->props['use_background_color_gradient__hover'] : '',
'use_background_color_gradient__hover' => isset( $this->props['use_background_color_gradient__hover'] )
? $this->props['use_background_color_gradient__hover']
: '',
'background_color_gradient_repeat' => isset( $this->props['background_color_gradient_repeat'] )
? $this->props['background_color_gradient_repeat']
: '',
'background_color_gradient_repeat_tablet' => isset( $this->props['background_color_gradient_repeat_tablet'] )
? $this->props['background_color_gradient_repeat_tablet']
: '',
'background_color_gradient_repeat_phone' => isset( $this->props['background_color_gradient_repeat_phone'] )
? $this->props['background_color_gradient_repeat_phone']
: '',
'background_color_gradient_repeat__hover' => isset( $this->props['background_color_gradient_repeat__hover'] )
? $this->props['background_color_gradient_repeat__hover']
: '',
'background_color_gradient_repeat__sticky' => isset( $this->props['background_color_gradient_repeat__sticky'] )
? $this->props['background_color_gradient_repeat__sticky']
: '',
'background_color_gradient_type' => $this->props['background_color_gradient_type'],
'background_color_gradient_type_tablet' => $this->props['background_color_gradient_type_tablet'],
'background_color_gradient_type_phone' => $this->props['background_color_gradient_type_phone'],
'background_color_gradient_type__hover' => isset( $this->props['background_color_gradient_type__hover'] ) ? $this->props['background_color_gradient_type__hover'] : '',
'background_color_gradient_type__hover' => isset( $this->props['background_color_gradient_type__hover'] )
? $this->props['background_color_gradient_type__hover']
: '',
'background_color_gradient_direction' => $this->props['background_color_gradient_direction'],
'background_color_gradient_direction_tablet' => $this->props['background_color_gradient_direction_tablet'],
'background_color_gradient_direction_phone' => $this->props['background_color_gradient_direction_phone'],
'background_color_gradient_direction__hover' => isset( $this->props['background_color_gradient_direction__hover'] ) ? $this->props['background_color_gradient_direction__hover'] : '',
'background_color_gradient_direction__hover' => isset( $this->props['background_color_gradient_direction__hover'] )
? $this->props['background_color_gradient_direction__hover']
: '',
'background_color_gradient_direction_radial' => $this->props['background_color_gradient_direction_radial'],
'background_color_gradient_direction_radial_tablet' => $this->props['background_color_gradient_direction_radial_tablet'],
'background_color_gradient_direction_radial_phone' => $this->props['background_color_gradient_direction_radial_phone'],
'background_color_gradient_direction_radial__hover' => isset( $this->props['background_color_gradient_direction_radial__hover'] ) ? $this->props['background_color_gradient_direction_radial__hover'] : '',
'background_color_gradient_start' => $this->props['background_color_gradient_start'],
'background_color_gradient_start_tablet' => $this->props['background_color_gradient_start_tablet'],
'background_color_gradient_start_phone' => $this->props['background_color_gradient_start_phone'],
'background_color_gradient_start__hover' => isset( $this->props['background_color_gradient_start__hover'] ) ? $this->props['background_color_gradient_start__hover'] : '',
'background_color_gradient_end' => $this->props['background_color_gradient_end'],
'background_color_gradient_end_tablet' => $this->props['background_color_gradient_end_tablet'],
'background_color_gradient_end_phone' => $this->props['background_color_gradient_end_phone'],
'background_color_gradient_end__hover' => isset( $this->props['background_color_gradient_end__hover'] ) ? $this->props['background_color_gradient_end__hover'] : '',
'background_color_gradient_start_position' => $this->props['background_color_gradient_start_position'],
'background_color_gradient_start_position_tablet' => $this->props['background_color_gradient_start_position_tablet'],
'background_color_gradient_start_position_phone' => $this->props['background_color_gradient_start_position_phone'],
'background_color_gradient_start_position__hover' => isset( $this->props['background_color_gradient_start_position__hover'] ) ? $this->props['background_color_gradient_start_position__hover'] : '',
'background_color_gradient_end_position' => $this->props['background_color_gradient_end_position'],
'background_color_gradient_end_position_tablet' => $this->props['background_color_gradient_end_position_tablet'],
'background_color_gradient_end_position_phone' => $this->props['background_color_gradient_end_position_phone'],
'background_color_gradient_end_position__hover' => isset( $this->props['background_color_gradient_end_position__hover'] ) ? $this->props['background_color_gradient_end_position__hover'] : '',
'background_color_gradient_direction_radial__hover' => isset( $this->props['background_color_gradient_direction_radial__hover'] )
? $this->props['background_color_gradient_direction_radial__hover']
: '',
'background_color_gradient_stops' => $this->props['background_color_gradient_stops'],
'background_color_gradient_stops_tablet' => $this->props['background_color_gradient_stops_tablet'],
'background_color_gradient_stops_phone' => $this->props['background_color_gradient_stops_phone'],
'background_color_gradient_stops__hover' => isset( $this->props['background_color_gradient_stops__hover'] )
? $this->props['background_color_gradient_stops__hover']
: '',
'background_color_gradient_stops__sticky' => isset( $this->props['background_color_gradient_stops__sticky'] )
? $this->props['background_color_gradient_stops__sticky']
: '',
'background_color_gradient_overlays_image' => $this->props['background_color_gradient_overlays_image'],
'background_color_gradient_overlays_image_tablet' => $this->props['background_color_gradient_overlays_image_tablet'],
'background_color_gradient_overlays_image_phone' => $this->props['background_color_gradient_overlays_image_phone'],
'background_color_gradient_overlays_image__hover' => isset( $this->props['background_color_gradient_overlays_image__hover'] ) ? $this->props['background_color_gradient_overlays_image__hover'] : '',
'background_color_gradient_overlays_image__hover' => isset( $this->props['background_color_gradient_overlays_image__hover'] )
? $this->props['background_color_gradient_overlays_image__hover']
: '',
'background_color_gradient_start' => isset( $this->props['background_color_gradient_start'] )
? $this->props['background_color_gradient_start']
: '',
'background_color_gradient_start_tablet' => isset( $this->props['background_color_gradient_start_tablet'] )
? $this->props['background_color_gradient_start_tablet']
: '',
'background_color_gradient_start_phone' => isset( $this->props['background_color_gradient_start_phone'] )
? $this->props['background_color_gradient_start_phone']
: '',
'background_color_gradient_start__hover' => isset( $this->props['background_color_gradient_start__hover'] )
? $this->props['background_color_gradient_start__hover']
: '',
'background_color_gradient_end' => isset( $this->props['background_color_gradient_end'] )
? $this->props['background_color_gradient_end']
: '',
'background_color_gradient_end_tablet' => isset( $this->props['background_color_gradient_end_tablet'] )
? $this->props['background_color_gradient_end_tablet']
: '',
'background_color_gradient_end_phone' => isset( $this->props['background_color_gradient_end_phone'] )
? $this->props['background_color_gradient_end_phone']
: '',
'background_color_gradient_end__hover' => isset( $this->props['background_color_gradient_end__hover'] )
? $this->props['background_color_gradient_end__hover']
: '',
'background_color_gradient_start_position' => isset( $this->props['background_color_gradient_start_position'] )
? $this->props['background_color_gradient_start_position']
: '',
'background_color_gradient_start_position_tablet' => isset( $this->props['background_color_gradient_start_position_tablet'] )
? $this->props['background_color_gradient_start_position_tablet']
: '',
'background_color_gradient_start_position_phone' => isset( $this->props['background_color_gradient_start_position_phone'] )
? $this->props['background_color_gradient_start_position_phone']
: '',
'background_color_gradient_start_position__hover' => isset( $this->props['background_color_gradient_start_position__hover'] )
? $this->props['background_color_gradient_start_position__hover']
: '',
'background_color_gradient_end_position' => isset( $this->props['background_color_gradient_end_position'] )
? $this->props['background_color_gradient_end_position']
: '',
'background_color_gradient_end_position_tablet' => isset( $this->props['background_color_gradient_end_position_tablet'] )
? $this->props['background_color_gradient_end_position_tablet']
: '',
'background_color_gradient_end_position_phone' => isset( $this->props['background_color_gradient_end_position_phone'] )
? $this->props['background_color_gradient_end_position_phone']
: '',
'background_color_gradient_end_position__hover' => isset( $this->props['background_color_gradient_end_position__hover'] )
? $this->props['background_color_gradient_end_position__hover']
: '',
// Background Image.
'background_enable_image' => $this->props['background_enable_image'],
'background_enable_image_tablet' => $this->props['background_enable_image_tablet'],
@@ -599,6 +677,104 @@ class ET_Builder_Module_Slider extends ET_Builder_Module {
'background_video_height_tablet' => $this->props['background_video_height_tablet'],
'background_video_height_phone' => $this->props['background_video_height_phone'],
'background_video_height__hover' => isset( $this->props['background_video_height__hover'] ) ? $this->props['background_video_height__hover'] : '',
// Background Pattern.
'background_pattern_style' => $this->props['background_pattern_style'],
'background_pattern_style_tablet' => $this->props['background_pattern_style_tablet'],
'background_pattern_style_phone' => $this->props['background_pattern_style_phone'],
'background_pattern_style__hover' => isset( $this->props['background_pattern_style__hover'] ) ? $this->props['background_pattern_style__hover'] : '',
'background_pattern_color' => $this->props['background_pattern_color'],
'background_pattern_color_tablet' => $this->props['background_pattern_color_tablet'],
'background_pattern_color_phone' => $this->props['background_pattern_color_phone'],
'background_pattern_color__hover' => isset( $this->props['background_pattern_color__hover'] ) ? $this->props['background_pattern_color__hover'] : '',
'background_pattern_transform' => $this->props['background_pattern_transform'],
'background_pattern_transform_tablet' => $this->props['background_pattern_transform_tablet'],
'background_pattern_transform_phone' => $this->props['background_pattern_transform_phone'],
'background_pattern_transform__hover' => isset( $this->props['background_pattern_transform__hover'] ) ? $this->props['background_pattern_transform__hover'] : '',
'background_pattern_size' => $this->props['background_pattern_size'],
'background_pattern_size_tablet' => $this->props['background_pattern_size_tablet'],
'background_pattern_size_phone' => $this->props['background_pattern_size_phone'],
'background_pattern_size__hover' => isset( $this->props['background_pattern_size__hover'] ) ? $this->props['background_pattern_size__hover'] : '',
'background_pattern_width' => $this->props['background_pattern_width'],
'background_pattern_width_tablet' => $this->props['background_pattern_width_tablet'],
'background_pattern_width_phone' => $this->props['background_pattern_width_phone'],
'background_pattern_width__hover' => isset( $this->props['background_pattern_width__hover'] ) ? $this->props['background_pattern_width__hover'] : '',
'background_pattern_height' => $this->props['background_pattern_height'],
'background_pattern_height_tablet' => $this->props['background_pattern_height_tablet'],
'background_pattern_height_phone' => $this->props['background_pattern_height_phone'],
'background_pattern_height__hover' => isset( $this->props['background_pattern_height__hover'] ) ? $this->props['background_pattern_height__hover'] : '',
'background_pattern_repeat_origin' => $this->props['background_pattern_repeat_origin'],
'background_pattern_repeat_origin_tablet' => $this->props['background_pattern_repeat_origin_tablet'],
'background_pattern_repeat_origin_phone' => $this->props['background_pattern_repeat_origin_phone'],
'background_pattern_repeat_origin__hover' => isset( $this->props['background_pattern_repeat_origin__hover'] ) ? $this->props['background_pattern_repeat_origin__hover'] : '',
'background_pattern_horizontal_offset' => $this->props['background_pattern_horizontal_offset'],
'background_pattern_horizontal_offset_tablet' => $this->props['background_pattern_horizontal_offset_tablet'],
'background_pattern_horizontal_offset_phone' => $this->props['background_pattern_horizontal_offset_phone'],
'background_pattern_horizontal_offset__hover' => isset( $this->props['background_pattern_horizontal_offset__hover'] ) ? $this->props['background_pattern_horizontal_offset__hover'] : '',
'background_pattern_vertical_offset' => $this->props['background_pattern_vertical_offset'],
'background_pattern_vertical_offset_tablet' => $this->props['background_pattern_vertical_offset_tablet'],
'background_pattern_vertical_offset_phone' => $this->props['background_pattern_vertical_offset_phone'],
'background_pattern_vertical_offset__hover' => isset( $this->props['background_pattern_vertical_offset__hover'] ) ? $this->props['background_pattern_vertical_offset__hover'] : '',
'background_pattern_repeat' => $this->props['background_pattern_repeat'],
'background_pattern_repeat_tablet' => $this->props['background_pattern_repeat_tablet'],
'background_pattern_repeat_phone' => $this->props['background_pattern_repeat_phone'],
'background_pattern_repeat__hover' => isset( $this->props['background_pattern_repeat__hover'] ) ? $this->props['background_pattern_repeat__hover'] : '',
'background_pattern_blend_mode' => $this->props['background_pattern_blend_mode'],
'background_pattern_blend_mode_tablet' => $this->props['background_pattern_blend_mode_tablet'],
'background_pattern_blend_mode_phone' => $this->props['background_pattern_blend_mode_phone'],
'background_pattern_blend_mode__hover' => isset( $this->props['background_pattern_blend_mode__hover'] ) ? $this->props['background_pattern_blend_mode__hover'] : '',
'background_enable_pattern_style' => $this->props['background_enable_pattern_style'],
'background_enable_pattern_style_tablet' => $this->props['background_enable_pattern_style_tablet'],
'background_enable_pattern_style_phone' => $this->props['background_enable_pattern_style_phone'],
'background_enable_pattern_style__hover' => isset( $this->props['background_enable_pattern_style__hover'] ) ? $this->props['background_enable_pattern_style__hover'] : '',
// Background Mask.
'background_mask_style' => $this->props['background_mask_style'],
'background_mask_style_tablet' => $this->props['background_mask_style_tablet'],
'background_mask_style_phone' => $this->props['background_mask_style_phone'],
'background_mask_style__hover' => isset( $this->props['background_mask_style__hover'] ) ? $this->props['background_mask_style__hover'] : '',
'background_mask_color' => $this->props['background_mask_color'],
'background_mask_color_tablet' => $this->props['background_mask_color_tablet'],
'background_mask_color_phone' => $this->props['background_mask_color_phone'],
'background_mask_color__hover' => isset( $this->props['background_mask_color__hover'] ) ? $this->props['background_mask_color__hover'] : '',
'background_mask_transform' => $this->props['background_mask_transform'],
'background_mask_transform_tablet' => $this->props['background_mask_transform_tablet'],
'background_mask_transform_phone' => $this->props['background_mask_transform_phone'],
'background_mask_transform__hover' => isset( $this->props['background_mask_transform__hover'] ) ? $this->props['background_mask_transform__hover'] : '',
'background_mask_aspect_ratio' => $this->props['background_mask_aspect_ratio'],
'background_mask_aspect_ratio_tablet' => $this->props['background_mask_aspect_ratio_tablet'],
'background_mask_aspect_ratio_phone' => $this->props['background_mask_aspect_ratio_phone'],
'background_mask_aspect_ratio__hover' => isset( $this->props['background_mask_aspect_ratio__hover'] ) ? $this->props['background_mask_aspect_ratio__hover'] : '',
'background_mask_size' => $this->props['background_mask_size'],
'background_mask_size_tablet' => $this->props['background_mask_size_tablet'],
'background_mask_size_phone' => $this->props['background_mask_size_phone'],
'background_mask_size__hover' => isset( $this->props['background_mask_size__hover'] ) ? $this->props['background_mask_size__hover'] : '',
'background_mask_width' => $this->props['background_mask_width'],
'background_mask_width_tablet' => $this->props['background_mask_width_tablet'],
'background_mask_width_phone' => $this->props['background_mask_width_phone'],
'background_mask_width__hover' => isset( $this->props['background_mask_width__hover'] ) ? $this->props['background_mask_width__hover'] : '',
'background_mask_height' => $this->props['background_mask_height'],
'background_mask_height_tablet' => $this->props['background_mask_height_tablet'],
'background_mask_height_phone' => $this->props['background_mask_height_phone'],
'background_mask_height__hover' => isset( $this->props['background_mask_height__hover'] ) ? $this->props['background_mask_height__hover'] : '',
'background_mask_position' => $this->props['background_mask_position'],
'background_mask_position_tablet' => $this->props['background_mask_position_tablet'],
'background_mask_position_phone' => $this->props['background_mask_position_phone'],
'background_mask_position__hover' => isset( $this->props['background_mask_position__hover'] ) ? $this->props['background_mask_position__hover'] : '',
'background_mask_horizontal_offset' => $this->props['background_mask_horizontal_offset'],
'background_mask_horizontal_offset_tablet' => $this->props['background_mask_horizontal_offset_tablet'],
'background_mask_horizontal_offset_phone' => $this->props['background_mask_horizontal_offset_phone'],
'background_mask_horizontal_offset__hover' => isset( $this->props['background_mask_horizontal_offset__hover'] ) ? $this->props['background_mask_horizontal_offset__hover'] : '',
'background_mask_vertical_offset' => $this->props['background_mask_vertical_offset'],
'background_mask_vertical_offset_tablet' => $this->props['background_mask_vertical_offset_tablet'],
'background_mask_vertical_offset_phone' => $this->props['background_mask_vertical_offset_phone'],
'background_mask_vertical_offset__hover' => isset( $this->props['background_mask_vertical_offset__hover'] ) ? $this->props['background_mask_vertical_offset__hover'] : '',
'background_mask_blend_mode' => $this->props['background_mask_blend_mode'],
'background_mask_blend_mode_tablet' => $this->props['background_mask_blend_mode_tablet'],
'background_mask_blend_mode_phone' => $this->props['background_mask_blend_mode_phone'],
'background_mask_blend_mode__hover' => isset( $this->props['background_mask_blend_mode__hover'] ) ? $this->props['background_mask_blend_mode__hover'] : '',
'background_enable_mask_style' => $this->props['background_enable_mask_style'],
'background_enable_mask_style_tablet' => $this->props['background_enable_mask_style_tablet'],
'background_enable_mask_style_phone' => $this->props['background_enable_mask_style_phone'],
'background_enable_mask_style__hover' => isset( $this->props['background_enable_mask_style__hover'] ) ? $this->props['background_enable_mask_style__hover'] : '',
'header_level' => $this->props['header_level'],
'use_bg_overlay' => $this->props['use_bg_overlay'],
'bg_overlay_color' => $bg_overlay_color,
+7 -1
View File
@@ -755,6 +755,8 @@ class ET_Builder_Module_Slider_Item extends ET_Builder_Module {
$header_level = $this->props['header_level'];
$video_background = $this->video_background();
$parallax_image_background = $this->get_parallax_image_background();
$pattern_background = $this->background_pattern();
$mask_background = $this->background_mask();
$background_color = $this->get_slider_item_background_color();
$custom_icon_values = et_pb_responsive_options()->get_property_values( $this->props, 'button_icon' );
$custom_icon = isset( $custom_icon_values['desktop'] ) ? $custom_icon_values['desktop'] : '';
@@ -1111,6 +1113,8 @@ class ET_Builder_Module_Slider_Item extends ET_Builder_Module {
</div>
</div>
%5$s
%13$s
%14$s
</div>
',
$slide_content,
@@ -1124,7 +1128,9 @@ class ET_Builder_Module_Slider_Item extends ET_Builder_Module {
'on' === $use_bg_overlay ? '<div class="et_pb_slide_overlay_container"></div>' : '',
et_core_esc_previously( $data_background_layout ), // #10
self::get_module_order_class( $render_slug ),
$multi_view_classes
$multi_view_classes,
et_core_esc_previously( $pattern_background ), // #13
et_core_esc_previously( $mask_background ) // #14
);
return $output;
@@ -340,6 +340,8 @@ class ET_Builder_Module_Social_Media_Follow extends ET_Builder_Module {
'<ul%3$s class="%2$s"%6$s%7$s>
%5$s
%4$s
%8$s
%9$s
%1$s
</ul>',
$this->content,
@@ -348,7 +350,9 @@ class ET_Builder_Module_Social_Media_Follow extends ET_Builder_Module {
$video_background,
$parallax_image_background, // #5
et_core_esc_previously( $data_background_layout ),
et_core_esc_previously( $muti_view_data_attr )
et_core_esc_previously( $muti_view_data_attr ),
et_core_esc_previously( $this->background_pattern() ), // #8
et_core_esc_previously( $this->background_mask() ) // #9
);
return $output;
+8 -2
View File
@@ -58,7 +58,9 @@ class ET_Builder_Module_Tabs extends ET_Builder_Module {
),
'background' => array(
'css' => array(
'main' => "{$this->main_css_element} .et_pb_all_tabs",
'main' => "{$this->main_css_element} .et_pb_all_tabs",
'mask' => "{$this->main_css_element} > .et_pb_background_mask",
'pattern' => "{$this->main_css_element} > .et_pb_background_pattern",
),
'settings' => array(
'color' => 'alpha',
@@ -276,6 +278,8 @@ class ET_Builder_Module_Tabs extends ET_Builder_Module {
'<div%3$s class="%4$s" %7$s>
%6$s
%5$s
%8$s
%9$s
<ul class="et_pb_tabs_controls clearfix">
%1$s
</ul>
@@ -289,7 +293,9 @@ class ET_Builder_Module_Tabs extends ET_Builder_Module {
$this->module_classname( $render_slug ),
$video_background,
$parallax_image_background,
/* 7$s */ 'et_pb_wc_tabs' === $render_slug ? $this->get_multi_view_attrs() : ''
/* 7$s */ 'et_pb_wc_tabs' === $render_slug ? $this->get_multi_view_attrs() : '',
et_core_esc_previously( $this->background_pattern() ), // #8
et_core_esc_previously( $this->background_mask() ) // #9
);
return $output;
+5 -1
View File
@@ -215,12 +215,16 @@ class ET_Builder_Module_Tabs_Item extends ET_Builder_Module {
'<div class="%2$s">
%4$s
%3$s
%5$s
%6$s
%1$s
</div>',
$content,
$this->module_classname( $render_slug ),
$video_background,
$parallax_image_background
$parallax_image_background,
et_core_esc_previously( $this->background_pattern() ), // #5
et_core_esc_previously( $this->background_mask() ) // #6
);
return $output;
+5 -1
View File
@@ -532,6 +532,8 @@ class ET_Builder_Module_Team_Member extends ET_Builder_Module {
'<div%3$s class="%4$s"%10$s%11$s>
%9$s
%8$s
%12$s
%13$s
%2$s
<div class="et_pb_team_member_description">
%5$s
@@ -550,7 +552,9 @@ class ET_Builder_Module_Team_Member extends ET_Builder_Module {
$video_background,
$parallax_image_background,
et_core_esc_previously( $data_background_layout ), // #10
et_core_esc_previously( $muti_view_data_attr )
et_core_esc_previously( $muti_view_data_attr ),
et_core_esc_previously( $this->background_pattern() ), // #12
et_core_esc_previously( $this->background_mask() ) // #13
);
return $output;
+6 -2
View File
@@ -40,7 +40,7 @@ class ET_Builder_Module_Testimonial extends ET_Builder_Module {
'body' => array(
'label' => et_builder_i18n( 'Body' ),
'css' => array(
'main' => "{$this->main_css_element} *",
'main' => "{$this->main_css_element} .et_pb_testimonial_content",
),
'hide_text_shadow' => true,
'block_elements' => array(
@@ -712,6 +712,8 @@ class ET_Builder_Module_Testimonial extends ET_Builder_Module {
'<div%3$s class="%4$s"%10$s%11$s>
%9$s
%8$s
%12$s
%13$s
%7$s
<div class="et_pb_testimonial_description">
<div class="et_pb_testimonial_description_inner">%1$s</div>
@@ -729,7 +731,9 @@ class ET_Builder_Module_Testimonial extends ET_Builder_Module {
$video_background,
$parallax_image_background,
et_core_esc_previously( $data_background_layout ), // #10
et_core_esc_previously( $multi_view_icon_off_data_attr )
et_core_esc_previously( $multi_view_icon_off_data_attr ),
et_core_esc_previously( $this->background_pattern() ), // #12
et_core_esc_previously( $this->background_mask() ) // #13
);
return $output;
+5 -1
View File
@@ -606,6 +606,8 @@ class ET_Builder_Module_Text extends ET_Builder_Module {
'<div%3$s class="%2$s"%6$s>
%5$s
%4$s
%7$s
%8$s
%1$s
</div>',
$content,
@@ -613,7 +615,9 @@ class ET_Builder_Module_Text extends ET_Builder_Module {
$this->module_id(),
$video_background,
$parallax_image_background, // #5
et_core_esc_previously( $data_background_layout )
et_core_esc_previously( $data_background_layout ),
et_core_esc_previously( $this->background_pattern() ), // #7
et_core_esc_previously( $this->background_mask() ) // #8
);
return $output;
+5 -1
View File
@@ -623,6 +623,8 @@ class ET_Builder_Module_Toggle extends ET_Builder_Module {
'<div%4$s class="%2$s">
%6$s
%5$s
%8$s
%9$s
%1$s
<div class="et_pb_toggle_content clearfix"%7$s>%3$s</div>
</div>',
@@ -632,7 +634,9 @@ class ET_Builder_Module_Toggle extends ET_Builder_Module {
$this->module_id(),
$video_background, // #5
$parallax_image_background,
et_core_esc_previously( $multi_view_content )
et_core_esc_previously( $multi_view_content ),
et_core_esc_previously( $this->background_pattern() ), // #8
et_core_esc_previously( $this->background_mask() ) // #9
);
return $output;
+5 -1
View File
@@ -443,6 +443,8 @@ class ET_Builder_Module_Video extends ET_Builder_Module {
'<div%2$s class="%3$s">
%6$s
%5$s
%7$s
%8$s
%1$s
%4$s
</div>',
@@ -451,7 +453,9 @@ class ET_Builder_Module_Video extends ET_Builder_Module {
$this->module_classname( $render_slug ),
$muti_view_video_overlay,
$video_background,
$parallax_image_background
$parallax_image_background,
et_core_esc_previously( $this->background_pattern() ), // #7
et_core_esc_previously( $this->background_mask() ) // #8
);
return $output;
+5 -1
View File
@@ -361,6 +361,8 @@ class ET_Builder_Module_Video_Slider extends ET_Builder_Module {
'<div%3$s class="%4$s">
%6$s
%5$s
%8$s
%9$s
<div class="et_pb_slider et_pb_preload%1$s"%7$s>
<div class="et_pb_slides">
%2$s
@@ -374,7 +376,9 @@ class ET_Builder_Module_Video_Slider extends ET_Builder_Module {
$this->module_classname( $render_slug ),
$video_background,
$parallax_image_background,
$multi_view_data_attr
$multi_view_data_attr,
et_core_esc_previously( $this->background_pattern() ), // #8
et_core_esc_previously( $this->background_mask() ) // #9
);
return $output;
+25 -21
View File
@@ -62,15 +62,17 @@ class ET_Builder_Module_Field_Border extends ET_Builder_Module_Field_Base {
if ( $template->is_enabled() && ! $template->has( 'border' ) ) {
$template_placeholders = $template->placeholders(
array(
'suffix' => null,
'label_prefix' => null,
'tab_slug' => null,
'toggle_slug' => null,
'color_type' => null,
'depends_on' => null,
'depends_show_if' => null,
'sub_toggle' => null,
'defaults' => array(
'suffix' => null,
'label_prefix' => null,
'tab_slug' => null,
'toggle_slug' => null,
'color_type' => null,
'depends_on' => null,
'depends_show_if_not' => null,
'depends_show_if' => null,
'use_radius' => null,
'sub_toggle' => null,
'defaults' => array(
'border_radii' => null,
'border_styles' => array(
'width' => null,
@@ -98,16 +100,17 @@ class ET_Builder_Module_Field_Border extends ET_Builder_Module_Field_Base {
public function get_fields( array $args = array(), $return_template_id = false ) {
$settings = shortcode_atts(
array(
'suffix' => '',
'label_prefix' => '',
'tab_slug' => 'advanced',
'toggle_slug' => 'border',
'color_type' => 'color-alpha',
'depends_on' => null,
'depends_show_if' => null,
'sub_toggle' => null,
'use_radius' => true,
'defaults' => array(
'suffix' => '',
'label_prefix' => '',
'tab_slug' => 'advanced',
'toggle_slug' => 'border',
'color_type' => 'color-alpha',
'depends_on' => null,
'depends_show_if_not' => null,
'depends_show_if' => null,
'sub_toggle' => null,
'use_radius' => true,
'defaults' => array(
'border_radii' => 'on||||',
'border_styles' => array(
'width' => '0px',
@@ -426,8 +429,9 @@ class ET_Builder_Module_Field_Border extends ET_Builder_Module_Field_Base {
// Add options dependency
if ( ! is_null( $settings['depends_on'] ) ) {
foreach ( $additional_options as &$option ) {
$option['depends_on'] = $settings['depends_on'];
$option['depends_show_if'] = $settings['depends_show_if'];
$option['depends_on'] = $settings['depends_on'];
$option['depends_show_if'] = $settings['depends_show_if'];
$option['depends_show_if_not'] = $settings['depends_show_if_not'];
}
}
@@ -36,6 +36,9 @@ require_once __DIR__ . '/display-conditions/Cookie.php';
require_once __DIR__ . '/display-conditions/CategoryPage.php';
require_once __DIR__ . '/display-conditions/TagPage.php';
require_once __DIR__ . '/display-conditions/NumberOfViews.php';
require_once __DIR__ . '/display-conditions/CustomField.php';
require_once __DIR__ . '/display-conditions/UrlParameter.php';
require_once __DIR__ . '/display-conditions/ProductStock.php';
/**
* Import class dependencies
@@ -72,6 +75,9 @@ class ET_Builder_Module_Field_DisplayConditions extends ET_Builder_Module_Field_
use CategoryPageCondition;
use TagPageCondition;
use NumberOfViewsCondition;
use CustomFieldCondition;
use UrlParameterCondition;
use ProductStockCondition;
/**
* Custom current date.
@@ -157,11 +163,6 @@ class ET_Builder_Module_Field_DisplayConditions extends ET_Builder_Module_Field_
* @return boolean Conditions final result.
*/
public function is_displayable( $display_conditions, $only_return_status = false ) {
// Bail out and just display the module if below WordPress 5.3.
if ( version_compare( get_bloginfo( 'version' ), '5.3', '<' ) ) {
return true;
}
// Bail out and just display the module if $display_conditions is not array.
if ( ! is_array( $display_conditions ) ) {
return true;
@@ -290,6 +291,15 @@ class ET_Builder_Module_Field_DisplayConditions extends ET_Builder_Module_Field_
case 'numberOfViews':
return $this->_process_number_of_views_condition( $condition_id, $condition_settings );
case 'customField':
return $this->_process_custom_field_condition( $condition_settings );
case 'urlParameter':
return $this->_process_url_parameter_condition( $condition_settings );
case 'productStock':
return $this->_process_product_stock_condition( $condition_settings );
default:
if ( isset( $condition_settings['dynamicPosts'] ) ) {
return $this->_process_dynamic_posts_condition( $condition_settings );
@@ -341,6 +351,20 @@ class ET_Builder_Module_Field_DisplayConditions extends ET_Builder_Module_Field_
break;
}
// Exception! "Custom Field" Condition can have multiple conditions.
$is_custom_field = 'customField' === $condition['condition'];
if ( $is_custom_field ) {
$is_conflicted = false;
break;
}
// Exception! "URL Parameter" Condition can have multiple conditions.
$is_url_parameter = 'urlParameter' === $condition['condition'];
if ( $is_url_parameter ) {
$is_conflicted = false;
break;
}
/**
* When operator is set to "OR/ANY" and we have more than one condition, all other conditions
* will be set as conflicted, giving the priority to the latest condition in the list.
+5 -16
View File
@@ -448,23 +448,12 @@ class ET_Builder_Module_Field_Divider extends ET_Builder_Module_Field_Base {
// z-index - determined by arrangement.
$declaration['z-index'] = ( 'on' === $fullwidth || 'above_content' === $arrangement ) ? 10 : 1;
$flip_styles = array();
// flipping the svg x|y
if ( in_array( 'horizontal', $flip ) ) {
$flip_styles[] = 'rotateY(180deg)';
} elseif ( '' !== $breakpoint ) {
$flip_styles[] = 'rotateY(0)';
}
$flip_styles = array(
in_array( 'horizontal', $flip, true ) ? '-1' : '1',
in_array( 'vertical', $flip, true ) ? '-1' : '1',
);
if ( in_array( 'vertical', $flip ) ) {
$flip_styles[] = 'rotateX(180deg)';
} elseif ( '' !== $breakpoint ) {
$flip_styles[] = 'rotateX(0)';
}
if ( ! empty( $flip_styles ) ) {
$declaration['transform'] = implode( ' ', $flip_styles );
}
$declaration['transform'] = 'scale(' . implode( ', ', $flip_styles ) . ')';
// finally create our CSS declaration.
$css = '';
@@ -241,6 +241,9 @@ class ET_Builder_Module_Field_MarginPadding extends ET_Builder_Module_Field_Base
'sub_toggle' => $sub_toggle,
'priority' => $config['priority'],
);
if ( isset( $config['depends_on'] ) && '' !== $config['depends_on'] ) {
$fields[ $custom_padding ]['depends_on'] = $config['depends_on'];
}
$fields[ $custom_padding_tablet ] = array(
'type' => 'skip',
'tab_slug' => $tab_slug,
@@ -30,7 +30,8 @@ trait AuthorCondition {
return false;
}
$display_rule = isset( $condition_settings['authorDisplay'] ) ? $condition_settings['authorDisplay'] : '';
$legacy_display_rule = isset( $condition_settings['authorDisplay'] ) ? $condition_settings['authorDisplay'] : 'is';
$display_rule = isset( $condition_settings['displayRule'] ) ? $condition_settings['displayRule'] : $legacy_display_rule;
$authors_raw = isset( $condition_settings['authors'] ) ? $condition_settings['authors'] : [];
$authors_ids = array_map(
function( $item ) {
@@ -25,9 +25,11 @@ trait BrowserCondition {
* @return boolean Condition output.
*/
protected function _process_browser_condition( $condition_settings ) {
$display_rule = isset( $condition_settings['browserDisplay'] ) ? $condition_settings['browserDisplay'] : 'is';
$browsers_raw = isset( $condition_settings['browsers'] ) ? $condition_settings['browsers'] : '';
$browsers = explode( '|', $browsers_raw );
// Checks for additional display rule for compatibility with Conditional Display older versions which didn't use `displayRule` key.
$legacy_display_rule = isset( $condition_settings['browserDisplay'] ) ? $condition_settings['browserDisplay'] : 'is';
$display_rule = isset( $condition_settings['displayRule'] ) ? $condition_settings['displayRule'] : $legacy_display_rule;
$browsers_raw = isset( $condition_settings['browsers'] ) ? $condition_settings['browsers'] : '';
$browsers = explode( '|', $browsers_raw );
// phpcs:ignore ET.Sniffs.ValidatedSanitizedInput -- User Agent is not stored or displayed therefore XSS safe.
$useragent = ( isset( $_SERVER['HTTP_USER_AGENT'] ) ) ? $_SERVER['HTTP_USER_AGENT'] : '';
$is_old_edge = preg_match( '/edge\//i', $useragent );
@@ -28,15 +28,18 @@ trait CartContentsCondition {
if ( ! class_exists( 'WooCommerce' ) ) {
return false;
}
$display_rule = isset( $condition_settings['cartContentsDisplay'] ) ? $condition_settings['cartContentsDisplay'] : 'hasProducts';
$products_raw = isset( $condition_settings['products'] ) ? $condition_settings['products'] : [];
$products_ids = array_map(
// Checks for additional display rule for compatibility with Conditional Display older versions which didn't use `displayRule` key.
$legacy_display_rule = isset( $condition_settings['cartContentsDisplay'] ) ? $condition_settings['cartContentsDisplay'] : 'hasProducts';
$display_rule = isset( $condition_settings['displayRule'] ) ? $condition_settings['displayRule'] : $legacy_display_rule;
$products_raw = isset( $condition_settings['products'] ) ? $condition_settings['products'] : [];
$products_ids = array_map(
function( $item ) {
return isset( $item['value'] ) ? $item['value'] : '';
},
$products_raw
);
$is_cart_empty = WC()->cart->is_empty();
$is_cart_empty = WC()->cart->is_empty();
switch ( $display_rule ) {
case 'hasProducts':
@@ -31,8 +31,9 @@ trait CategoriesCondition {
return false;
}
// Get condition's settings.
$display_rule = isset( $condition_settings['categoriesDisplay'] ) ? $condition_settings['categoriesDisplay'] : 'is';
// Checks for additional display rule for compatibility with Conditional Display older versions which didn't use `displayRule` key.
$legacy_display_rule = isset( $condition_settings['categoriesDisplay'] ) ? $condition_settings['categoriesDisplay'] : 'is';
$display_rule = isset( $condition_settings['displayRule'] ) ? $condition_settings['displayRule'] : $legacy_display_rule;
$categories_raw = isset( $condition_settings['categories'] ) ? $condition_settings['categories'] : [];
$categories = array_map(
function( $item ) {
@@ -31,8 +31,9 @@ trait CategoryPageCondition {
return false;
}
// Get condition's settings.
$display_rule = isset( $condition_settings['categoryPageDisplay'] ) ? $condition_settings['categoryPageDisplay'] : 'is';
// Checks for additional display rule for compatibility with Conditional Display older versions which didn't use `displayRule` key.
$legacy_display_rule = isset( $condition_settings['categoryPageDisplay'] ) ? $condition_settings['categoryPageDisplay'] : 'is';
$display_rule = isset( $condition_settings['displayRule'] ) ? $condition_settings['displayRule'] : $legacy_display_rule;
$categories_raw = isset( $condition_settings['categories'] ) ? $condition_settings['categories'] : [];
$queried_object = get_queried_object();
$is_queried_object_valid = $queried_object instanceof \WP_Term && property_exists( $queried_object, 'taxonomy' );
@@ -25,7 +25,9 @@ trait CookieCondition {
* @return boolean Condition output.
*/
protected function _process_cookie_condition( $condition_settings ) {
$display_rule = isset( $condition_settings['cookieDisplay'] ) ? $condition_settings['cookieDisplay'] : 'cookieExists';
// Checks for additional display rule for compatibility with Conditional Display older versions which didn't use `displayRule` key.
$legacy_display_rule = isset( $condition_settings['cookieDisplay'] ) ? $condition_settings['cookieDisplay'] : 'cookieExists';
$display_rule = isset( $condition_settings['displayRule'] ) ? $condition_settings['displayRule'] : $legacy_display_rule;
$cookie_name = isset( $condition_settings['cookieName'] ) ? $condition_settings['cookieName'] : '';
$cookie_value = isset( $condition_settings['cookieValue'] ) ? $condition_settings['cookieValue'] : '';
$is_cookie_set = ( isset( $_COOKIE[ $cookie_name ] ) ) ? true : false;
@@ -0,0 +1,89 @@
<?php
/**
* Custom Field's logic swiftly crafted.
*
* @since 4.11.0
*
* @package Divi
* @sub-package Builder
*/
namespace Module\Field\DisplayConditions;
/**
* Custom Field Condition Trait
*/
trait CustomFieldCondition {
/**
* Evaluates "Custom Field" condition.
*
* @since 4.14.3
*
* @param array $condition_settings The Condition settings containing:
* 'selectConditionalMetaField' => base64_data.
*
* @return boolean Returns `true` if the condition evaluation is true, `false` otherwise.
*/
protected function _process_custom_field_condition( $condition_settings ) {
// Only check for Posts.
if ( ! is_singular() ) {
return false;
}
// Only check if queried object id is valid.
$queried_object_id = get_queried_object_id();
if ( ! \WP_Post::get_instance( $queried_object_id ) ) {
return false;
}
// Decodes the base64 data and runs validations.
$meta_field_settings_base64 = isset( $condition_settings['selectConditionalMetaField'] ) ? $condition_settings['selectConditionalMetaField'] : '';
$meta_field_settings_json = base64_decode( $meta_field_settings_base64 ); // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions.obfuscation_base64_decode -- The returned data is an array and necessary validation checks are performed.
$meta_field_settings = false !== $meta_field_settings_json ? json_decode( $meta_field_settings_json, true ) : [];
// Gets meta fields settings.
$display_rule = isset( $meta_field_settings['displayRule'] ) ? $meta_field_settings['displayRule'] : 'is';
$selected_field_name = isset( $meta_field_settings['selectedFieldName'] ) ? $meta_field_settings['selectedFieldName'] : 'manualCustomFieldName';
$custom_field_name = isset( $meta_field_settings['customFieldName'] ) ? $meta_field_settings['customFieldName'] : '';
$selected_field_value = isset( $meta_field_settings['selectedFieldValue'] ) ? $meta_field_settings['selectedFieldValue'] : 'manualCustomFieldValue';
$custom_field_value = isset( $meta_field_settings['customFieldValue'] ) ? $meta_field_settings['customFieldValue'] : '';
$field_name = 'manualCustomFieldName' === $selected_field_name ? $custom_field_name : $selected_field_name;
$has_custom_field_value = 'manualCustomFieldValue' === $selected_field_value ? true : false;
// Checks whether the specified custom fields actually exist.
$has_field_name_metadata = metadata_exists( 'post', $queried_object_id, $field_name );
$has_selected_field_value_metadata = $has_custom_field_value ? true : metadata_exists( 'post', $queried_object_id, $selected_field_value );
// Bailout if specified custom fields don't exist.
if ( ! $has_field_name_metadata || ! $has_selected_field_value_metadata ) {
return false;
}
$field_name_meta = (string) get_post_meta( $queried_object_id, $field_name, true );
$field_value_meta = $has_custom_field_value ? (string) $custom_field_value : (string) get_post_meta( $queried_object_id, $selected_field_value, true );
// The PHP 7.4 and below will throw warning if we pass empty string on the 2nd arg
// of `strpos`. We have to avoid this issue and make sure the `Contains` condition
// threat $field_value_meta empty value as invalid condition (no match).
$contains = false;
if ( ! empty( $field_value_meta ) ) {
$contains = strpos( $field_name_meta, $field_value_meta );
}
$output = [
'is' => $field_name_meta === $field_value_meta,
'isNot' => $field_name_meta !== $field_value_meta,
'contains' => false !== $contains,
'doesNotContain' => false === $contains,
'isAnyValue' => strlen( $field_name_meta ) > 0,
'hasNoValue' => strlen( $field_name_meta ) === 0,
'isGreaterThan' => (float) $field_name_meta > (float) $field_value_meta,
'isLessThan' => (float) $field_name_meta < (float) $field_value_meta,
];
return isset( $output[ $display_rule ] ) ? $output[ $display_rule ] : false;
}
}
@@ -22,17 +22,19 @@ trait DateArchiveCondition {
*
* @since 4.11.0
*
* @param array $all_settings Containing all settings of the condition.
* @param array $condition_settings Containing all settings of the condition.
*
* @return boolean Condition output.
*/
protected function _process_date_archive_condition( $all_settings ) {
protected function _process_date_archive_condition( $condition_settings ) {
if ( ! is_date() ) {
return false;
}
$display_rule = isset( $all_settings['dateArchiveDisplay'] ) ? $all_settings['dateArchiveDisplay'] : 'isAfter';
$date = isset( $all_settings['dateArchive'] ) ? $all_settings['dateArchive'] : '';
// Checks for additional display rule for compatibility with Conditional Display older versions which didn't use `displayRule` key.
$legacy_display_rule = isset( $condition_settings['dateArchiveDisplay'] ) ? $condition_settings['dateArchiveDisplay'] : 'isAfter';
$display_rule = isset( $condition_settings['displayRule'] ) ? $condition_settings['displayRule'] : $legacy_display_rule;
$date = isset( $condition_settings['dateArchive'] ) ? $condition_settings['dateArchive'] : '';
$year = get_query_var( 'year' );
$monthnum = get_query_var( 'monthnum' ) === 0 ? 1 : get_query_var( 'monthnum' );
@@ -27,7 +27,9 @@ trait DateTimeCondition {
* @return boolean Condition output.
*/
protected function _process_date_time_condition( $condition_settings ) {
$display_rule = isset( $condition_settings['dateTimeDisplay'] ) ? $condition_settings['dateTimeDisplay'] : 'isAfter';
// Checks for additional display rule for compatibility with Conditional Display older versions which didn't use `displayRule` key.
$legacy_display_rule = isset( $condition_settings['dateTimeDisplay'] ) ? $condition_settings['dateTimeDisplay'] : 'isAfter';
$display_rule = isset( $condition_settings['displayRule'] ) ? $condition_settings['displayRule'] : $legacy_display_rule;
$date = isset( $condition_settings['date'] ) ? $condition_settings['date'] : '';
$time = isset( $condition_settings['time'] ) ? $condition_settings['time'] : '';
$all_day = isset( $condition_settings['allDay'] ) ? $condition_settings['allDay'] : '';
@@ -132,6 +134,9 @@ trait DateTimeCondition {
* @return boolean Condition repetition result.
*/
protected function _is_datetime_condition_repeated( $condition_settings, $is_on_specific_date, $current_datetime, $target_datetime ) {
// Checks for additional display rule for compatibility with Conditional Display older versions which didn't use `displayRule` key.
$legacy_display_rule = isset( $condition_settings['dateTimeDisplay'] ) ? $condition_settings['dateTimeDisplay'] : 'isAfter';
$display_rule = isset( $condition_settings['displayRule'] ) ? $condition_settings['displayRule'] : $legacy_display_rule;
$repeat = isset( $condition_settings['repeat'] ) ? $condition_settings['repeat'] : '';
$repeat_frequency = isset( $condition_settings['repeatFrequency'] ) ? $condition_settings['repeatFrequency'] : '';
$repeat_frequency_specific_days = isset( $condition_settings['repeatFrequencySpecificDays'] ) ? $condition_settings['repeatFrequencySpecificDays'] : '';
@@ -142,7 +147,7 @@ trait DateTimeCondition {
$from_time = isset( $condition_settings['fromTime'] ) ? $condition_settings['fromTime'] : '';
$until_time = isset( $condition_settings['untilTime'] ) ? $condition_settings['untilTime'] : '';
$is_repeated = false;
$is_on_specific_days = 'isOnSpecificDays' === $condition_settings['dateTimeDisplay'];
$is_on_specific_days = 'isOnSpecificDays' === $display_rule;
if ( $is_on_specific_days || ( 'on' === $repeat && ! $is_on_specific_date ) ) {
if ( $is_on_specific_days ) {
@@ -30,16 +30,18 @@ trait DynamicPostsCondition {
return false;
}
$display_rule = isset( $condition_settings['dynamicPostsDisplay'] ) ? $condition_settings['dynamicPostsDisplay'] : '';
$dynamic_posts_raw = isset( $condition_settings['dynamicPosts'] ) ? $condition_settings['dynamicPosts'] : [];
$dynamic_posts_ids = array_map(
// Checks for additional display rule for compatibility with Conditional Display older versions which didn't use `displayRule` key.
$legacy_display_rule = isset( $condition_settings['dynamicPostsDisplay'] ) ? $condition_settings['dynamicPostsDisplay'] : 'is';
$display_rule = isset( $condition_settings['displayRule'] ) ? $condition_settings['displayRule'] : $legacy_display_rule;
$dynamic_posts_raw = isset( $condition_settings['dynamicPosts'] ) ? $condition_settings['dynamicPosts'] : [];
$dynamic_posts_ids = array_map(
function( $item ) {
return isset( $item['value'] ) ? $item['value'] : '';
},
$dynamic_posts_raw
);
$is_on_shop_page = class_exists( 'WooCommerce' ) && is_shop();
$current_page_id = $is_on_shop_page ? wc_get_page_id( 'shop' ) : get_queried_object_id();
$is_on_shop_page = class_exists( 'WooCommerce' ) && is_shop();
$current_page_id = $is_on_shop_page ? wc_get_page_id( 'shop' ) : get_queried_object_id();
$should_display = array_intersect( $dynamic_posts_ids, (array) $current_page_id ) ? true : false;
@@ -25,26 +25,12 @@ trait LoggedInStatusCondition {
* @return boolean Condition output.
*/
protected function _process_logged_in_status_condition( $condition_settings ) {
$logged_in_status = isset( $condition_settings['loggedInStatus'] ) ? $condition_settings['loggedInStatus'] : 'loggedIn';
$should_display = ( is_user_logged_in() ) ? true : false;
return ( 'loggedIn' === $logged_in_status ) ? $should_display : ! $should_display;
}
// Checks for additional display rule for compatibility with Conditional Display older versions which didn't use `displayRule` key.
$legacy_display_rule = isset( $condition_settings['loggedInStatus'] ) ? $condition_settings['loggedInStatus'] : 'loggedIn';
$display_rule = isset( $condition_settings['displayRule'] ) ? $condition_settings['displayRule'] : $legacy_display_rule;
$should_display = ( is_user_logged_in() ) ? true : false;
/**
* Checks logged in status for possible conflicts.
*
* @param string $current_value Curent setting value.
* @param string $prev_value Previous setting value.
* @param array $conflicting_value Defined conflicting value.
* @return boolean
*/
protected function _is_logged_in_status_conflicted( $current_value, $prev_value, $conflicting_value ) {
$is_current_value_conflicted = in_array( $current_value, $conflicting_value, true );
$is_prev_value_conflicted = in_array( $prev_value, $conflicting_value, true );
if ( $is_current_value_conflicted && $is_prev_value_conflicted ) {
return true;
}
return false;
return ( 'loggedIn' === $display_rule ) ? $should_display : ! $should_display;
}
}
@@ -25,7 +25,9 @@ trait OperatingSystemCondition {
* @return boolean Condition output.
*/
protected function _process_operating_system_condition( $condition_settings ) {
$display_rule = isset( $condition_settings['operatingSystemDisplay'] ) ? $condition_settings['operatingSystemDisplay'] : 'is';
// Checks for additional display rule for compatibility with Conditional Display older versions which didn't use `displayRule` key.
$legacy_display_rule = isset( $condition_settings['operatingSystemDisplay'] ) ? $condition_settings['operatingSystemDisplay'] : 'is';
$display_rule = isset( $condition_settings['displayRule'] ) ? $condition_settings['displayRule'] : $legacy_display_rule;
$operating_systems_raw = isset( $condition_settings['operatingSystems'] ) ? $condition_settings['operatingSystems'] : '';
$operating_systems = explode( '|', $operating_systems_raw );
$current_os = $this->_get_os();
@@ -25,7 +25,9 @@ trait PageVisitCondition {
* @return boolean Condition output.
*/
protected function _process_page_visit_condition( $condition_settings ) {
$display_rule = isset( $condition_settings['pageVisitDisplay'] ) ? $condition_settings['pageVisitDisplay'] : 'hasVisitedSpecificPage';
// Checks for additional display rule for compatibility with Conditional Display older versions which didn't use `displayRule` key.
$legacy_display_rule = isset( $condition_settings['pageVisitDisplay'] ) ? $condition_settings['pageVisitDisplay'] : 'hasVisitedSpecificPage';
$display_rule = isset( $condition_settings['displayRule'] ) ? $condition_settings['displayRule'] : $legacy_display_rule;
$pages_raw = isset( $condition_settings['pages'] ) ? $condition_settings['pages'] : [];
$pages_ids = array_map(
function( $item ) {
@@ -34,10 +36,13 @@ trait PageVisitCondition {
$pages_raw
);
$has_visited_specific_page = false;
$cookie = [];
if ( isset( $_COOKIE['divi_post_visit'] ) ) {
// phpcs:ignore ET.Sniffs.ValidatedSanitizedInput, WordPress.PHP.DiscouragedPHPFunctions.obfuscation_base64_decode -- Cookie is not stored or displayed therefore XSS safe, base64_decode returned data is an array and necessary validation checks are performed.
$cookie = json_decode( base64_decode( $_COOKIE['divi_post_visit'] ), true );
$cookie = json_decode( base64_decode( $_COOKIE['divi_post_visit'] ), true );
}
if ( $cookie && is_array( $cookie ) ) {
$col = array_column( $cookie, 'id' );
$has_visited_specific_page = array_intersect( $pages_ids, $col ) ? true : false;
}
@@ -30,17 +30,19 @@ trait PostTypeCondition {
return false;
}
$display_rule = isset( $condition_settings['postTypeDisplay'] ) ? $condition_settings['postTypeDisplay'] : '';
$post_types_raw = isset( $condition_settings['postTypes'] ) ? $condition_settings['postTypes'] : [];
$post_types_values = array_map(
// Checks for additional display rule for compatibility with Conditional Display older versions which didn't use `displayRule` key.
$legacy_display_rule = isset( $condition_settings['postTypeDisplay'] ) ? $condition_settings['postTypeDisplay'] : 'is';
$display_rule = isset( $condition_settings['displayRule'] ) ? $condition_settings['displayRule'] : $legacy_display_rule;
$post_types_raw = isset( $condition_settings['postTypes'] ) ? $condition_settings['postTypes'] : [];
$post_types_values = array_map(
function( $item ) {
return $item['value'];
},
$post_types_raw
);
$is_on_shop_page = class_exists( 'WooCommerce' ) && is_shop();
$current_queried_id = $is_on_shop_page ? wc_get_page_id( 'shop' ) : get_queried_object_id();
$post_type = get_post_type( $current_queried_id );
$is_on_shop_page = class_exists( 'WooCommerce' ) && is_shop();
$current_queried_id = $is_on_shop_page ? wc_get_page_id( 'shop' ) : get_queried_object_id();
$post_type = get_post_type( $current_queried_id );
$should_display = array_intersect( $post_types_values, (array) $post_type ) ? true : false;
@@ -29,10 +29,12 @@ trait ProductPurchaseCondition {
return false;
}
$display_rule = isset( $condition_settings['productPurchaseDisplay'] ) ? $condition_settings['productPurchaseDisplay'] : 'hasBoughtProduct';
$products_raw = isset( $condition_settings['products'] ) ? $condition_settings['products'] : [];
$current_user = wp_get_current_user();
$products_ids = array_map(
// Checks for additional display rule for compatibility with Conditional Display older versions which didn't use `displayRule` key.
$legacy_display_rule = isset( $condition_settings['productPurchaseDisplay'] ) ? $condition_settings['productPurchaseDisplay'] : 'hasBoughtProduct';
$display_rule = isset( $condition_settings['displayRule'] ) ? $condition_settings['displayRule'] : $legacy_display_rule;
$products_raw = isset( $condition_settings['products'] ) ? $condition_settings['products'] : [];
$current_user = wp_get_current_user();
$products_ids = array_map(
function( $item ) {
return isset( $item['value'] ) ? $item['value'] : '';
},
@@ -0,0 +1,61 @@
<?php
/**
* Product Stock Condition logic swiftly crafted.
*
* @since 4.14.3
*
* @package Divi
* @sub-package Builder
*/
namespace Module\Field\DisplayConditions;
/**
* Product Stock Condition Trait.
*/
trait ProductStockCondition {
/**
* Processes "Product Stock" condition.
*
* @since 4.14.3
*
* @param array $condition_settings The Condition settings containing:
* 'displayRule' => string,
* 'products' => array.
*
* @return boolean Returns `true` if the condition evaluation is true, `false` otherwise.
*/
protected function _process_product_stock_condition( $condition_settings ) {
if ( ! class_exists( 'WooCommerce' ) ) {
return false;
}
$display_rule = isset( $condition_settings['displayRule'] ) ? $condition_settings['displayRule'] : 'isInStock';
$products_raw = isset( $condition_settings['products'] ) ? $condition_settings['products'] : [];
$products_ids = array_map(
function( $item ) {
return isset( $item['value'] ) ? (int) $item['value'] : '';
},
$products_raw
);
$products_ids = array_filter( $products_ids );
$products = wc_get_products(
[
'limit' => -1,
'include' => $products_ids,
'stock_status' => 'instock',
'return' => 'ids',
]
);
$output = [
'isInStock' => count( $products ) > 0,
'isOutOfStock' => count( $products ) === 0,
];
return isset( $output[ $display_rule ] ) ? $output[ $display_rule ] : false;
}
}
@@ -30,7 +30,9 @@ trait SearchResultsCondition {
return false;
}
$display_rule = isset( $condition_settings['searchResultsDisplay'] ) ? $condition_settings['searchResultsDisplay'] : 'is';
// Checks for additional display rule for compatibility with Conditional Display older versions which didn't use `displayRule` key.
$legacy_display_rule = isset( $condition_settings['searchResultsDisplay'] ) ? $condition_settings['searchResultsDisplay'] : 'specificSearchQueries';
$display_rule = isset( $condition_settings['displayRule'] ) ? $condition_settings['displayRule'] : $legacy_display_rule;
$specific_search_queries_raw = isset( $condition_settings['specificSearchQueries'] ) ? $condition_settings['specificSearchQueries'] : '';
$excluded_search_queries_raw = isset( $condition_settings['excludedSearchQueries'] ) ? $condition_settings['excludedSearchQueries'] : '';
$specific_search_queries = explode( ',', $specific_search_queries_raw );
@@ -31,8 +31,9 @@ trait TagPageCondition {
return false;
}
// Get condition's settings.
$display_rule = isset( $condition_settings['tagPageDisplay'] ) ? $condition_settings['tagPageDisplay'] : 'is';
// Checks for additional display rule for compatibility with Conditional Display older versions which didn't use `displayRule` key.
$legacy_display_rule = isset( $condition_settings['tagPageDisplay'] ) ? $condition_settings['tagPageDisplay'] : 'is';
$display_rule = isset( $condition_settings['displayRule'] ) ? $condition_settings['displayRule'] : $legacy_display_rule;
$tags_raw = isset( $condition_settings['tags'] ) ? $condition_settings['tags'] : [];
$queried_object = get_queried_object();
$is_queried_object_valid = $queried_object instanceof \WP_Term && property_exists( $queried_object, 'taxonomy' );
@@ -31,8 +31,9 @@ trait TagsCondition {
return false;
}
// Get condition's settings.
$display_rule = isset( $condition_settings['tagsDisplay'] ) ? $condition_settings['tagsDisplay'] : 'is';
// Checks for additional display rule for compatibility with Conditional Display older versions which didn't use `displayRule` key.
$legacy_display_rule = isset( $condition_settings['tagsDisplay'] ) ? $condition_settings['tagsDisplay'] : 'is';
$display_rule = isset( $condition_settings['displayRule'] ) ? $condition_settings['displayRule'] : $legacy_display_rule;
$tags_raw = isset( $condition_settings['tags'] ) ? $condition_settings['tags'] : [];
$tags = array_map(
function( $item ) {
@@ -0,0 +1,100 @@
<?php
/**
* URL Parameter Condition logic swiftly crafted.
*
* @since 4.14.3
*
* @package Divi
* @sub-package Builder
*/
namespace Module\Field\DisplayConditions;
/**
* URL Parameter Condition Trait.
*/
trait UrlParameterCondition {
/**
* Processes "URL Parameter" condition.
*
* @since 4.14.3
*
* @param array $condition_settings The Condition settings containing:
* 'displayRule' => string,
* 'selectUrlParameter' => string,
* 'urlParameterName' => string,
* 'urlParameterValue' => string.
*
* @return boolean Returns `true` if the condition evaluation is true, `false` otherwise.
*/
protected function _process_url_parameter_condition( $condition_settings ) {
$display_rule = isset( $condition_settings['displayRule'] ) ? $condition_settings['displayRule'] : 'equals';
$select_url_parameter = isset( $condition_settings['selectUrlParameter'] ) ? $condition_settings['selectUrlParameter'] : 'specificUrlParameter';
$url_parameter_name = isset( $condition_settings['urlParameterName'] ) ? (string) $condition_settings['urlParameterName'] : '';
$url_parameter_value = isset( $condition_settings['urlParameterValue'] ) ? (string) $condition_settings['urlParameterValue'] : '';
$get_url_parameter = isset( $_GET[ $url_parameter_name ] ) ? sanitize_text_field( $_GET[ $url_parameter_name ] ) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- No need to use nonce as there is no form processing.
$is_url_parameter_set = isset( $_GET[ $url_parameter_name ] ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- No need to use nonce as there is no form processing.
if ( 'anyUrlParameter' === $select_url_parameter ) {
$parameter_values = $this->_get_all_parameter_values();
$output = [
'equals' => count( $parameter_values ) > 0 && array_intersect( $parameter_values, (array) $url_parameter_value ),
'exist' => count( $parameter_values ) > 0,
'doesNotExist' => count( $parameter_values ) === 0,
'doesNotEqual' => count( $parameter_values ) > 0 && ! array_intersect( $parameter_values, (array) $url_parameter_value ),
'contains' => count( $parameter_values ) > 0 && $this->_array_contains_string( $parameter_values, $url_parameter_value ),
'doesNotContain' => count( $parameter_values ) > 0 && ! $this->_array_contains_string( $parameter_values, $url_parameter_value ),
];
} else {
$output = [
'equals' => $is_url_parameter_set && $get_url_parameter === $url_parameter_value,
'exist' => $is_url_parameter_set,
'doesNotExist' => ! $is_url_parameter_set,
'doesNotEqual' => $is_url_parameter_set && $get_url_parameter !== $url_parameter_value,
'contains' => $is_url_parameter_set && strpos( $get_url_parameter, $url_parameter_value ) !== false,
'doesNotContain' => $is_url_parameter_set && strpos( $get_url_parameter, $url_parameter_value ) === false,
];
}
return isset( $output[ $display_rule ] ) ? $output[ $display_rule ] : false;
}
/**
* Returns all parameter values.
*
* @since 4.14.3
*
* @return array
*/
protected function _get_all_parameter_values() {
return array_map(
function( $value ) {
return $value;
},
$_GET // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- No need to use nonce.
);
}
/**
* Checks if `$haystack` items contain `$needle` in their values.
*
* @since 4.14.3
*
* @param array $haystack The array to search in.
* @param string $needle The string needle to search for.
*
* @return boolean
*/
protected function _array_contains_string( $haystack, $needle ) {
$filtered_array = array_filter(
$haystack,
function( $value ) use ( $needle ) {
return strpos( $value, $needle ) !== false;
}
);
return count( $filtered_array ) > 0 ? true : false;
}
}
@@ -25,17 +25,19 @@ trait UserRoleCondition {
* @return boolean Condition output.
*/
protected function _process_user_role_condition( $condition_settings ) {
$display_rule = isset( $condition_settings['userRoleDisplay'] ) ? $condition_settings['userRoleDisplay'] : 'is';
$roles_raw = isset( $condition_settings['userRoles'] ) ? $condition_settings['userRoles'] : [];
$ids_raw = isset( $condition_settings['userIds'] ) ? $condition_settings['userIds'] : '';
$roles = array_map(
// Checks for additional display rule for compatibility with Conditional Display older versions which didn't use `displayRule` key.
$legacy_display_rule = isset( $condition_settings['userRoleDisplay'] ) ? $condition_settings['userRoleDisplay'] : 'is';
$display_rule = isset( $condition_settings['displayRule'] ) ? $condition_settings['displayRule'] : $legacy_display_rule;
$roles_raw = isset( $condition_settings['userRoles'] ) ? $condition_settings['userRoles'] : [];
$ids_raw = isset( $condition_settings['userIds'] ) ? $condition_settings['userIds'] : '';
$roles = array_map(
function( $item ) {
return $item['value'];
},
$roles_raw
);
$ids = isset( $ids_raw ) ? array_map( 'trim', array_filter( explode( ',', $ids_raw ) ) ) : array();
$user = wp_get_current_user();
$ids = isset( $ids_raw ) ? array_map( 'trim', array_filter( explode( ',', $ids_raw ) ) ) : array();
$user = wp_get_current_user();
$should_display_based_on_roles = array_intersect( $roles, (array) $user->roles ) ? true : false;
$should_display_based_on_ids = array_intersect( $ids, (array) $user->ID ) ? true : false;
File diff suppressed because it is too large Load Diff
@@ -1140,9 +1140,11 @@ class ET_Builder_Module_Helper_ResponsiveOptions {
$enable_fields = array(
"{$background_base}_color" => "{$background_base}_enable_color",
'use_background_color_gradient' => 'use_background_color_gradient',
"{$background_base}_use_color_gradient" => "{$background_base}_enable_use_color_gradient",
"{$background_base}_use_color_gradient" => "{$background_base}_use_color_gradient",
"{$background_base}_image" => "{$background_base}_enable_image",
"video_{$background_base}_values" => "video_{$background_base}_values",
"{$background_base}_pattern_style" => "{$background_base}_enable_pattern_style",
"{$background_base}_mask_style" => "{$background_base}_enable_mask_style",
);
// Empty string is slug for desktop.
@@ -1171,25 +1173,35 @@ class ET_Builder_Module_Helper_ResponsiveOptions {
foreach ( $map_slugs[ $preview_mode ] as $slug ) {
// BG Color.
if ( in_array( $base_setting, array( "{$background_base}_color", "{$background_base}_image" ) ) ) {
// BG Color, BG Image, BG Pattern, BG Mask.
if (
in_array(
$base_setting,
array(
"{$background_base}_color",
"{$background_base}_image",
"{$background_base}_pattern_style",
"{$background_base}_mask_style",
),
true
)
) {
$base_type = str_replace( "{$background_base}_", '', $base_setting );
$enable_default = ! empty( $fields[ "{$background_base}_enable_{$base_type}{$slug}" ] ) && ! empty( $fields[ "{$background_base}_enable_{$base_type}{$slug}" ]['default'] ) ? $fields[ "{$background_base}_enable_{$base_type}{$slug}" ]['default'] : '';
$enable_value = ! empty( $attrs[ "{$background_base}_enable_{$base_type}{$slug}" ] ) ? $attrs[ "{$background_base}_enable_{$base_type}{$slug}" ] : $enable_default;
$bg_value = ! empty( $attrs[ "{$background_base}_{$base_type}{$slug}" ] ) ? $attrs[ "{$background_base}_{$base_type}{$slug}" ] : '';
$is_bg_enabled = 'off' !== $enable_value;
$setting_value = ! empty( $attrs[ "{$background_base}_{$base_type}{$slug}" ] ) ? $attrs[ "{$background_base}_{$base_type}{$slug}" ] : '';
$is_tab_enabled = 'off' !== $enable_value;
if ( '' !== $bg_value && $is_bg_enabled ) {
$new_value = $bg_value;
if ( '' !== $setting_value && $is_tab_enabled ) {
$new_value = $setting_value;
break;
} elseif ( ! $is_bg_enabled ) {
} elseif ( ! $is_tab_enabled ) {
$new_value = '';
break;
}
// BG Gradient.
} elseif ( in_array( $base_setting, array( 'use_background_color_gradient', "{$background_base}_use_color_gradient" ) ) ) {
} elseif ( in_array( $base_setting, array( 'use_background_color_gradient', "{$background_base}_use_color_gradient" ), true ) ) {
$new_value = 'off';
@@ -1198,31 +1210,47 @@ class ET_Builder_Module_Helper_ResponsiveOptions {
'value' => "use_background_color_gradient{$slug}",
'start' => "{$background_base}_color_gradient_start{$slug}",
'end' => "{$background_base}_color_gradient_end{$slug}",
'stops' => "{$background_base}_color_gradient_stops{$slug}",
'unit' => "{$background_base}_color_gradient_unit{$slug}",
),
"{$background_base}_use_color_gradient" => array(
'value' => "{$background_base}_use_color_gradient{$slug}",
'start' => "{$background_base}_color_gradient_start{$slug}",
'end' => "{$background_base}_color_gradient_end{$slug}",
'stops' => "{$background_base}_color_gradient_stops{$slug}",
'unit' => "{$background_base}_color_gradient_unit{$slug}",
),
);
$field_value = '';
$field_start = '';
$field_end = '';
$field_stops = '';
if ( ! empty( $field_map[ $base_setting ] ) ) {
$field_value = ! empty( $field_map[ $base_setting ]['value'] ) ? $field_map[ $base_setting ]['value'] : '';
$field_start = ! empty( $field_map[ $base_setting ]['start'] ) ? $field_map[ $base_setting ]['start'] : '';
$field_end = ! empty( $field_map[ $base_setting ]['end'] ) ? $field_map[ $base_setting ]['end'] : '';
$field_stops = ! empty( $field_map[ $base_setting ]['stops'] ) ? $field_map[ $base_setting ]['stops'] : '';
}
$use_gradient_default = ! empty( $fields[ $field_value ] ) ? $fields[ $field_value ] : '';
$use_gradient_value = ! empty( $attrs[ $field_value ] ) ? $attrs[ $field_value ] : $use_gradient_default;
$gradient_start_value = ! empty( $attrs[ $field_start ] ) ? $attrs[ $field_start ] : '';
$gradient_end_value = ! empty( $attrs[ $field_end ] ) ? $attrs[ $field_end ] : '';
$is_gradient_enabled = 'off' !== $use_gradient_value;
// Set value from attrs, otherwise, assign default value, for desktop/tablet/phone.
$use_gradient_value = $this->get_any_value( $attrs, $field_value, 'off', true );
$gradient_start_value = $this->get_any_value( $attrs, $field_start, '', true );
$gradient_end_value = $this->get_any_value( $attrs, $field_end, '', true );
$gradient_stops_value = $this->get_any_value( $attrs, $field_stops, '', true );
if ( ( '' !== $gradient_start_value || '' !== $gradient_end_value ) && $is_gradient_enabled ) {
// Set value from attrs, otherwise, assign value from desktop.
if ( in_array( $slug, array( '__hover', '__sticky' ), true ) ) {
$use_gradient_value = ! empty( $attrs[ $field_value ] ) ? $attrs[ $field_value ] : $use_gradient_value;
$gradient_start_value = ! empty( $attrs[ $field_start ] ) ? $attrs[ $field_start ] : $gradient_start_value;
$gradient_end_value = ! empty( $attrs[ $field_end ] ) ? $attrs[ $field_end ] : $gradient_end_value;
$gradient_stops_value = ! empty( $attrs[ $field_stops ] ) ? $attrs[ $field_stops ] : $gradient_stops_value;
}
$is_gradient_enabled = 'off' !== $use_gradient_value;
if ( ( '' !== $gradient_stops_value || ( '' !== $gradient_start_value || '' !== $gradient_end_value ) ) && $is_gradient_enabled ) {
$new_value = 'on';
break;
} elseif ( ! $is_gradient_enabled ) {
@@ -288,15 +288,20 @@ class ET_Builder_Module_Helper_Sticky_Options {
*/
public function add_sticky_to_order_class( $selector, $is_sticky = true ) {
$selectors = explode( ',', $selector );
$selectors = array_map( 'trim', $selectors );
$selectors = array_map(
function( $selector ) use ( $is_sticky ) {
$selector = trim( $selector );
// If current selector is sticky module, sticky selector is directly attached; if it isn't
// it is safe to assume that the sticky selector is one of its parent DOM, hence the space.
if ( $is_sticky ) {
$selectors = preg_replace( '/(%%order_class%%)/i', '.et_pb_sticky$1', $selectors, 1 );
} else {
$selectors = preg_replace( '/(%%order_class%%)/i', '.et_pb_sticky $1', $selectors, 1 );
}
// If current selector is sticky module, sticky selector is directly attached; if it isn't
// it is safe to assume that the sticky selector is one of its parent DOM, hence the space.
if ( ! $is_sticky ) {
$selector = ' ' . $selector;
}
return '.et_pb_sticky' . $selector;
},
$selectors
);
return implode( ', ', $selectors );
}
@@ -24,7 +24,7 @@ if ( et_is_woocommerce_plugin_active() ) {
*
* Valid values are Product Ids, `current` and `latest`.
*
* @param string $maybe_product_id
* @param string $maybe_product_id Product ID.
*
* @return bool
*/
@@ -261,6 +261,144 @@ if ( et_is_woocommerce_plugin_active() ) {
'toggle_slug' => 'main_content',
);
break;
case 'offset_number':
$field = array(
'label' => esc_html__( 'Product Offset Number', 'et_builder' ),
'type' => 'text',
'option_category' => 'configuration',
'description' => esc_html__( 'Choose how many products you would like to skip. These products will not be shown in the feed.', 'et_builder' ),
'toggle_slug' => 'main_content',
'default' => 0,
);
break;
case 'fields_width':
$field = array(
'label' => esc_html__( 'Fields Width', 'et_builder' ),
'description' => esc_html__( 'Set the width of the fields.', 'et_builder' ),
'type' => 'select',
'option_category' => 'configuration',
'options' => array(
'default' => __( 'Default', 'et_builder' ),
'fullwidth' => __( 'Fullwidth', 'et_builder' ),
'2_column' => __( '2 Column', 'et_builder' ),
),
'default' => 'default',
'tab_slug' => 'advanced',
'toggle_slug' => 'layout',
'mobile_options' => true,
);
break;
case 'collapse_table_gutters_borders':
$field = array(
'label' => esc_html__( 'Collapse Table Gutters and Borders', 'et_builder' ),
'type' => 'yes_no_button',
'option_category' => 'configuration',
'options' => array(
'on' => et_builder_i18n( 'Yes' ),
'off' => et_builder_i18n( 'No' ),
),
'description' => esc_html__( 'Collapse Table Gutters and Borders.', 'et_builder' ),
'toggle_slug' => 'table',
'tab_slug' => 'advanced',
'default' => 'off',
'mobile_options' => true,
);
break;
case 'vertical_gutter_width':
$field = array(
'label' => esc_html__( 'Vertical Gutters', 'et_builder' ),
'type' => 'range',
'default_unit' => 'px',
'allowed_units' => array(
'em',
'rem',
'px',
'cm',
'mm',
'in',
'pt',
'pc',
'ex',
'vh',
'vw',
),
'range_settings' => array(
'min' => 0,
'max' => 50,
'step' => 1,
'min_limit' => 0,
),
'default' => '0px',
'mobile_options' => true,
'sticky' => false,
'tab_slug' => 'advanced',
'toggle_slug' => 'table',
'show_if' => array(
'collapse_table_gutters_borders' => 'off',
),
);
break;
case 'horizontal_gutter_width':
$field = array(
'label' => esc_html__( 'Horizontal Gutters', 'et_builder' ),
'type' => 'range',
'default_unit' => 'px',
'allowed_units' => array(
'em',
'rem',
'px',
'cm',
'mm',
'in',
'pt',
'pc',
'ex',
'vh',
'vw',
),
'range_settings' => array(
'min' => 0,
'max' => 50,
'step' => 1,
'min_limit' => 0,
),
'default' => '0px',
'mobile_options' => true,
'sticky' => false,
'tab_slug' => 'advanced',
'toggle_slug' => 'table',
'show_if' => array(
'collapse_table_gutters_borders' => 'off',
),
);
break;
case 'placeholder_color':
$field = array(
'label' => esc_html__( 'Placeholder Color', 'et_builder' ),
'description' => esc_html__( 'Pick a color to be used for the placeholder written inside input fields.', 'et_builder' ),
'type' => 'color-alpha',
'custom_color' => true,
'tab_slug' => 'advanced',
'toggle_slug' => 'form_field',
'hover' => 'tabs',
'mobile_options' => true,
'sticky' => false,
);
break;
case 'table_cell_alternating_background_color':
$field = array(
'label' => esc_html__( 'Table Cell Alternating Background Color', 'et_builder' ),
'description' => esc_html__( 'Pick a color to be used for the alternating table cells.', 'et_builder' ),
'type' => 'color-alpha',
'custom_color' => true,
'tab_slug' => 'advanced',
'toggle_slug' => 'table_cell',
'hover' => 'tabs',
'mobile_options' => true,
'sticky' => false,
'priority' => 9,
);
break;
default:
$field = array();
break;
@@ -958,6 +1096,418 @@ if ( et_is_woocommerce_plugin_active() ) {
public static function reset_display_type( $option_name, $display_type ) {
update_option( $option_name, $display_type );
}
/**
* Stops Checkout Coupon form from rendering.
*
* @deprecated
*/
public static function detach_wc_before_checkout_form() {
remove_action( 'woocommerce_before_checkout_form', 'woocommerce_checkout_coupon_form', 10 );
}
/**
* Stops Checkout Coupon form from rendering.
*/
public static function detach_wc_checkout_coupon_form() {
remove_action( 'woocommerce_before_checkout_form', 'woocommerce_checkout_coupon_form', 10 );
}
/**
* Stops Login Coupon form from rendering.
*/
public static function detach_wc_checkout_login_form() {
remove_action( 'woocommerce_before_checkout_form', 'woocommerce_checkout_login_form', 10 );
}
/**
* Enable `woocommerce_before_checkout_form` hook.
*
* @since 4.14.0
*/
public static function attach_wc_before_checkout_form() {
add_action(
'woocommerce_before_checkout_form',
'woocommerce_checkout_coupon_form',
10
);
}
/**
* Enable `woocommerce_before_checkout_form` hook.
*
* @since 4.14.0
*/
public static function attach_wc_checkout_coupon_form() {
add_action(
'woocommerce_before_checkout_form',
'woocommerce_checkout_coupon_form',
10
);
}
/**
* Enable `woocommerce_before_checkout_form` hook.
*
* @since 4.14.0
*/
public static function attach_wc_checkout_login_form() {
add_action(
'woocommerce_before_checkout_form',
'woocommerce_checkout_login_form',
10
);
}
/**
* Remove `woocommerce_checkout_billing` hook.
*
* @since 4.14.0
*/
public static function detach_wc_checkout_billing() {
if ( ! function_exists( 'WC' ) ) {
return;
}
$class = get_class( WC() );
if ( ! method_exists( $class, 'checkout' ) ) {
return;
}
$checkout = WC()->checkout();
remove_action(
'woocommerce_checkout_billing',
array( $checkout, 'checkout_form_billing' )
);
}
/**
* Enable `woocommerce_checkout_billing` hook.
*
* @since 4.14.0
*/
public static function attach_wc_checkout_billing() {
if ( ! function_exists( 'WC' ) ) {
return;
}
$class = get_class( WC() );
if ( ! method_exists( $class, 'checkout' ) ) {
return;
}
$checkout = WC()->checkout();
add_action( 'woocommerce_checkout_billing', array( $checkout, 'checkout_form_billing' ) );
}
/**
* Remove `woocommerce_checkout_shipping` hook.
*
* @since 4.14.0
*/
public static function detach_wc_checkout_shipping() {
if ( ! function_exists( 'WC' ) ) {
return;
}
$class = get_class( WC() );
if ( ! method_exists( $class, 'checkout' ) ) {
return;
}
$checkout = WC()->checkout();
remove_action(
'woocommerce_checkout_shipping',
array( $checkout, 'checkout_form_shipping' )
);
}
/**
* Enable `woocommerce_checkout_shipping` hook.
*
* @since 4.14.0
*/
public static function attach_wc_checkout_shipping() {
if ( ! function_exists( 'WC' ) ) {
return;
}
$class = get_class( WC() );
if ( ! method_exists( $class, 'checkout' ) ) {
return;
}
$checkout = WC()->checkout();
add_action(
'woocommerce_checkout_shipping',
array( $checkout, 'checkout_form_shipping' )
);
}
/**
* Remove `woocommerce_checkout_order_review` hook.
*
* @since 4.14.0
*/
public static function detach_wc_checkout_payment() {
remove_action(
'woocommerce_checkout_order_review',
'woocommerce_checkout_payment',
20
);
}
/**
* Enable `woocommerce_checkout_order_review` hook.
*
* @since 4.14.0
*/
public static function attach_wc_checkout_payment() {
add_action(
'woocommerce_checkout_order_review',
'woocommerce_checkout_payment',
20
);
}
/**
* Stops Order review (Mini cart) and Checkout Payment from rendering.
*
* @used-by ET_Builder_Module_Woocommerce_Checkout_Billing::get_checkout_billing()
* @used-by ET_Builder_Module_Woocommerce_Checkout_Additional_Info::get_additional_info()
*/
public static function detach_wc_checkout_order_review() {
remove_action(
'woocommerce_checkout_order_review',
'woocommerce_order_review',
10
);
}
/**
* Enable `woocommerce_checkout_order_review` hook.
*
* @since 4.14.0
*/
public static function attach_wc_checkout_order_review() {
add_action( 'woocommerce_checkout_order_review', 'woocommerce_order_review', 10 );
}
/**
* Remove `woocommerce_cart_collaterals` hook.
*
* @since 4.14.0
*/
public static function detach_wc_cart_totals() {
remove_action(
'woocommerce_cart_collaterals',
'woocommerce_cart_totals',
10
);
}
/**
* Enable `woocommerce_cart_collaterals` hook.
*
* @since 4.14.0
*/
public static function attach_wc_cart_totals() {
add_action( 'woocommerce_cart_collaterals', 'woocommerce_cart_totals', 10 );
}
/**
* Gets the required HTML data attributes based on the button name and slug.
*
* @param array $module_props Module attributes.
* @param string $btn_slug Shortcode attribute name (i.e button_{device}).
* @param string $btn_class Class name of the button to target in JS.
*
* @return array
*/
public static function get_button_icon_attrs( $module_props, $btn_slug = 'button', $btn_class = 'button' ) {
$attrs = array();
// Get Icon values based on Device.
$custom_icon_values = et_pb_responsive_options()->get_property_values( $module_props, "{$btn_slug}_icon", '', true );
$custom_icon = et_()->array_get( $custom_icon_values, 'desktop' );
$custom_icon_tablet = et_()->array_get( $custom_icon_values, 'tablet' );
$custom_icon_phone = et_()->array_get( $custom_icon_values, 'phone' );
if ( empty( $btn_name ) ) {
$btn_name = 'button';
}
$icon_values = array(
"data-{$btn_name}-icon" => $custom_icon,
"data-{$btn_name}-icon-tablet" => $custom_icon_tablet,
"data-{$btn_name}-icon-phone" => $custom_icon_phone,
);
// Verify if Custom icon value exists at least in one of Desktop / Tablet / Phone.
$has_custom_icon = count( array_filter( $icon_values ) ) > 0;
if ( ! $has_custom_icon ) {
return $attrs;
}
$attrs['data-button-class'] = et_core_intentionally_unescaped( $btn_class, 'fixed_string' );
// Get the icon data-* attributes based on values set in DB.
foreach ( $icon_values as $attr_name => $attr_value ) {
if ( empty( $attr_value ) ) {
continue;
}
$attrs[ $attr_name ] = esc_attr( et_pb_process_font_icon( $attr_value ) );
}
return $attrs;
}
/**
* Sets the Button's data-* attrs for the Icons to render.
*
* These attributes are set on the outer wrapper & will be set on the Button elements using JS.
*
* @param array $module_props Module attributes/properties.
*
* @return array
*/
public static function add_custom_icon_attrs( $module_props ) {
if ( ! is_array( $module_props ) || empty( $module_props ) ) {
return array();
}
$btn_attrs = self::get_button_icon_attrs( $module_props );
return $btn_attrs;
}
/**
* Adds mock Products to Cart.
*
* Otherwise Checkout modules won't output content. The output is made visible only to VB.
*
* @param array $cart_contents Cart contents.
*
* @return array
* @since 4.14.0
*/
public static function set_dummy_cart_contents( $cart_contents ) {
if ( ! is_array( $cart_contents ) ) {
return $cart_contents;
}
$cart_contents = array();
$fake_products = array(
999 => array(
'name' => esc_html__( 'Product 1', 'et_builder' ),
'price' => '12.00',
'quantity' => 3,
),
1000 => array(
'name' => esc_html__( 'Product 2', 'et_builder' ),
'price' => '75.00',
'quantity' => 1,
),
1001 => array(
'name' => esc_html__( 'Product 3', 'et_builder' ),
'price' => '38.00',
'quantity' => 2,
),
);
foreach ( $fake_products as $id => $details ) {
$product = new ET_Builder_Woocommerce_Product_Simple_Placeholder();
$product->set_name( $details['name'] );
$product->set_id( $id );
$product->set_price( $details['price'] );
$cart_item_key = WC()->cart->generate_cart_id( $product->get_id() );
$cart_contents[ $cart_item_key ] = array(
'key' => $cart_item_key,
'product_id' => $product->get_id(),
'variation_id' => 0,
'variation' => array(),
'quantity' => $details['quantity'],
'data' => $product,
'data_hash' => wc_get_cart_item_data_hash( $product ),
);
}
return $cart_contents;
}
/**
* Get the product default.
*
* @return array
*/
public static function get_page_type_default() {
return array(
'filter',
'et_builder_get_woo_default_page_type',
);
}
/**
* Get the Page Type default based on the Cart & Checkout pages.
*
* @since 4.14.0
*
* @return string
*/
public static function get_page_type_default_value() {
$is_cart_page = function_exists( 'is_cart' ) && is_cart();
$is_checkout_page = function_exists( 'is_checkout' ) && is_checkout();
if ( $is_cart_page ) {
return 'cart';
} elseif ( $is_checkout_page ) {
return 'checkout';
} else {
return 'product';
}
}
/**
* Gets the TB Post ID That Uses Body Template.
*
* @param int $post_id Post ID.
*
* @return mixed Template Post ID.
*/
public static function get_tb_template_id_by_current_page_id( $post_id ) {
if ( ! $post_id ) {
return;
}
$args = array(
'post_type' => 'et_template',
'meta_query' => array(
array(
'key' => '_et_body_layout_id',
'value' => $post_id,
),
),
);
$query = new WP_Query( $args );
$template_id = 0;
while ( $query->have_posts() ) {
the_post();
$template_id = get_the_ID();
if ( 0 !== $template_id ) {
break;
}
}
wp_reset_postdata();
return $template_id;
}
}
add_filter(
@@ -983,4 +1533,12 @@ if ( et_is_woocommerce_plugin_active() ) {
'get_woo_default_tabs_options',
)
);
add_filter(
'et_builder_get_woo_default_page_type',
array(
'ET_Builder_Module_Helper_Woocommerce_Modules',
'get_page_type_default_value',
)
);
}
+93 -19
View File
@@ -1,10 +1,10 @@
<?php
/**
* Main migartion class.
* Main migration class.
*
* @package Divi
* @package Divi
* @subpackage Builder
* @since ?
* @since ?
*/
/**
@@ -14,6 +14,7 @@
*/
abstract class ET_Builder_Module_Settings_Migration {
/**
* Used to exclude names in case of BB.
*
@@ -68,7 +69,7 @@ abstract class ET_Builder_Module_Settings_Migration {
*
* @var string
*/
public static $max_version = '4.13.0';
public static $max_version = '4.16';
/**
* Array of already migrated data.
@@ -80,7 +81,7 @@ abstract class ET_Builder_Module_Settings_Migration {
/**
* Array of migrations in format( [ 'version' => 'name of migration script' ] ).
*
* @var array
* @var string[]
*/
public static $migrations = array(
'3.0.48' => 'BackgroundUI',
@@ -107,6 +108,10 @@ abstract class ET_Builder_Module_Settings_Migration {
'3.25.3' => 'ShopOrderByDefault',
'3.27.4' => 'TextAlignment',
'4.13.0' => 'IconManager',
'4.13.1' => 'ContactFormUniqueID',
'4.14.0' => 'WooTextOG',
'4.15' => 'BackgroundGradientOverlaysImage',
'4.16' => 'BackgroundGradientStops',
);
/**
@@ -158,7 +163,7 @@ abstract class ET_Builder_Module_Settings_Migration {
}
// For the BB...
if ( ! in_array( $old_name, self::$_bb_excluded_name_changes ) ) {
if ( ! in_array( $old_name, self::$_bb_excluded_name_changes, true ) ) {
self::$migrated['field_name_changes'][ $module_slug ][ $old_name ] = array(
'new_name' => $new_name,
'version' => $version,
@@ -189,7 +194,8 @@ abstract class ET_Builder_Module_Settings_Migration {
}
if ( is_string( $migration ) ) {
self::$migrations[ $version ] = $migration = require_once "migration/{$migration}.php";
$migration = require_once "migration/{$migration}.php";
self::$migrations[ $version ] = $migration;
}
self::$migrations_by_version[ $module_version ][] = $migration;
@@ -205,14 +211,14 @@ abstract class ET_Builder_Module_Settings_Migration {
}
public function handle_field_name_migrations( $fields, $module_slug ) {
if ( ! in_array( $module_slug, $this->modules ) ) {
if ( ! in_array( $module_slug, $this->modules, true ) ) {
return $fields;
}
foreach ( $this->fields as $field_name => $field_info ) {
foreach ( $field_info['affected_fields'] as $affected_field => $affected_modules ) {
if ( $affected_field === $field_name || ! in_array( $module_slug, $affected_modules ) ) {
if ( $affected_field === $field_name || ! in_array( $module_slug, $affected_modules, true ) ) {
continue;
}
@@ -227,8 +233,8 @@ abstract class ET_Builder_Module_Settings_Migration {
}
return isset( self::$field_name_migrations[ $module_slug ] )
? self::_migrate_field_names( $fields, $module_slug, $this->version )
: $fields;
? self::_migrate_field_names( $fields, $module_slug, $this->version )
: $fields;
}
public static function init() {
@@ -239,6 +245,22 @@ abstract class ET_Builder_Module_Settings_Migration {
add_filter( 'et_pb_module_content', array( $class, 'maybe_override_content' ), 10, 6 );
}
/**
* Remove added filters.
*
* Used by WPUnit tests.
*
* @since 4.16.0
* @link https://make.wordpress.org/core/handbook/testing/automated-testing/writing-phpunit-tests/#shared-setup-between-related-tests
*/
public static function tear_down() {
$class = 'ET_Builder_Module_Settings_Migration';
remove_filter( 'et_pb_module_processed_fields', array( $class, 'maybe_override_processed_fields' ) );
remove_filter( 'et_pb_module_shortcode_attributes', array( $class, 'maybe_override_shortcode_attributes' ) );
remove_filter( 'et_pb_module_content', array( $class, 'maybe_override_content' ) );
}
public static function maybe_override_processed_fields( $fields, $module_slug ) {
if ( ! $fields ) {
return $fields;
@@ -247,7 +269,7 @@ abstract class ET_Builder_Module_Settings_Migration {
$migrations = self::get_migrations( 'all' );
foreach ( $migrations as $migration ) {
if ( in_array( $module_slug, $migration->modules ) ) {
if ( in_array( $module_slug, $migration->modules, true ) ) {
$fields = $migration->handle_field_name_migrations( $fields, $module_slug );
}
}
@@ -255,6 +277,20 @@ abstract class ET_Builder_Module_Settings_Migration {
return $fields;
}
/**
* Maybe override shortcode attributes.
*
* @param array $attrs Shortcode attributes.
* @param array $unprocessed_attrs Attributes that have not yet been processed.
* @param string $module_slug Internal system name for the module type.
* @param string $module_address Location of the current module on the page.
* @param string $content Text/HTML content within the current module.
* @param bool $maybe_global_presets_migration Whether to include global presets.
*
* @since 4.17.1 If a `null` value is returned from `migrate()`, unset the attribute.
*
* @return array
*/
public static function maybe_override_shortcode_attributes( $attrs, $unprocessed_attrs, $module_slug, $module_address, $content = '', $maybe_global_presets_migration = false ) {
if ( empty( $attrs['_builder_version'] ) ) {
$attrs['_builder_version'] = '3.0.47';
@@ -283,35 +319,59 @@ abstract class ET_Builder_Module_Settings_Migration {
foreach ( $migrations as $migration ) {
$migrated_attrs_count = 0;
if ( ! in_array( $module_slug, $migration->modules ) ) {
if ( ! in_array( $module_slug, $migration->modules, true ) ) {
continue;
}
$migration_fields = $migration->fields;
// It needs for IconManager's wpunit tests when it is necessary to test the migration of module posts attributes
// and migration of global presets within the same test session
// ( because migration fields array is depending on self::$_maybe_global_presets_migration variable ).
$migration_fields = ( 'ET_Builder_Module_Settings_Migration_IconManager' === get_class( $migration ) ) ? $migration->get_fields() : $migration->fields;
$classes_requiring_presets_migration = array(
'ET_Builder_Module_Settings_Migration_IconManager',
'ET_Builder_Module_Settings_Migration_BackgroundGradientStops',
);
if ( in_array( get_class( $migration ), $classes_requiring_presets_migration, true ) ) {
$migration_fields = $migration->get_fields();
}
// Each "migration field" is an object with a field name (key) and field info (property/value pairs).
foreach ( $migration_fields as $field_name => $field_info ) {
// Each "affected field" is a field name (key) with a list of modules that use that field name.
foreach ( $field_info['affected_fields'] as $affected_field => $affected_modules ) {
if ( ( ! $migration->add_missing_fields && ! isset( $attrs[ $affected_field ] ) ) || ! in_array( $module_slug, $affected_modules ) ) {
// Skip [what are we skipping?] if either:
// * there is no instruction to add missing fields AND the "affected field" is missing
// * this module isn't in the list of matching modules that use the field name.
if ( ( ! $migration->add_missing_fields && ! isset( $attrs[ $affected_field ] ) ) || ! in_array( $module_slug, $affected_modules, true ) ) {
continue;
}
// If the "migration field" name and the "affected field" name are different,
// then add the affected field name to the "unprocessed_attrs" list.
if ( $affected_field !== $field_name ) {
// Field name changed
// Field name changed.
$unprocessed_attrs[ $field_name ] = $attrs[ $affected_field ];
}
// If a value is set in the "unprocessed_attrs" list for the current field we're
// looking at (field_name), then inherit that value as the "before" state.
$current_value = isset( $unprocessed_attrs[ $field_name ] ) ? $unprocessed_attrs[ $field_name ] : '';
$saved_value = isset( $attrs[ $field_name ] ) ? $attrs[ $field_name ] : '';
$new_value = $migration->migrate( $field_name, $current_value, $module_slug, $saved_value, $affected_field, $attrs, $content, $module_address );
// If a null value was returned, then we want to unset this attribute.
if ( is_null( $new_value ) ) {
continue;
}
if ( $new_value !== $saved_value || ( $affected_field !== $field_name && $new_value !== $current_value ) ) {
$attrs[ $field_name ] = self::$migrated['value_changes'][ $module_address ][ $field_name ] = $new_value;
self::$migrated['value_changes'][ $module_address ][ $field_name ] = $new_value;
$attrs[ $field_name ] = $new_value;
$migrated_attrs_count++;
}
}
@@ -339,7 +399,7 @@ abstract class ET_Builder_Module_Settings_Migration {
foreach ( $migrations as $migration ) {
$migrated_content = false;
if ( ! in_array( $module_slug, $migration->get_content_migration_modules() ) ) {
if ( ! in_array( $module_slug, $migration->get_content_migration_modules(), true ) ) {
continue;
}
@@ -369,7 +429,21 @@ abstract class ET_Builder_Module_Settings_Migration {
}
public static function _should_handle_render( $slug ) {
if ( false === strpos( $slug, 'et_pb' ) ) {
// Get all module slugs to compare against this slug. This way, we're
// not trying to process any and every shortcode, only Divi modules.
$all_module_slugs = ET_Builder_Element::get_all_module_slugs();
$slug_match = false;
foreach ( $all_module_slugs as $module_slug ) {
if ( $module_slug !== $slug ) {
continue;
}
$slug_match = $module_slug;
break;
}
if ( ! $slug_match ) {
return false;
}
@@ -0,0 +1,318 @@
<?php
/**
* ET_Builder_Module_Settings_Migration_BackgroundGradientOverlaysImage.
*
* @package Divi
* @subpackage Builder
* @since 4.15.0
*/
/**
* Migrate Background Color Gradient Overlays Image option to 'off' based on condition.
*
* This migration will check three existing settings, and update as following:
*
* OLD:
* - use_background_color_gradient: on
* - background_color_gradient_overlays_image: on
* - parallax: on
*
* NEW:
* - background_color_gradient_overlays_image: off
*
* @package Divi
* @subpackage Builder/Migration
* @since 4.15.0
*/
/**
* Background Gradient Overlays Image migrations class.
*/
class ET_Builder_Module_Settings_Migration_BackgroundGradientOverlaysImage extends ET_Builder_Module_Settings_Migration {
/**
* The Divi release where this migration was introduced.
*
* @var string
*
* @since 4.15.0
*/
public $version = '4.15';
/**
* Array of modules to inspect for settings to migrate.
*
* Pass attribute and it will return selected modules only. Default return all affected modules.
*
* @param string $attr Attribute name.
*
* @return array
*
* @since 4.15.0
*/
public function get_modules( $attr = '' ) {
$modules = array();
// Background.
if ( in_array( $attr, array( '', 'module_bg' ), true ) ) {
// Structure Elements.
$modules[] = 'et_pb_column_inner';
$modules[] = 'et_pb_column_specialty';
$modules[] = 'et_pb_column';
$modules[] = 'et_pb_section_fullwidth';
$modules[] = 'et_pb_section_specialty';
$modules[] = 'et_pb_section';
$modules[] = 'et_pb_row_inner';
$modules[] = 'et_pb_row';
// Divi Content Modules.
$modules[] = 'et_pb_accordion_item';
$modules[] = 'et_pb_accordion';
$modules[] = 'et_pb_audio';
$modules[] = 'et_pb_blog';
$modules[] = 'et_pb_blurb';
$modules[] = 'et_pb_circle_counter';
$modules[] = 'et_pb_code';
$modules[] = 'et_pb_comments';
$modules[] = 'et_pb_contact_field';
$modules[] = 'et_pb_contact_form';
$modules[] = 'et_pb_countdown_timer';
$modules[] = 'et_pb_counter';
$modules[] = 'et_pb_counters';
$modules[] = 'et_pb_cta';
$modules[] = 'et_pb_divider';
$modules[] = 'et_pb_filterable_portfolio';
$modules[] = 'et_pb_gallery';
$modules[] = 'et_pb_image';
$modules[] = 'et_pb_login';
$modules[] = 'et_pb_map';
$modules[] = 'et_pb_menu';
$modules[] = 'et_pb_number_counter';
$modules[] = 'et_pb_portfolio';
$modules[] = 'et_pb_post_content';
$modules[] = 'et_pb_post_nav';
$modules[] = 'et_pb_post_slider';
$modules[] = 'et_pb_post_title';
$modules[] = 'et_pb_pricing_table';
$modules[] = 'et_pb_pricing_tables';
$modules[] = 'et_pb_search';
$modules[] = 'et_pb_shop';
$modules[] = 'et_pb_sidebar';
$modules[] = 'et_pb_signup_custom_field';
$modules[] = 'et_pb_signup';
$modules[] = 'et_pb_slide_fullwidth';
$modules[] = 'et_pb_slide';
$modules[] = 'et_pb_slider';
$modules[] = 'et_pb_social_media_follow';
$modules[] = 'et_pb_tab';
$modules[] = 'et_pb_tabs';
$modules[] = 'et_pb_team_member';
$modules[] = 'et_pb_testimonial';
$modules[] = 'et_pb_text';
$modules[] = 'et_pb_toggle';
$modules[] = 'et_pb_video_slider';
$modules[] = 'et_pb_video';
$modules[] = 'et_pb_fullwidth_code';
$modules[] = 'et_pb_fullwidth_header';
$modules[] = 'et_pb_fullwidth_image';
$modules[] = 'et_pb_fullwidth_map';
$modules[] = 'et_pb_fullwidth_menu';
$modules[] = 'et_pb_fullwidth_portfolio';
$modules[] = 'et_pb_fullwidth_post_content';
$modules[] = 'et_pb_fullwidth_post_slider';
$modules[] = 'et_pb_fullwidth_post_title';
$modules[] = 'et_pb_fullwidth_slider';
// WooCommerce Modules.
$modules[] = 'et_pb_wc_add_to_cart';
$modules[] = 'et_pb_wc_additional_info';
$modules[] = 'et_pb_wc_breadcrumb';
$modules[] = 'et_pb_wc_cart_notice';
$modules[] = 'et_pb_wc_description';
$modules[] = 'et_pb_wc_gallery';
$modules[] = 'et_pb_wc_images';
$modules[] = 'et_pb_wc_meta';
$modules[] = 'et_pb_wc_price';
$modules[] = 'et_pb_wc_rating';
$modules[] = 'et_pb_wc_related_products';
$modules[] = 'et_pb_wc_reviews';
$modules[] = 'et_pb_wc_stock';
$modules[] = 'et_pb_wc_tabs';
$modules[] = 'et_pb_wc_title';
$modules[] = 'et_pb_wc_upsells';
}
return $modules;
}
/**
* Get fields that are affected by this migration.
*
* @return array
*
* @since 4.15.0
*/
public function get_fields() {
return array(
'background_color_gradient_overlays_image' => array(
'affected_fields' => array(
'background_color_gradient_overlays_image' => $this->get_modules( 'module_bg' ),
),
),
'background_color_gradient_overlays_image_tablet' => array(
'affected_fields' => array(
'background_color_gradient_overlays_image_tablet' => $this->get_modules( 'module_bg' ),
),
),
'background_color_gradient_overlays_image_phone' => array(
'affected_fields' => array(
'background_color_gradient_overlays_image_phone' => $this->get_modules( 'module_bg' ),
),
),
'background_color_gradient_overlays_image__hover' => array(
'affected_fields' => array(
'background_color_gradient_overlays_image__hover' => $this->get_modules( 'module_bg' ),
),
),
'background_color_gradient_overlays_image__sticky' => array(
'affected_fields' => array(
'background_color_gradient_overlays_image__sticky' => $this->get_modules( 'module_bg' ),
),
),
);
}
/**
* Migrate.
*
* @param string $to_field_name This migration's target field.
* @param string|array $affected_field_value Affected field reference value.
* @param string|number $module_slug Current module type.
* @param string $to_field_value Migration target's current value.
* @param string $affected_field_name Affected field attribute name.
* @param array $module_attrs Current module's full attributes.
* @param string $module_content Current module's content.
* @param string|number $module_address Current module's address.
*
* @return string
*
* @since 4.15.0
*/
public function migrate(
$to_field_name,
$affected_field_value,
$module_slug,
$to_field_value,
$affected_field_name,
$module_attrs,
$module_content,
$module_address
) {
// Early exit if affected field ("Use Gradient" or "Parallax") is not "on".
if ( 'on' !== $affected_field_value ) {
return $affected_field_value;
}
$default_settings = array(
'use_gradient' => 'off',
'overlays_image' => ET_Global_Settings::get_value( 'all_background_gradient_overlays_image' ),
'parallax' => 'off',
);
$old_values = $default_settings;
// Collect the old settings.
switch ( $affected_field_name ) {
// Desktop View.
case 'background_color_gradient_overlays_image':
if ( ! isset( $module_attrs[ $affected_field_name ] ) ) {
return $affected_field_value;
} else {
$old_values['use_gradient'] = $this->_get_attr_value( 'use_background_color_gradient', $module_attrs );
$old_values['overlays_image'] = $this->_get_attr_value( 'background_color_gradient_overlays_image', $module_attrs );
$old_values['parallax'] = $this->_get_attr_value( 'parallax', $module_attrs );
}
break;
// Tablet View.
case 'background_color_gradient_overlays_image_tablet':
if ( ! isset( $module_attrs[ $affected_field_name ] ) ) {
return $affected_field_value;
} else {
$old_values['use_gradient'] = $this->_get_attr_value( 'use_background_color_gradient_tablet', $module_attrs );
$old_values['overlays_image'] = $this->_get_attr_value( 'background_color_gradient_overlays_image_tablet', $module_attrs );
$old_values['parallax'] = $this->_get_attr_value( 'parallax_tablet', $module_attrs );
}
break;
// Phone View.
case 'background_color_gradient_overlays_image_phone':
if ( ! isset( $module_attrs[ $affected_field_name ] ) ) {
return $affected_field_value;
} else {
$old_values['use_gradient'] = $this->_get_attr_value( 'use_background_color_gradient_phone', $module_attrs );
$old_values['overlays_image'] = $this->_get_attr_value( 'background_color_gradient_overlays_image_phone', $module_attrs );
$old_values['parallax'] = $this->_get_attr_value( 'parallax_phone', $module_attrs );
}
break;
// Hover Mode.
case 'background_color_gradient_overlays_image__hover':
if ( ! isset( $module_attrs[ $affected_field_name ] ) ) {
return $affected_field_value;
} else {
$old_values['use_gradient'] = $this->_get_attr_value( 'use_background_color_gradient__hover', $module_attrs );
$old_values['overlays_image'] = $this->_get_attr_value( 'background_color_gradient_overlays_image__hover', $module_attrs );
$old_values['parallax'] = $this->_get_attr_value( 'parallax__hover', $module_attrs );
}
break;
// Sticky Mode.
case 'background_color_gradient_overlays_image__sticky':
if ( ! isset( $module_attrs[ $affected_field_name ] ) ) {
return $affected_field_value;
} else {
$old_values['use_gradient'] = $this->_get_attr_value( 'use_background_color_gradient__sticky', $module_attrs );
$old_values['overlays_image'] = $this->_get_attr_value( 'background_color_gradient_overlays_image__sticky', $module_attrs );
$old_values['parallax'] = $this->_get_attr_value( 'parallax__sticky', $module_attrs );
}
break;
default:
return $affected_field_value;
}
// If overlays_image aren't defined, pull in global default settings.
if ( empty( $old_values['use_gradient'] ) ) {
$old_values['use_gradient'] = $default_settings['use_gradient'];
}
if ( empty( $old_values['overlays_image'] ) ) {
$old_values['overlays_image'] = $default_settings['overlays_image'];
}
if ( empty( $old_values['parallax'] ) ) {
$old_values['parallax'] = $default_settings['parallax'];
}
// New value for overlays_image.
return 'on' === $old_values['use_gradient'] && 'on' === $old_values['overlays_image'] && 'on' === $old_values['parallax']
? 'off' : $affected_field_value;
}
/**
* Get attributes value by field_name.
*
* @param string $field_name Field name.
* @param array $module_attrs Module's full attributes.
*
* @return string
*/
private function _get_attr_value( $field_name, $module_attrs ) {
if ( array_key_exists( $field_name, $module_attrs ) ) {
return $module_attrs[ $field_name ];
}
return '';
}
}
return new ET_Builder_Module_Settings_Migration_BackgroundGradientOverlaysImage();
File diff suppressed because it is too large Load Diff
@@ -66,14 +66,15 @@ class ET_Builder_Module_Settings_Migration_ColumnOptions extends ET_Builder_Modu
'custom_css_main',
'custom_css_after',
'use_background_color_gradient',
'background_color_gradient_stops',
'background_color_gradient_type',
'background_color_gradient_direction',
'background_color_gradient_direction_radial',
'background_color_gradient_overlays_image',
'background_color_gradient_start',
'background_color_gradient_end',
'background_color_gradient_start_position',
'background_color_gradient_end_position',
'background_color_gradient_overlays_image',
'background_video_mp4',
'background_video_webm',
'background_video_width',
@@ -0,0 +1,85 @@
<?php
/**
* ET_Builder_Module_Settings_Migration_ContactFormUniqueID class file.
*
* @class ET_Builder_Module_Settings_Migration_ContactFormUniqueID
* @package Builder/Module/Settings/Migration
*/
/**
* Migration process to fill in missing unique_id attribute on Contact Form module.
*
* @since 4.13.1
*/
class ET_Builder_Module_Settings_Migration_ContactFormUniqueID extends ET_Builder_Module_Settings_Migration {
/**
* Migration Version
*
* @since 4.13.1
*
* @var string
*/
public $version = '4.13.1';
/**
* Get the field that need to be migrated.
*
* Contains array with:
* - key as new field
* - value consists affected fields as old field and module location
*
* @since 4.13.1
*
* @return array New and old fields need to be migrated.
*/
public function get_fields() {
return array(
// Unique ID of Contact Form module.
'_unique_id' => array(
'affected_fields' => array(
'_unique_id' => $this->get_modules(),
),
),
);
}
/**
* Get all modules affected.
*
* @since 4.13.1
*
* @return array
*/
public function get_modules() {
return array( 'et_pb_contact_form' );
}
/**
* Run migrate process.
*
* @since 4.13.1
*
* @param string $field_name Field name.
* @param string $current_value Current value.
* @param string $module_slug Module slug.
* @param string $saved_value Saved value.
* @param string $saved_field_name Saved field name.
* @param string $attrs Module attributes values.
* @param string $content Module content.
* @param string $module_address Module address.
*
* @return string New value.
*/
public function migrate( $field_name, $current_value, $module_slug, $saved_value, $saved_field_name, $attrs, $content, $module_address ) {
// Setup unique ID for Contact Form module. Only do this when the current page is
// builder and not on the FE because it mays create incorrect unique ID.
if ( '_unique_id' === $field_name && function_exists( 'et_fb_is_enabled' ) && et_fb_is_enabled() ) {
return ET_Core_Data_Utils::uuid_v4();
}
return $current_value;
}
}
return new ET_Builder_Module_Settings_Migration_ContactFormUniqueID();
@@ -526,7 +526,7 @@ class ET_Builder_Module_Settings_Migration_IconManager extends ET_Builder_Module
return '';
}
return et_pb_process_font_icon( $this->_current_value ) . '||divi||' . et_pb_get_normal_font_weight_value();
return et_pb_build_extended_font_icon_value( $this->_current_value );
}
/**
@@ -0,0 +1,632 @@
<?php
/**
* Migration: Woo v2 modules
*
* Contains Woo Notice and Woo Add to cart modules migrations.
*
* @since 4.14.0
* @package Divi
*/
defined( 'ABSPATH' ) || exit;
/**
* Text OG Migration Class.
*
* Migrates Text OG fields to Title OG in Woo Cart Notice.
* Migrates Text OG fields to Field Labels OG in Woo Add to Cart.
*/
class ET_Builder_Module_Settings_Migration_WooTextOG extends ET_Builder_Module_Settings_Migration {
/**
* Gets the modules that needs migration.
*
* @used-by ET_Builder_Module_Settings_Migration::handle_field_name_migrations()
*
* @return string[]
*/
public function get_modules() {
return array(
'et_pb_wc_cart_notice',
'et_pb_wc_add_to_cart',
);
}
// phpcs:ignore Squiz.Commenting.FunctionComment.Missing -- Paresh's PR contains function comment.
public function get_fields() {
// phpcs:disable WordPress.Arrays.MultipleStatementAlignment.DoubleArrowNotAligned -- Invalid warning.
// phpcs:disable WordPress.Arrays.MultipleStatementAlignment.LongIndexSpaceBeforeDoubleArrow -- Invalid warning.
return array(
// Migration 01: Cart Notice.
// Text Font, weight & style.
'title_font' => array(
'affected_fields' => array(
'body_font' => array( 'et_pb_wc_cart_notice' ),
),
),
'title_font_last_edited' => array(
'affected_fields' => array(
'body_font_last_edited' => array( 'et_pb_wc_cart_notice' ),
),
),
'title_font_tablet' => array(
'affected_fields' => array(
'body_font_tablet' => array( 'et_pb_wc_cart_notice' ),
),
),
'title_font_phone' => array(
'affected_fields' => array(
'body_font_phone' => array( 'et_pb_wc_cart_notice' ),
),
),
// Text Color.
'title_text_color' => array(
'affected_fields' => array(
'body_text_color' => array( 'et_pb_wc_cart_notice' ),
),
),
'title_text_color_last_edited' => array(
'affected_fields' => array(
'body_text_color_last_edited' => array( 'et_pb_wc_cart_notice' ),
),
),
'title_text_color_tablet' => array(
'affected_fields' => array(
'body_text_color_tablet' => array( 'et_pb_wc_cart_notice' ),
),
),
'title_text_color_phone' => array(
'affected_fields' => array(
'body_text_color_phone' => array( 'et_pb_wc_cart_notice' ),
),
),
'title_text_color__hover_enabled' => array(
'affected_fields' => array(
'body_text_color__hover_enabled' => array( 'et_pb_wc_cart_notice' ),
),
),
'title_text_color__hover' => array(
'affected_fields' => array(
'body_text_color__hover' => array( 'et_pb_wc_cart_notice' ),
),
),
// Text Size.
'title_font_size' => array(
'affected_fields' => array(
'body_font_size' => array( 'et_pb_wc_cart_notice' ),
),
),
'title_font_size_last_edited' => array(
'affected_fields' => array(
'body_font_size_last_edited' => array( 'et_pb_wc_cart_notice' ),
),
),
'title_font_size_tablet' => array(
'affected_fields' => array(
'body_font_size_tablet' => array( 'et_pb_wc_cart_notice' ),
),
),
'title_font_size_phone' => array(
'affected_fields' => array(
'body_font_size_phone' => array( 'et_pb_wc_cart_notice' ),
),
),
'title_font_size__hover_enabled' => array(
'affected_fields' => array(
'body_font_size__hover_enabled' => array( 'et_pb_wc_cart_notice' ),
),
),
'title_font_size__hover' => array(
'affected_fields' => array(
'body_font_size__hover' => array( 'et_pb_wc_cart_notice' ),
),
),
// Text Letter spacing.
'title_letter_spacing' => array(
'affected_fields' => array(
'body_letter_spacing' => array( 'et_pb_wc_cart_notice' ),
),
),
'title_letter_spacing_last_edited' => array(
'affected_fields' => array(
'body_letter_spacing_last_edited' => array( 'et_pb_wc_cart_notice' ),
),
),
'title_letter_spacing_tablet' => array(
'affected_fields' => array(
'body_letter_spacing_tablet' => array( 'et_pb_wc_cart_notice' ),
),
),
'title_letter_spacing_phone' => array(
'affected_fields' => array(
'body_letter_spacing_phone' => array( 'et_pb_wc_cart_notice' ),
),
),
'title_letter_spacing__hover_enabled' => array(
'affected_fields' => array(
'body_letter_spacing__hover_enabled' => array( 'et_pb_wc_cart_notice' ),
),
),
'title_letter_spacing__hover' => array(
'affected_fields' => array(
'body_letter_spacing__hover' => array( 'et_pb_wc_cart_notice' ),
),
),
// Text Line height.
'title_line_height' => array(
'affected_fields' => array(
'body_line_height' => array( 'et_pb_wc_cart_notice' ),
),
),
'title_line_height_last_edited' => array(
'affected_fields' => array(
'body_line_height_last_edited' => array( 'et_pb_wc_cart_notice' ),
),
),
'title_line_height_tablet' => array(
'affected_fields' => array(
'body_line_height_tablet' => array( 'et_pb_wc_cart_notice' ),
),
),
'title_line_height_phone' => array(
'affected_fields' => array(
'body_line_height_phone' => array( 'et_pb_wc_cart_notice' ),
),
),
'title_line_height__hover_enabled' => array(
'affected_fields' => array(
'body_line_height__hover_enabled' => array( 'et_pb_wc_cart_notice' ),
),
),
'title_line_height__hover' => array(
'affected_fields' => array(
'body_line_height__hover' => array( 'et_pb_wc_cart_notice' ),
),
),
// Text horizontal shadow.
'title_text_shadow_style' => array(
'affected_fields' => array(
'body_text_shadow_style' => array( 'et_pb_wc_cart_notice' ),
),
),
'title_text_shadow_horizontal_length' => array(
'affected_fields' => array(
'body_text_shadow_horizontal_length' => array( 'et_pb_wc_cart_notice' ),
),
),
'title_text_shadow_horizontal_length_last_edited' => array(
'affected_fields' => array(
'body_text_shadow_horizontal_length_last_edited' => array( 'et_pb_wc_cart_notice' ),
),
),
'title_text_shadow_horizontal_length_tablet' => array(
'affected_fields' => array(
'body_text_shadow_horizontal_length_tablet' => array( 'et_pb_wc_cart_notice' ),
),
),
'title_text_shadow_horizontal_length_phone' => array(
'affected_fields' => array(
'body_text_shadow_horizontal_length_phone' => array( 'et_pb_wc_cart_notice' ),
),
),
'title_text_shadow_horizontal_length__hover_enabled' => array(
'affected_fields' => array(
'body_text_shadow_horizontal_length__hover_enabled' => array( 'et_pb_wc_cart_notice' ),
),
),
'title_text_shadow_horizontal_length__hover' => array(
'affected_fields' => array(
'body_text_shadow_horizontal_length__hover' => array( 'et_pb_wc_cart_notice' ),
),
),
// Text vertical shadow.
'title_text_shadow_vertical_length' => array(
'affected_fields' => array(
'body_text_shadow_vertical_length' => array( 'et_pb_wc_cart_notice' ),
),
),
'title_text_shadow_vertical_length_last_edited' => array(
'affected_fields' => array(
'body_text_shadow_vertical_length_last_edited' => array( 'et_pb_wc_cart_notice' ),
),
),
'title_text_shadow_vertical_length_tablet' => array(
'affected_fields' => array(
'body_text_shadow_vertical_length_tablet' => array( 'et_pb_wc_cart_notice' ),
),
),
'title_text_shadow_vertical_length_phone' => array(
'affected_fields' => array(
'body_text_shadow_vertical_length_phone' => array( 'et_pb_wc_cart_notice' ),
),
),
'title_text_shadow_vertical_length__hover_enabled' => array(
'affected_fields' => array(
'body_text_shadow_vertical_length__hover_enabled' => array( 'et_pb_wc_cart_notice' ),
),
),
'title_text_shadow_vertical_length__hover' => array(
'affected_fields' => array(
'body_text_shadow_vertical_length__hover' => array( 'et_pb_wc_cart_notice' ),
),
),
// Text Blur strength.
'title_text_shadow_blur_strength' => array(
'affected_fields' => array(
'body_text_shadow_blur_strength' => array( 'et_pb_wc_cart_notice' ),
),
),
'title_text_shadow_blur_strength_last_edited' => array(
'affected_fields' => array(
'body_text_shadow_blur_strength_last_edited' => array( 'et_pb_wc_cart_notice' ),
),
),
'title_text_shadow_blur_strength_tablet' => array(
'affected_fields' => array(
'body_text_shadow_blur_strength_tablet' => array( 'et_pb_wc_cart_notice' ),
),
),
'title_body_text_shadow_blur_strength_phone' => array(
'affected_fields' => array(
'body_text_shadow_blur_strength_phone' => array( 'et_pb_wc_cart_notice' ),
),
),
'title_text_shadow_blur_strength__hover_enabled' => array(
'affected_fields' => array(
'body_text_shadow_blur_strength__hover_enabled' => array( 'et_pb_wc_cart_notice' ),
),
),
'title_text_shadow_blur_strength__hover' => array(
'affected_fields' => array(
'body_text_shadow_blur_strength__hover' => array( 'et_pb_wc_cart_notice' ),
),
),
// Text Shadow color.
'title_text_shadow_color' => array(
'affected_fields' => array(
'body_text_shadow_color' => array( 'et_pb_wc_cart_notice' ),
),
),
'title_text_shadow_color_last_edited' => array(
'affected_fields' => array(
'body_text_shadow_color_last_edited' => array( 'et_pb_wc_cart_notice' ),
),
),
'title_text_shadow_color_tablet' => array(
'affected_fields' => array(
'body_text_shadow_color_tablet' => array( 'et_pb_wc_cart_notice' ),
),
),
'title_text_shadow_color_phone' => array(
'affected_fields' => array(
'body_text_shadow_color_phone' => array( 'et_pb_wc_cart_notice' ),
),
),
'title_text_shadow_color__hover_enabled' => array(
'affected_fields' => array(
'body_text_shadow_color__hover_enabled' => array( 'et_pb_wc_cart_notice' ),
),
),
'title_text_shadow_color__hover' => array(
'affected_fields' => array(
'body_text_shadow_color__hover' => array( 'et_pb_wc_cart_notice' ),
),
),
// Migration 01: Add to Cart.
// Text Font, weight & style.
'field_label_font' => array(
'affected_fields' => array(
'body_font' => array( 'et_pb_wc_add_to_cart' ),
),
),
'field_label_font_last_edited' => array(
'affected_fields' => array(
'body_font_last_edited' => array( 'et_pb_wc_add_to_cart' ),
),
),
'field_label_font_tablet' => array(
'affected_fields' => array(
'body_font_tablet' => array( 'et_pb_wc_add_to_cart' ),
),
),
'field_label_font_phone' => array(
'affected_fields' => array(
'body_font_phone' => array( 'et_pb_wc_add_to_cart' ),
),
),
// Text Color.
'field_label_text_color' => array(
'affected_fields' => array(
'body_text_color' => array( 'et_pb_wc_add_to_cart' ),
),
),
'field_label_text_color_last_edited' => array(
'affected_fields' => array(
'body_text_color_last_edited' => array( 'et_pb_wc_add_to_cart' ),
),
),
'field_label_text_color_tablet' => array(
'affected_fields' => array(
'body_text_color_tablet' => array( 'et_pb_wc_add_to_cart' ),
),
),
'field_label_text_color_phone' => array(
'affected_fields' => array(
'body_text_color_phone' => array( 'et_pb_wc_add_to_cart' ),
),
),
'field_label_text_color__hover_enabled' => array(
'affected_fields' => array(
'body_text_color__hover_enabled' => array( 'et_pb_wc_add_to_cart' ),
),
),
'field_label_text_color__hover' => array(
'affected_fields' => array(
'body_text_color__hover' => array( 'et_pb_wc_add_to_cart' ),
),
),
// Text Size.
'field_label_font_size' => array(
'affected_fields' => array(
'body_font_size' => array( 'et_pb_wc_add_to_cart' ),
),
),
'field_label_font_size_last_edited' => array(
'affected_fields' => array(
'body_font_size_last_edited' => array( 'et_pb_wc_add_to_cart' ),
),
),
'field_label_font_size_tablet' => array(
'affected_fields' => array(
'body_font_size_tablet' => array( 'et_pb_wc_add_to_cart' ),
),
),
'field_label_font_size_phone' => array(
'affected_fields' => array(
'body_font_size_phone' => array( 'et_pb_wc_add_to_cart' ),
),
),
'field_label_font_size__hover_enabled' => array(
'affected_fields' => array(
'body_font_size__hover_enabled' => array( 'et_pb_wc_add_to_cart' ),
),
),
'field_label_font_size__hover' => array(
'affected_fields' => array(
'body_font_size__hover' => array( 'et_pb_wc_add_to_cart' ),
),
),
// Text Letter spacing.
'field_label_letter_spacing' => array(
'affected_fields' => array(
'body_letter_spacing' => array( 'et_pb_wc_add_to_cart' ),
),
),
'field_label_letter_spacing_last_edited' => array(
'affected_fields' => array(
'body_letter_spacing_last_edited' => array( 'et_pb_wc_add_to_cart' ),
),
),
'field_label_letter_spacing_tablet' => array(
'affected_fields' => array(
'body_letter_spacing_tablet' => array( 'et_pb_wc_add_to_cart' ),
),
),
'field_label_letter_spacing_phone' => array(
'affected_fields' => array(
'body_letter_spacing_phone' => array( 'et_pb_wc_add_to_cart' ),
),
),
'field_label_letter_spacing__hover_enabled' => array(
'affected_fields' => array(
'body_letter_spacing__hover_enabled' => array( 'et_pb_wc_add_to_cart' ),
),
),
'field_label_letter_spacing__hover' => array(
'affected_fields' => array(
'body_letter_spacing__hover' => array( 'et_pb_wc_add_to_cart' ),
),
),
// Text Line height.
'field_label_line_height' => array(
'affected_fields' => array(
'body_line_height' => array( 'et_pb_wc_add_to_cart' ),
),
),
'field_label_line_height_last_edited' => array(
'affected_fields' => array(
'body_line_height_last_edited' => array( 'et_pb_wc_add_to_cart' ),
),
),
'field_label_line_height_tablet' => array(
'affected_fields' => array(
'body_line_height_tablet' => array( 'et_pb_wc_add_to_cart' ),
),
),
'field_label_line_height_phone' => array(
'affected_fields' => array(
'body_line_height_phone' => array( 'et_pb_wc_add_to_cart' ),
),
),
'field_label_line_height__hover_enabled' => array(
'affected_fields' => array(
'body_line_height__hover_enabled' => array( 'et_pb_wc_add_to_cart' ),
),
),
'field_label_line_height__hover' => array(
'affected_fields' => array(
'body_line_height__hover' => array( 'et_pb_wc_add_to_cart' ),
),
),
// Text horizontal shadow.
'field_label_text_shadow_style' => array(
'affected_fields' => array(
'body_text_shadow_style' => array( 'et_pb_wc_add_to_cart' ),
),
),
'field_label_text_shadow_horizontal_length' => array(
'affected_fields' => array(
'body_text_shadow_horizontal_length' => array( 'et_pb_wc_add_to_cart' ),
),
),
'field_label_text_shadow_horizontal_length_last_edited' => array(
'affected_fields' => array(
'body_text_shadow_horizontal_length_last_edited' => array( 'et_pb_wc_add_to_cart' ),
),
),
'field_label_text_shadow_horizontal_length_tablet' => array(
'affected_fields' => array(
'body_text_shadow_horizontal_length_tablet' => array( 'et_pb_wc_add_to_cart' ),
),
),
'field_label_text_shadow_horizontal_length_phone' => array(
'affected_fields' => array(
'body_text_shadow_horizontal_length_phone' => array( 'et_pb_wc_add_to_cart' ),
),
),
'field_label_text_shadow_horizontal_length__hover_enabled' => array(
'affected_fields' => array(
'body_text_shadow_horizontal_length__hover_enabled' => array( 'et_pb_wc_add_to_cart' ),
),
),
'field_label_text_shadow_horizontal_length__hover' => array(
'affected_fields' => array(
'body_text_shadow_horizontal_length__hover' => array( 'et_pb_wc_add_to_cart' ),
),
),
// Text vertical shadow.
'field_label_text_shadow_vertical_length' => array(
'affected_fields' => array(
'body_text_shadow_vertical_length' => array( 'et_pb_wc_add_to_cart' ),
),
),
'field_label_text_shadow_vertical_length_last_edited' => array(
'affected_fields' => array(
'body_text_shadow_vertical_length_last_edited' => array( 'et_pb_wc_add_to_cart' ),
),
),
'field_label_text_shadow_vertical_length_tablet' => array(
'affected_fields' => array(
'body_text_shadow_vertical_length_tablet' => array( 'et_pb_wc_add_to_cart' ),
),
),
'field_label_text_shadow_vertical_length_phone' => array(
'affected_fields' => array(
'body_text_shadow_vertical_length_phone' => array( 'et_pb_wc_add_to_cart' ),
),
),
'field_label_text_shadow_vertical_length__hover_enabled' => array(
'affected_fields' => array(
'body_text_shadow_vertical_length__hover_enabled' => array( 'et_pb_wc_add_to_cart' ),
),
),
'field_label_text_shadow_vertical_length__hover' => array(
'affected_fields' => array(
'body_text_shadow_vertical_length__hover' => array( 'et_pb_wc_add_to_cart' ),
),
),
// Text Blur strength.
'field_label_text_shadow_blur_strength' => array(
'affected_fields' => array(
'body_text_shadow_blur_strength' => array( 'et_pb_wc_add_to_cart' ),
),
),
'field_label_text_shadow_blur_strength_last_edited' => array(
'affected_fields' => array(
'body_text_shadow_blur_strength_last_edited' => array( 'et_pb_wc_add_to_cart' ),
),
),
'field_label_text_shadow_blur_strength_tablet' => array(
'affected_fields' => array(
'body_text_shadow_blur_strength_tablet' => array( 'et_pb_wc_add_to_cart' ),
),
),
'field_label_body_text_shadow_blur_strength_phone' => array(
'affected_fields' => array(
'body_text_shadow_blur_strength_phone' => array( 'et_pb_wc_add_to_cart' ),
),
),
'field_label_text_shadow_blur_strength__hover_enabled' => array(
'affected_fields' => array(
'body_text_shadow_blur_strength__hover_enabled' => array( 'et_pb_wc_add_to_cart' ),
),
),
'field_label_text_shadow_blur_strength__hover' => array(
'affected_fields' => array(
'body_text_shadow_blur_strength__hover' => array( 'et_pb_wc_add_to_cart' ),
),
),
// Text Shadow color.
'field_label_text_shadow_color' => array(
'affected_fields' => array(
'body_text_shadow_color' => array( 'et_pb_wc_add_to_cart' ),
),
),
'field_label_text_shadow_color_last_edited' => array(
'affected_fields' => array(
'body_text_shadow_color_last_edited' => array( 'et_pb_wc_add_to_cart' ),
),
),
'field_label_text_shadow_color_tablet' => array(
'affected_fields' => array(
'body_text_shadow_color_tablet' => array( 'et_pb_wc_add_to_cart' ),
),
),
'field_label_text_shadow_color_phone' => array(
'affected_fields' => array(
'body_text_shadow_color_phone' => array( 'et_pb_wc_add_to_cart' ),
),
),
'field_label_text_shadow_color__hover_enabled' => array(
'affected_fields' => array(
'body_text_shadow_color__hover_enabled' => array( 'et_pb_wc_add_to_cart' ),
),
),
'field_label_text_shadow_color__hover' => array(
'affected_fields' => array(
'body_text_shadow_color__hover' => array( 'et_pb_wc_add_to_cart' ),
),
),
);
// phpcs:enable WordPress.Arrays.MultipleStatementAlignment.DoubleArrowNotAligned -- Invalid warning.
// phpcs:enable WordPress.Arrays.MultipleStatementAlignment.LongIndexSpaceBeforeDoubleArrow -- Invalid warning.
}
// phpcs:ignore Squiz.Commenting.FunctionComment.Missing -- Paresh's PR contains function comment.
public function migrate(
$field_name,
$current_value,
$module_slug,
$saved_value,
$saved_field_name,
$attrs,
$content,
$module_address
) {
// Don't migrate empty value.
if ( ! empty( $current_value ) ) {
return $current_value;
}
return $saved_value;
}
}
return new ET_Builder_Module_Settings_Migration_WooTextOG();
+5 -1
View File
@@ -497,6 +497,8 @@ abstract class ET_Builder_Module_Type_PostContent extends ET_Builder_Module {
'<div%3$s class="%2$s"%6$s%7$s%8$s>
%5$s
%4$s
%9$s
%10$s
%1$s
</div>',
et_theme_builder_frontend_render_post_content(),
@@ -506,7 +508,9 @@ abstract class ET_Builder_Module_Type_PostContent extends ET_Builder_Module {
$parallax_image_background, // #5
et_core_esc_previously( $data_background_layout ),
et_core_esc_previously( $data_background_layout_hover ),
et_core_esc_previously( $data_remove_top_window_classname )
et_core_esc_previously( $data_remove_top_window_classname ),
et_core_esc_previously( $this->background_pattern() ), // #9
et_core_esc_previously( $this->background_mask() ) // #10
);
return $output;
+118 -43
View File
@@ -10,6 +10,8 @@
* @since 3.29
*/
defined( 'ABSPATH' ) || exit;
/**
* Class representing WooCommerce Add to cart component.
*/
@@ -18,10 +20,11 @@ class ET_Builder_Module_Woocommerce_Add_To_Cart extends ET_Builder_Module {
* Initialize.
*/
public function init() {
$this->name = esc_html__( 'Woo Add To Cart', 'et_builder' );
$this->plural = esc_html__( 'Woo Add To Cart', 'et_builder' );
$this->slug = 'et_pb_wc_add_to_cart';
$this->vb_support = 'on';
$this->name = esc_html__( 'Woo Product Add To Cart', 'et_builder' );
$this->plural = esc_html__( 'Woo Product Add To Cart', 'et_builder' );
$this->slug = 'et_pb_wc_add_to_cart';
$this->vb_support = 'on';
$this->folder_name = 'et_pb_woo_modules';
$this->settings_modal_toggles = array(
'general' => array(
@@ -32,11 +35,10 @@ class ET_Builder_Module_Woocommerce_Add_To_Cart extends ET_Builder_Module {
),
'advanced' => array(
'toggles' => array(
'text' => array(
'title' => et_builder_i18n( 'Text' ),
'priority' => 45,
'field_label' => array(
'title' => esc_html__( 'Field Labels', 'et_builder' ),
),
'header' => array(
'header' => array(
'title' => esc_html__( 'Heading Text', 'et_builder' ),
'priority' => 49,
'tabbed_subtoggles' => true,
@@ -67,7 +69,7 @@ class ET_Builder_Module_Woocommerce_Add_To_Cart extends ET_Builder_Module {
),
),
),
'width' => array(
'width' => array(
'title' => et_builder_i18n( 'Sizing' ),
'priority' => 80,
),
@@ -77,23 +79,23 @@ class ET_Builder_Module_Woocommerce_Add_To_Cart extends ET_Builder_Module {
$this->advanced_fields = array(
'fonts' => array(
'body' => array(
'label' => et_builder_i18n( 'Text' ),
'css' => array(
'main' => '%%order_class%%, %%order_class%% a, %%order_class%% label, %%order_class%%.et_pb_module .et_pb_module_inner .stock',
'important' => 'all',
'field_label' => array(
'label' => esc_html__( 'Field Labels', 'et_builder' ),
'css' => array(
'main' => implode(
',',
array(
'%%order_class%% label',
)
),
),
'font_size' => array(
'default' => '14px',
),
'line_height' => array(
'default' => '1.3em',
),
'hide_text_align' => true,
'toggle_slug' => 'text',
'font' => array(
'font' => array(
'default' => '|700|||||||',
),
'font_size' => array(
'default' => '14px',
),
'toggle_slug' => 'field_label',
),
),
'background' => array(
@@ -107,21 +109,17 @@ class ET_Builder_Module_Woocommerce_Add_To_Cart extends ET_Builder_Module {
),
),
'text' => array(
'use_background_layout' => true,
'use_background_layout' => false,
'css' => array(
'main' => '%%order_class%% td.label',
'text_shadow' => '%%order_class%% td.label',
),
'options' => array(
'text_orientation' => array(
'text_orientation' => array(
'default' => 'left',
),
'background_layout' => array(
'default' => 'light',
'hover' => 'tabs',
),
),
),
'text_shadow' => array(
// Don't add text-shadow fields since they already are via font-options.
'default' => false,
),
'button' => array(
'button' => array(
'label' => et_builder_i18n( 'Button' ),
@@ -343,7 +341,7 @@ class ET_Builder_Module_Woocommerce_Add_To_Cart extends ET_Builder_Module {
*/
public function get_fields() {
$fields = array(
'product' => ET_Builder_Module_Helper_Woocommerce_Modules::get_field(
'product' => ET_Builder_Module_Helper_Woocommerce_Modules::get_field(
'product',
array(
'default' => ET_Builder_Module_Helper_Woocommerce_Modules::get_product_default(),
@@ -352,7 +350,7 @@ class ET_Builder_Module_Woocommerce_Add_To_Cart extends ET_Builder_Module {
),
)
),
'product_filter' => ET_Builder_Module_Helper_Woocommerce_Modules::get_field(
'product_filter' => ET_Builder_Module_Helper_Woocommerce_Modules::get_field(
'product_filter',
array(
'computed_affects' => array(
@@ -360,7 +358,7 @@ class ET_Builder_Module_Woocommerce_Add_To_Cart extends ET_Builder_Module {
),
)
),
'show_quantity' => array(
'show_quantity' => array(
'label' => esc_html__( 'Show Quantity Field', 'et_builder' ),
'type' => 'yes_no_button',
'option_category' => 'configuration',
@@ -374,7 +372,7 @@ class ET_Builder_Module_Woocommerce_Add_To_Cart extends ET_Builder_Module {
'mobile_options' => true,
'hover' => 'tabs',
),
'show_stock' => array(
'show_stock' => array(
'label' => esc_html__( 'Show Stock', 'et_builder' ),
'type' => 'yes_no_button',
'option_category' => 'configuration',
@@ -388,7 +386,22 @@ class ET_Builder_Module_Woocommerce_Add_To_Cart extends ET_Builder_Module {
'mobile_options' => true,
'hover' => 'tabs',
),
'__add_to_cart' => array(
'field_label_position' => array(
'label' => esc_html__( 'Fields Label Position', 'et_builder' ),
'description' => esc_html__( 'Set the position of the field labels.', 'et_builder' ),
'type' => 'select',
'option_category' => 'configuration',
'options' => array(
'inline' => __( 'Inline', 'et_builder' ),
'stacked' => __( 'Stacked', 'et_builder' ),
),
'default' => 'default',
'tab_slug' => 'advanced',
'toggle_slug' => 'field_label',
'mobile_options' => true,
'priority' => 15,
),
'__add_to_cart' => array(
'type' => 'computed',
'computed_callback' => array(
'ET_Builder_Module_Woocommerce_Add_To_Cart',
@@ -407,22 +420,75 @@ class ET_Builder_Module_Woocommerce_Add_To_Cart extends ET_Builder_Module {
return $fields;
}
/**
* Replaces the Add to Cart form's action.
*
* @since 4.14.0
*
* @param string $permalink Permalink.
*
* @return string
*/
public static function replace_add_to_cart_form_action( $permalink ) {
$the_id = et_core_page_resource_get_the_ID();
if ( 0 === absint( et_core_page_resource_get_the_ID() ) ) {
return $permalink;
}
$link = get_permalink( $the_id );
// Validate if Post exists.
return $link ? $link : $permalink;
}
/**
* Get add to cart markup as string
*
* @since 4.14.0 Update Add to Cart Form action {@see https://github.com/elegantthemes/Divi/issues/16682}
*
* @since 4.4.0 Fixed compatibility w/ WooCommerce Product Add-ons
* @see https://github.com/elegantthemes/Divi/issues/19116
*
* @param array $args Additional arguments.
* @param array $args Arguments from Computed Prop AJAX call.
* @param array $conditional_tags Conditional Tags.
*
* @return string
*/
public static function get_add_to_cart( $args = array() ) {
return et_builder_wc_render_module_template(
public static function get_add_to_cart( $args = array(), $conditional_tags = array() ) {
$is_tb = 'true' === et_()->array_get( $conditional_tags, 'is_tb', 'false' );
$is_bfb = 'true' === et_()->array_get( $conditional_tags, 'is_bfb', 'false' );
$is_bfb_activated = 'true' === et_()->array_get( $conditional_tags, 'is_bfb_activated', 'false' );
$is_builder = $is_tb || $is_bfb || $is_bfb_activated || is_et_pb_preview();
if ( ! $is_builder ) {
add_filter(
'woocommerce_add_to_cart_form_action',
array(
'ET_Builder_Module_Woocommerce_Add_To_Cart',
// phpcs:ignore WordPress.Arrays.CommaAfterArrayItem.NoComma -- This is a function call.
'replace_add_to_cart_form_action'
)
);
}
$output = et_builder_wc_render_module_template(
'woocommerce_template_single_add_to_cart',
$args,
array( 'product', 'post' )
);
if ( ! $is_builder ) {
remove_filter(
'woocommerce_add_to_cart_form_action',
array(
'ET_Builder_Module_Woocommerce_Add_To_Cart',
// phpcs:ignore WordPress.Arrays.CommaAfterArrayItem.NoComma -- This is a function call.
'replace_add_to_cart_form_action'
)
);
}
return $output;
}
/**
@@ -452,12 +518,18 @@ class ET_Builder_Module_Woocommerce_Add_To_Cart extends ET_Builder_Module {
$multi_view_attrs = $multi_view->render_attrs(
array(
'classes' => array(
'et_pb_hide_input_quantity' => array(
'et_pb_hide_input_quantity' => array(
'show_quantity' => 'off',
),
'et_pb_hide_stock' => array(
'et_pb_hide_stock' => array(
'show_stock' => 'off',
),
'et_pb_fields_label_position_inline' => array(
'field_label_position' => 'inline',
),
'et_pb_fields_label_position_stacked' => array(
'field_label_position' => 'stacked',
),
),
),
false,
@@ -562,6 +634,9 @@ class ET_Builder_Module_Woocommerce_Add_To_Cart extends ET_Builder_Module {
$this->add_classname( 'et_pb_with_focus_border' );
}
$fields_label_position = et_()->array_get( $this->props, 'field_label_position', 'inline' );
$this->add_classname( "et_pb_fields_label_position_{$fields_label_position}" );
ET_Builder_Module_Helper_Woocommerce_Modules::process_background_layout_data( $render_slug, $this );
ET_Builder_Module_Helper_Woocommerce_Modules::process_custom_button_icons( $render_slug, $this );
@@ -10,6 +10,8 @@
* @since 3.29
*/
defined( 'ABSPATH' ) || exit;
/**
* Class representing WooCommerce Additional Info component.
*/
@@ -20,10 +22,11 @@ class ET_Builder_Module_Woocommerce_Additional_Info extends ET_Builder_Module {
* @since 4.0.6 Implemented Attribute Row, Title and Body Custom CSS fields.
*/
public function init() {
$this->name = esc_html__( 'Woo Additional Info', 'et_builder' );
$this->plural = esc_html__( 'Woo Additional Info', 'et_builder' );
$this->slug = 'et_pb_wc_additional_info';
$this->vb_support = 'on';
$this->name = esc_html__( 'Woo Product Information', 'et_builder' );
$this->plural = esc_html__( 'Woo Product Information', 'et_builder' );
$this->slug = 'et_pb_wc_additional_info';
$this->vb_support = 'on';
$this->folder_name = 'et_pb_woo_modules';
$this->settings_modal_toggles = array(
'general' => array(
@@ -34,7 +37,7 @@ class ET_Builder_Module_Woocommerce_Additional_Info extends ET_Builder_Module {
),
'advanced' => array(
'toggles' => array(
'text' => array(
'text' => array(
'title' => et_builder_i18n( 'Text' ),
'priority' => 45,
'tabbed_subtoggles' => true,
@@ -50,9 +53,21 @@ class ET_Builder_Module_Woocommerce_Additional_Info extends ET_Builder_Module {
),
),
),
'header' => array(
'header' => array(
'title' => esc_html__( 'Title Text', 'et_builder' ),
),
'table' => array(
'title' => esc_html__( 'Table', 'et_builder' ),
'priority' => 70,
),
'table_row' => array(
'title' => esc_html__( 'Table Row', 'et_builder' ),
'priority' => 75,
),
'table_cell' => array(
'title' => esc_html__( 'Table Cell', 'et_builder' ),
'priority' => 80,
),
),
),
);
@@ -155,6 +170,211 @@ class ET_Builder_Module_Woocommerce_Additional_Info extends ET_Builder_Module {
'default' => false,
),
'button' => false,
'form_field' => array(
'table' => array(
'label' => esc_html__( 'Table', 'et_builder' ),
'css' => array(
'main' => '%%order_class%% table.shop_attributes',
),
'font_field' => false,
'margin_padding' => array(
'css' => array(
'main' => '%%order_class%% table.shop_attributes',
),
'use_padding' => false,
),
'text_color' => false,
'focus_background_color' => false,
'focus_text_color' => false,
'border_styles' => array(
'table' => array(
'label_prefix' => 'Table',
'css' => array(
'main' => array(
'border_styles' => '%%order_class%% table.shop_attributes',
'border_radii' => '%%order_class%% table.shop_attributes',
),
),
'use_focus_borders' => false,
'defaults' => array(
'border_radii' => 'on|0px|0px|0px|0px',
'border_styles' => array(
'width' => '0px',
'style' => 'dotted',
),
'composite' => array(
'border_top' => array(
'border_width_top' => '1px',
),
),
),
),
'box_shadow' => array(
'css' => array(
'main' => '%%order_class%% table.shop_attributes',
),
),
),
'table_row' => array(
'label' => esc_html__( 'Table Row', 'et_builder' ),
'css' => array(
'main' => '%%order_class%% table.shop_attributes tr',
),
'font_field' => false,
'margin_padding' => array(
'css' => array(
'main' => '%%order_class%% table.shop_attributes tr th, %%order_class%% table.shop_attributes tr td',
),
'use_margin' => false,
),
'text_color' => false,
'focus_background_color' => false,
'focus_text_color' => false,
'border_styles' => array(
'table_row' => array(
'label_prefix' => 'Table Row',
'css' => array(
'main' => array(
// Accepts only string and not array. Hence using `implode`.
'border_radii' => implode(
', ',
array(
'%%order_class%% table.shop_attributes th',
'%%order_class%% table.shop_attributes td',
)
),
'border_styles' => implode(
', ',
array(
'%%order_class%% table.shop_attributes th',
'%%order_class%% table.shop_attributes td',
)
),
),
'important' => true,
),
'use_focus_borders' => false,
'defaults' => array(
'border_radii' => 'on|0px|0px|0px|0px',
'border_styles' => array(
'width' => '1px',
'style' => 'dotted',
),
),
),
),
),
'box_shadow' => array(
'css' => array(
'main' => '%%order_class%% table.shop_attributes tr',
),
),
),
'table_row' => array(
'label' => esc_html__( 'Table Row', 'et_builder' ),
'css' => array(
'main' => '%%order_class%% table.shop_attributes tr',
),
'font_field' => false,
'margin_padding' => array(
'css' => array(
'main' => '%%order_class%% table.shop_attributes tr th, %%order_class%% table.shop_attributes tr td',
),
'use_margin' => false,
),
'text_color' => false,
'focus_background_color' => false,
'focus_text_color' => false,
'border_styles' => array(
'table_row' => array(
'label_prefix' => 'Table Row',
'css' => array(
'main' => array(
// Accepts only string and not array. Hence using `implode`.
'border_radii' => implode(
', ',
array(
'%%order_class%% table.shop_attributes th',
'%%order_class%% table.shop_attributes td',
)
),
'border_styles' => implode(
', ',
array(
'%%order_class%% table.shop_attributes th',
'%%order_class%% table.shop_attributes td',
)
),
),
),
'use_focus_borders' => false,
'defaults' => array(
'border_radii' => 'on|0px|0px|0px|0px',
'border_styles' => array(
'width' => '1px',
'style' => 'dotted',
),
),
),
),
'box_shadow' => array(
'css' => array(
'main' => '%%order_class%% table.shop_attributes tr',
),
),
),
'table_cell' => array(
'label' => esc_html__( 'Table Cell', 'et_builder' ),
'css' => array(
'main' => '%%order_class%% table.shop_attributes tr th, %%order_class%% table.shop_attributes tr td',
),
'font_field' => false,
'margin_padding' => array(
'css' => array(
'main' => implode(
', ',
array(
'%%order_class%% table.shop_attributes tr th',
'%%order_class%% table.shop_attributes tr td',
)
),
),
'use_margin' => false,
),
'text_color' => false,
'focus_background_color' => false,
'focus_text_color' => false,
'border_styles' => array(
'table_cell' => array(
'label_prefix' => 'Table Cell',
'css' => array(
'main' => array(
'border_styles' => '%%order_class%% table.shop_attributes tr th,%%order_class%% table.shop_attributes tr td',
'border_radii' => '%%order_class%% table.shop_attributes tr th, %%order_class%% table.shop_attributes tr td',
),
),
'use_focus_borders' => false,
'defaults' => array(
'border_radii' => 'on|0px|0px|0px|0px',
'border_styles' => array(
'width' => '1px',
'style' => 'dotted',
),
'composite' => array(
'border_top' => array(
'border_width_top' => '1px',
),
),
),
),
),
'box_shadow' => array(
'css' => array(
'main' => '%%order_class%% table.shop_attributes tr th, %%order_class%% table.shop_attributes td',
),
),
),
),
);
$this->custom_css_fields = array(
@@ -332,6 +552,24 @@ class ET_Builder_Module_Woocommerce_Additional_Info extends ET_Builder_Module {
add_filter( "et_builder_module_{$render_slug}_outer_wrapper_attrs", array( $this, 'add_multi_view_attrs' ), 10, 2 );
$table_row_bg_color = et_()->array_get( $this->props, 'table_row_background_color', '' );
if ( ! empty( $table_row_bg_color ) ) {
ET_Builder_Element::set_style(
$render_slug,
array(
'selector' => implode(
',',
array(
'%%order_class%% table.shop_attributes tr:nth-child(even) th',
'%%order_class%% table.shop_attributes tr:nth-child(even) td',
)
),
'declaration' => 'background: inherit',
)
);
}
$output = self::get_additional_info( $this->props );
// Render empty string if no output is generated to avoid unwanted vertical space.
@@ -10,6 +10,8 @@
* @since 3.29
*/
defined( 'ABSPATH' ) || exit;
/**
* Class representing WooCommerce Breadcrumb component.
*/
@@ -25,10 +27,11 @@ class ET_Builder_Module_Woocommerce_Breadcrumb extends ET_Builder_Module {
* Initialize.
*/
public function init() {
$this->name = esc_html__( 'Woo Breadcrumb', 'et_builder' );
$this->name = esc_html__( 'Woo Breadcrumbs', 'et_builder' );
$this->plural = esc_html__( 'Woo Breadcrumbs', 'et_builder' );
$this->slug = 'et_pb_wc_breadcrumb';
$this->vb_support = 'on';
$this->folder_name = 'et_pb_woo_modules';
$this->main_css_element = '%%order_class%% .woocommerce-breadcrumb';
$this->settings_modal_toggles = array(
@@ -96,6 +99,10 @@ class ET_Builder_Module_Woocommerce_Breadcrumb extends ET_Builder_Module {
),
),
'background' => array(
'css' => array(
// Backgrounds need to be applied to module wrapper.
'main' => '%%order_class%%.et_pb_wc_breadcrumb',
),
'settings' => array(
'color' => 'alpha',
),
@@ -245,7 +252,7 @@ class ET_Builder_Module_Woocommerce_Breadcrumb extends ET_Builder_Module {
$layout_post_id = ET_Builder_Element::get_layout_id();
$is_fb = et_core_is_fb_enabled() && $main_query_post_id === $layout_post_id;
if ( ! et_fb_is_resolve_post_content_callback_ajax() && ( $is_fb || et_fb_is_builder_ajax() || et_fb_is_computed_callback_ajax() ) ) {
if ( ! et_fb_is_resolve_post_content_callback_ajax() && ( $is_fb || et_fb_is_builder_ajax() || et_fb_is_computed_callback_ajax() || is_et_pb_preview() ) ) {
$args = wp_parse_args(
array(
'breadcrumb_home_text' => '%HOME_TEXT%',
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,587 @@
<?php
/**
* WooCommerce Modules: ET_Builder_Module_Woocommerce_Checkout_Additional_Info class
*
* The ET_Builder_Module_Woocommerce_Checkout_Additional_Info Class is responsible for rendering the
* Checkout Additional Info section using the WooCommerce template.
*
* @package Divi\Builder
*
* @since 4.14.0
*/
defined( 'ABSPATH' ) || exit;
/**
* Class representing WooCommerce Checkout Additional Info component.
*/
final class ET_Builder_Module_Woocommerce_Checkout_Additional_Info extends ET_Builder_Module {
/**
* Initialize.
*
* @since 4.14.0 Fixed PHP Warnings {@link https://github.com/elegantthemes/Divi/issues/22104}
*/
public function init() {
$this->name = esc_html__( 'Woo Checkout Information', 'et_builder' );
$this->plural = esc_html__( 'Woo Checkout Information', 'et_builder' );
$this->slug = 'et_pb_wc_checkout_additional_info';
$this->vb_support = 'on';
$this->folder_name = 'et_pb_woo_modules';
$this->settings_modal_toggles = array(
'general' => array(
'toggles' => array(
'elements' => esc_html__( 'Elements', 'et_builder' ),
),
),
'advanced' => array(
'toggles' => array(
'title' => array(
'title' => esc_html__( 'Title Text', 'et_builder' ),
'priority' => 49,
),
'field_label' => array(
'title' => esc_html__( 'Field Labels', 'et_builder' ),
'priority' => 60,
),
),
),
);
$this->advanced_fields = array(
'fonts' => array(
'title' => array(
'label' => esc_html__( 'Title', 'et_builder' ),
'css' => array(
'main' => '%%order_class%% h3',
),
'font_size' => array(
'default' => '22px',
),
'line_height' => array(
'default' => '1em',
),
'tab_slug' => 'advanced',
'toggle_slug' => 'title',
),
'field_label' => array(
'label' => esc_html__( 'Field Label', 'et_builder' ),
'css' => array(
'main' => '%%order_class%% form .form-row label',
),
'font_size' => array(
'default' => '14px',
),
'line_height' => array(
'default' => '2em',
),
'toggle_slug' => 'field_label',
),
),
'text' => array(
'use_background_layout' => false,
'use_text_orientation' => true,
),
'button' => false,
'link_options' => false,
'form_field' => array(
'form_field' => array(
'label' => esc_html__( 'Fields', 'et_builder' ),
'css' => array(
'main' => '%%order_class%% form .form-row .input-text',
'focus_text_color' => implode(
',',
[
'.woocommerce %%order_class%% form .form-row .input-text:focus',
'.woocommerce-page %%order_class%% form .form-row .input-text:focus',
]
),
),
'box_shadow' => false,
'border_styles' => array(
'form_field' => array(
'label_prefix' => esc_html__( 'Fields', 'et_builder' ),
'css' => array(
'main' => array(
'border_styles' => '%%order_class%% .et_pb_module_inner form .form-row textarea',
'border_radii' => '%%order_class%% .et_pb_module_inner form .form-row textarea',
),
'defaults' => array(
'border_radii' => 'on|0px|0px|0px|0px',
'border_styles' => array(
'width' => '0px',
'style' => 'solid',
),
),
),
),
'form_field_focus' => array(
'label_prefix' => esc_html__( 'Fields Focus', 'et_builder' ),
'css' => array(
'main' => array(
'border_styles' => '%%order_class%% form .form-row textarea.input-text:focus',
'border_radii' => '%%order_class%% form .form-row textarea.input-text:focus',
),
'defaults' => array(
'border_radii' => 'on|0px|0px|0px|0px',
'border_styles' => array(
'width' => '0px',
'style' => 'solid',
),
),
),
),
),
'font_field' => array(
'css' => array(
'main' => implode(
', ',
array(
'%%order_class%% form .form-row .input-text',
'%%order_class%% form .form-row .input-text::placeholder',
'%%order_class%% form .form-row .input-text::-webkit-input-placeholder',
'%%order_class%% form .form-row .input-text::-moz-placeholder',
'%%order_class%% form .form-row .input-text:-ms-input-placeholder',
)
),
'hover' => implode(
', ',
array(
'%%order_class%% form .input-text',
'%%order_class%% form .input-text:hover::placeholder',
'%%order_class%% form .input-text:hover::-webkit-input-placeholder',
'%%order_class%% form .input-text:hover::-moz-placeholder',
'%%order_class%% form .input-text:hover:-ms-input-placeholder',
)
),
// Required to override default WooCommerce styles.
'important' => array( 'line-height', 'font', 'size' ),
),
'font_size' => array(
'default' => '14px',
),
'line_height' => array(
'default' => '1.7em',
),
),
'margin_padding' => array(
'css' => array(
'main' => '%%order_class%% form .form-row textarea',
'padding' => '%%order_class%% form .form-row textarea.input-text',
),
'custom_padding' => array(
'default' => '15px|15px|15px|15px|false|false',
),
),
'width' => array(),
'toggle_priority' => 65,
),
),
);
$this->custom_css_fields = array(
'title_text' => array(
'label' => esc_html__( 'Title Text', 'et_builder' ),
'selector' => '%%order_class%% h3',
),
'field_label' => array(
'label' => esc_html__( 'Field Label', 'et_builder' ),
'selector' => '%%order_class%% form .form-row label',
),
'fields' => array(
'label' => esc_html__( 'Fields', 'et_builder' ),
'selector' => '%%order_class%% form .input-text',
),
'fields_placeholder' => array(
'label' => esc_html__( 'Fields Placeholder', 'et_builder' ),
'selector' => implode(
', ',
array(
'%%order_class%% form .form-row .input-text::placeholder',
'%%order_class%% form .form-row .input-text::-webkit-input-placeholder',
'%%order_class%% form .form-row .input-text::-moz-placeholder',
'%%order_class%% form .form-row .input-text:-ms-input-placeholder',
)
),
),
);
$this->help_videos = array(
array(
'id' => esc_html( '7X03vBPYJ1o' ),
'name' => esc_html__( 'Divi WooCommerce Modules', 'et_builder' ),
),
);
}
/**
* {@inheritdoc}
*/
public function get_fields() {
$fields = array(
'show_title' => array(
'label' => esc_html__( 'Show Title', 'et_builder' ),
'type' => 'yes_no_button',
'option_category' => 'configuration',
'options' => array(
'on' => esc_html__( 'Yes', 'et_builder' ),
'off' => esc_html__( 'No', 'et_builder' ),
),
'default_on_front' => 'on',
'toggle_slug' => 'elements',
'description' => esc_html__( 'Turn title on or off.', 'et_builder' ),
'mobile_options' => true,
'hover' => 'tabs',
),
'placeholder_color' => ET_Builder_Module_Helper_Woocommerce_Modules::get_field(
'placeholder_color'
),
'__checkout_additional_info' => array(
'type' => 'computed',
'computed_callback' => array(
'ET_Builder_Module_Woocommerce_Checkout_Additional_Info',
// phpcs:ignore WordPress.Arrays.CommaAfterArrayItem.NoComma -- Call to a function.
'get_additional_info'
),
'computed_depends_on' => array(
/*
* `depends_on` arg is required. Otherwise AJAX will return null.
* @see et_pb_process_computed_property().
* `product` will not be processed since there is no definition in
* @see ET_Builder_Module_Woocommerce_Checkout_Order::get_fields()
*/
'product',
),
),
);
return $fields;
}
/**
* Reset hooks.
*/
public static function maybe_reset_hooks( $conditional_tags ) {
$is_tb = et_()->array_get( $conditional_tags, 'is_tb', false );
ET_Builder_Module_Helper_Woocommerce_Modules::attach_wc_checkout_coupon_form();
ET_Builder_Module_Helper_Woocommerce_Modules::attach_wc_checkout_login_form();
ET_Builder_Module_Helper_Woocommerce_Modules::attach_wc_checkout_order_review();
ET_Builder_Module_Helper_Woocommerce_Modules::attach_wc_checkout_payment();
if ( ! et_fb_is_computed_callback_ajax() && ! $is_tb ) {
remove_filter(
'wc_get_template',
[
'ET_Builder_Module_Woocommerce_Checkout_Additional_Info',
'swap_template',
],
10,
5
);
}
}
/**
* Handle hooks.
*/
public static function maybe_handle_hooks( $conditional_tags ) {
$is_tb = et_()->array_get( $conditional_tags, 'is_tb', false );
ET_Builder_Module_Helper_Woocommerce_Modules::detach_wc_checkout_coupon_form();
ET_Builder_Module_Helper_Woocommerce_Modules::detach_wc_checkout_login_form();
ET_Builder_Module_Helper_Woocommerce_Modules::detach_wc_checkout_order_review();
ET_Builder_Module_Helper_Woocommerce_Modules::detach_wc_checkout_payment();
if ( ! et_fb_is_computed_callback_ajax() && ! $is_tb ) {
add_filter(
'wc_get_template',
[
'ET_Builder_Module_Woocommerce_Checkout_Additional_Info',
'swap_template',
],
10,
5
);
}
}
/**
* Invoke WooCommerce hooks.
*
* When Dynamic framework is enabled, some of WooCommerce's actions/filters
* won't be invoked because of lazy loading.
*
* Since WooCommerce's hooks are required before render() they are
* invoked using the `et_builder_module_lazy_shortcodes_registered` hook.
*
* @see et_builder_wc_init()
* @see ET_Builder_Module_Shortcode_Manager::register_all_shortcodes()
*/
public static function maybe_invoke_woocommerce_hooks() {
/*
* The respective remove_filter is used at
*
* @see ET_Builder_Module_Woocommerce_Checkout_Additional_Info::get_additional_info()
*/
add_filter(
'woocommerce_checkout_fields',
array(
'ET_Builder_Module_Woocommerce_Checkout_Additional_Info',
// phpcs:ignore WordPress.Arrays.CommaAfterArrayItem.NoComma -- Call to a function.
'modify_order_comments_rows'
)
);
}
/**
* Increases the Checkout Information Textarea `rows` attribute.
*
* @param array $fields Array of checkout fields.
*
* @return array
*/
public static function modify_order_comments_rows( $fields ) {
if ( ! is_array( $fields ) ) {
return $fields;
}
if ( ! isset( $fields['order'] ) || ! isset( $fields['order']['order_comments'] ) ) {
return $fields;
}
$fields['order']['order_comments']['custom_attributes']['rows'] = 4;
return $fields;
}
/**
* {@inheritdoc}
*/
public function get_transition_fields_css_props() {
$fields = parent::get_transition_fields_css_props();
$fields['placeholder_color'] = array(
'color' => array(
'%%order_class%% form .form-row textarea.input-text::placeholder',
'%%order_class%% form .form-row textarea.input-text::-webkit-input-placeholder',
'%%order_class%% form .form-row textarea.input-text::-moz-placeholder',
'%%order_class%% form .form-row textarea.input-text:-ms-input-placeholder',
),
);
return $fields;
}
/**
* Swaps Checkout Order Details template.
*
* Coupon Remove Link must be shown in VB. Hence we swap the template.
*
* @param string $template Template.
* @param string $template_name Template name.
* @param array $args Arguments.
* @param string $template_path Template path.
* @param string $default_path Default path.
*
* @return string
*/
public static function swap_template( $template, $template_name, $args, $template_path, $default_path ) {
$is_template_override = in_array(
$template_name,
array(
'checkout/form-checkout.php',
),
true
);
if ( $is_template_override ) {
return trailingslashit( ET_BUILDER_DIR ) . 'feature/woocommerce/templates/' . $template_name;
}
return $template;
}
/**
* Gets the Checkout Additional Info markup.
*
* @param array $args Settings used to render the module's output.
* Refer ET_Builder_Element::props.
*
* @return string
*/
public static function get_additional_info( $args = array(), $conditional_tags = array() ) {
self::maybe_handle_hooks( $conditional_tags );
$is_cart_empty = function_exists( 'WC' ) && isset( WC()->cart ) && WC()->cart->is_empty();
// Is Page Builder mode?.
$is_pb_mode = et_fb_is_computed_callback_ajax() || is_et_pb_preview();
// Set dummy cart contents to output Additional Information when no product is in cart.
if ( ( $is_cart_empty && $is_pb_mode ) || is_et_pb_preview() ) {
add_filter(
'woocommerce_get_cart_contents',
array(
'ET_Builder_Module_Helper_Woocommerce_Modules',
// phpcs:ignore WordPress.Arrays.CommaAfterArrayItem.NoComma -- Call to a function.
'set_dummy_cart_contents'
)
);
}
// Show Checkout Additional Info module title.
add_filter( 'woocommerce_cart_needs_shipping', '__return_false' );
add_filter(
'woocommerce_checkout_fields',
array(
'ET_Builder_Module_Woocommerce_Checkout_Additional_Info',
// phpcs:ignore WordPress.Arrays.CommaAfterArrayItem.NoComma -- Call to a function.
'modify_order_comments_rows'
)
);
ob_start();
WC_Shortcode_Checkout::output( array() );
$markup = ob_get_clean();
remove_filter(
'woocommerce_checkout_fields',
array(
'ET_Builder_Module_Woocommerce_Checkout_Additional_Info',
// phpcs:ignore WordPress.Arrays.CommaAfterArrayItem.NoComma -- Call to a function.
'modify_order_comments_rows'
)
);
// Reset showing Checkout Additional Info module title.
remove_filter( 'woocommerce_cart_needs_shipping', '__return_false' );
if ( ( $is_cart_empty && $is_pb_mode ) || is_et_pb_preview() ) {
remove_filter(
'woocommerce_get_cart_contents',
array(
'ET_Builder_Module_Helper_Woocommerce_Modules',
// phpcs:ignore WordPress.Arrays.CommaAfterArrayItem.NoComma -- Call to a function.
'set_dummy_cart_contents'
)
);
}
self::maybe_reset_hooks( $conditional_tags );
// Fallback.
if ( ! is_string( $markup ) ) {
$markup = '';
}
return $markup;
}
/**
* Adds Multi view attributes to the Outer wrapper.
*
* Since we do not have control over the WooCommerce Additional Info markup,
* we inject Multi view attributes on to the Outer wrapper.
*
* @since 4.14.0
*
* @param array $outer_wrapper_attrs Outer wrapper attributes.
*
* @return array
*/
public function add_multi_view_attrs( $outer_wrapper_attrs ) {
$multi_view = et_pb_multi_view_options( $this );
$multi_view_attrs = $multi_view->render_attrs(
array(
'classes' => array(
'et_pb_wc_no_title' => array(
'show_title' => 'off',
),
),
),
false,
null,
true
);
if ( $multi_view_attrs && is_array( $multi_view_attrs ) ) {
$outer_wrapper_attrs = array_merge( $outer_wrapper_attrs, $multi_view_attrs );
}
return $outer_wrapper_attrs;
}
/**
* Renders the module output.
*
* @param array $attrs List of attributes.
* @param string $content Content being processed.
* @param string $render_slug Slug of module that is used for rendering output.
*
* @return string
*/
public function render( $attrs, $content, $render_slug ) {
if ( function_exists( 'is_order_received_page' )
&& is_order_received_page() ) {
return '';
}
// Add classes to hide disabled elements.
if ( 'off' === $this->prop( 'show_title', 'on' ) ) {
$this->add_classname( 'et_pb_wc_no_title' );
}
$this->add_classname( $this->get_text_orientation_classname() );
add_filter( "et_builder_module_{$render_slug}_outer_wrapper_attrs", array( $this, 'add_multi_view_attrs' ) );
// Placeholder Color.
$placeholder_selectors = array(
'%%order_class%% form .form-row textarea.input-text::placeholder',
'%%order_class%% form .form-row textarea.input-text::-webkit-input-placeholder',
'%%order_class%% form .form-row textarea.input-text::-moz-placeholder',
'%%order_class%% form .form-row textarea.input-text:-ms-input-placeholder',
);
$this->generate_styles(
array(
'base_attr_name' => 'placeholder_color',
'selector' => join( ', ', $placeholder_selectors ),
'hover_pseudo_selector_location' => 'suffix',
'sticky_pseudo_selector_location' => 'prefix',
'css_property' => 'color',
'important' => false,
'render_slug' => $render_slug,
'type' => 'color',
)
);
global $wp;
if ( ! empty( $wp->query_vars['order-pay'] ) ) {
$this->add_classname( 'et_pb_wc_order_pay' );
}
if ( isset( WC()->cart )
&& ! is_null( WC()->cart && method_exists( WC()->cart, 'check_cart_items' ) )
&& ! is_et_pb_preview() ) {
$return = WC()->cart->check_cart_items();
if ( wc_notice_count( 'error' ) > 0 ) {
$this->add_classname( 'et_pb_hide_module' );
}
}
$output = self::get_additional_info( $this->props );
return $this->_render_module_wrapper( $output, $render_slug );
}
}
new ET_Builder_Module_Woocommerce_Checkout_Additional_Info();
@@ -0,0 +1,674 @@
<?php
/**
* WooCommerce Modules: ET_Builder_Module_Woocommerce_Checkout_Billing class
*
* The ET_Builder_Module_Woocommerce_Checkout_Billing Class is responsible for rendering the
* Checkout billing section using the WooCommerce template.
*
* @package Divi\Builder
*
* @since 4.14.0
*/
defined( 'ABSPATH' ) || exit;
/**
* Class representing WooCommerce Checkout billing component.
*/
class ET_Builder_Module_Woocommerce_Checkout_Billing extends ET_Builder_Module {
/**
* Initialize.
*
* @since 4.14.0 Fixed PHP Warnings {@link https://github.com/elegantthemes/Divi/issues/22104}
*/
public function init() {
$this->name = esc_html__( 'Woo Checkout Billing', 'et_builder' );
$this->plural = esc_html__( 'Woo Checkout Billing', 'et_builder' );
$this->slug = 'et_pb_wc_checkout_billing';
$this->vb_support = 'on';
$this->folder_name = 'et_pb_woo_modules';
$this->settings_modal_toggles = array(
'advanced' => array(
'toggles' => array(
'layout' => array(
'title' => et_builder_i18n( 'Layout' ),
'priority' => 45,
),
'title' => array(
'title' => esc_html__( 'Title Text', 'et_builder' ),
'priority' => 55,
),
'field_label' => array(
'title' => esc_html__( 'Field Labels', 'et_builder' ),
'priority' => 60,
),
'form_field' => array(
'title' => esc_html__( 'Fields', 'et_builder' ),
'priority' => 65,
),
'form_notice' => array(
'title' => esc_html__( 'Form Notice', 'et_builder' ),
'priority' => 70,
),
),
),
);
$this->advanced_fields = array(
'fonts' => array(
// Use `title` in place of `header` since `header` needs a workaround in Copy/Paste.
'title' => array(
'label' => esc_html__( 'Title', 'et_builder' ),
'css' => array(
'main' => '%%order_class%% h3',
),
'font_size' => array(
'default' => '22px',
),
'line_height' => array(
'default' => '1em',
),
'tab_slug' => 'advanced',
'toggle_slug' => 'title',
),
'field_label' => array(
'label' => esc_html__( 'Field Label', 'et_builder' ),
'css' => array(
'main' => '%%order_class%% form .form-row label',
),
'font_size' => array(
'default' => '14px',
),
'line_height' => array(
'default' => '2em',
),
'toggle_slug' => 'field_label',
),
),
'text' => array(
'use_background_layout' => false,
'use_text_orientation' => true,
),
'button' => false,
'link_options' => false,
'form_field' => array(
'form_field' => array(
'label' => esc_html__( 'Fields', 'et_builder' ),
'css' => array(
'main' => implode(
',',
array(
'.woocommerce %%order_class%% .select2-container--default .select2-selection--single',
'.woocommerce %%order_class%% form .form-row .input-text',
)
),
'background_color_hover' => implode(
',',
[
'%%order_class%% .select2-container--default .select2-selection--single:hover',
'.woocommerce %%order_class%% form .form-row .input-text:hover',
]
),
'focus_background_color' => implode(
',',
[
'.woocommerce %%order_class%% .select2-container--open .select2-selection',
'.woocommerce %%order_class%% form .input-text:focus',
]
),
'focus_background_color_hover' => implode(
',',
[
'.woocommerce %%order_class%% .select2-container--open:hover .select2-selection',
'.woocommerce %%order_class%% form .input-text:focus:hover',
]
),
'focus_text_color' => implode(
',',
array(
'.woocommerce %%order_class%% .select2-container--open .select2-selection__rendered',
'.woocommerce %%order_class%% form .form-row input.input-text:focus',
)
),
'focus_text_color_hover' => implode(
',',
array(
'.woocommerce %%order_class%% .select2-container--open:hover .select2-selection__rendered',
'.woocommerce %%order_class%% form .form-row input.input-text:focus:hover',
)
),
'form_text_color' => implode(
',',
array(
'.woocommerce %%order_class%% .select2-container--default .select2-selection--single .select2-selection__rendered',
'.woocommerce %%order_class%% form .form-row .input-text',
)
),
'form_text_color_hover' => implode(
',',
array(
'.woocommerce %%order_class%% .select2-container .select2-selection--single:hover .select2-selection__rendered',
'.woocommerce %%order_class%% form .form-row .input-text:hover',
)
),
),
'box_shadow' => array(
'css' => array(
'main' => implode(
',',
array(
'%%order_class%% .select2-container--default .select2-selection--single',
'%%order_class%% form .form-row input.input-text',
)
),
),
),
'border_styles' => array(
'form_field' => array(
'label_prefix' => esc_html__( 'Fields', 'et_builder' ),
'css' => array(
'main' => array(
'border_styles' => implode(
',',
array(
'.woocommerce %%order_class%% .select2-container--default .select2-selection--single',
'.woocommerce %%order_class%% form .form-row .input-text',
)
),
'border_radii' => implode(
',',
array(
'.woocommerce %%order_class%% .select2-container--default .select2-selection--single',
'.woocommerce %%order_class%% form .form-row input.input-text',
)
),
),
),
'defaults' => array(
'border_radii' => 'on|0px|0px|0px|0px',
'border_styles' => array(
'width' => '0px',
'style' => 'solid',
),
),
),
'form_field_focus' => array(
'label_prefix' => esc_html__( 'Fields Focus', 'et_builder' ),
'css' => array(
'main' => array(
'border_styles' => implode(
',',
array(
'.woocommerce %%order_class%% .select2-container--default.select2-container--open .select2-selection--single',
'.woocommerce %%order_class%% form .form-row .input-text:focus',
)
),
'border_radii' => implode(
',',
array(
'.woocommerce %%order_class%% .select2-container--default.select2-container--open .select2-selection--single',
'.woocommerce %%order_class%% form .form-row input.input-text:focus',
)
),
),
),
'defaults' => array(
'border_radii' => 'on|0px|0px|0px|0px',
'border_styles' => array(
'width' => '0px',
'style' => 'solid',
),
),
),
),
'font_field' => array(
'css' => array(
'main' => implode(
',',
[
'.woocommerce %%order_class%% .select2-container--default .select2-selection--single',
'.woocommerce %%order_class%% form .form-row .input-text',
]
),
// Required to override default WooCommerce styles.
'important' => array( 'line-height', 'size', 'font' ),
),
'font_size' => array(
'default' => '14px',
),
'line_height' => array(
'default' => '1.7em',
),
),
'margin_padding' => array(
'css' => array(
'main' => '%%order_class%% form .form-row input.input-text, %%order_class%% .select2-container--default .select2-selection--single .select2-selection__rendered',
'padding' => '%%order_class%% form .form-row input.input-text, %%order_class%% .select2-container--default .select2-selection--single',
'margin' => '%%order_class%% form .form-row input.input-text, %%order_class%% .select2-container--default .select2-selection--single',
),
),
'width' => array(),
'toggle_priority' => 55,
),
'form_notice' => array(
'label' => esc_html__( 'Form Notice', 'et_builder' ),
'css' => array(
'form_text_color' => '%%order_class%% .woocommerce-error li',
'background_color' => '%%order_class%% .woocommerce-error',
'important' => array( 'background_color' ),
),
'background_color' => array(
'description' => esc_html__( 'Pick a color to fill the module\'s notice.', 'et_builder' ),
),
'text_color' => array(
'description' => esc_html__( 'Pick a color to be used for the text written inside notice.', 'et_builder' ),
),
'focus_background_color' => false,
'focus_text_color' => false,
'font_field' => array(
'css' => array(
'main' => '%%order_class%% .woocommerce-NoticeGroup .woocommerce-error',
'important' => array( 'text-shadow', 'size' ),
'text_shadow' => '%%order_class%% .woocommerce-NoticeGroup .woocommerce-error',
),
'font_size' => array(
'default' => '18px',
),
'line_height' => array(
'default' => '1.7em',
),
),
'margin_padding' => array(
'css' => array(
'main' => '%%order_class%% .woocommerce-error',
'important' => array( 'custom_padding' ),
),
'custom_padding' => array(
'default' => '15px|15px|15px|15px|false|false',
),
),
'border_styles' => array(
'form_notice' => array(
'label_prefix' => esc_html__( 'Form Notice', 'et_builder' ),
'css' => array(
'main' => array(
'border_styles' => '%%order_class%% .woocommerce-error',
'border_radii' => '%%order_class%% .woocommerce-error',
),
'important' => true,
),
'defaults' => array(
'border_radii' => 'on|0px|0px|0px|0px',
'border_styles' => array(
'width' => '0px',
'style' => 'solid',
),
),
'use_focus_borders' => false,
),
),
'box_shadow' => array(
'css' => array(
'main' => '%%order_class%% .woocommerce-error',
'important' => true,
),
),
),
),
);
$this->custom_css_fields = array(
'title_text' => array(
'label' => esc_html__( 'Title Text', 'et_builder' ),
'selector' => '%%order_class%% h3',
),
'field_label' => array(
'label' => esc_html__( 'Field Label', 'et_builder' ),
'selector' => '%%order_class%% form .form-row label',
),
'form_field' => array(
'label' => esc_html__( 'Fields', 'et_builder' ),
'selector' => implode(
',',
array(
'%%order_class%% .select2-container--default .select2-selection--single',
'%%order_class%% form .form-row .input-text',
)
),
),
'form_notice' => array(
'label' => esc_html__( 'Form Notice', 'et_builder' ),
'selector' => '%%order_class%% .woocommerce-error',
),
);
$this->help_videos = array(
array(
'id' => esc_html( '7X03vBPYJ1o' ),
'name' => esc_html__( 'Divi WooCommerce Modules', 'et_builder' ),
),
);
}
/**
* {@inheritdoc}
*/
public function get_fields() {
$fields = array(
'required_field_indicator_color' => array(
'label' => esc_html__(
'Required Field Indicator Color',
'et_builder'
),
'description' => esc_html__(
'Pick a color to be used for the required field indicator.',
'et_builder'
),
'type' => 'color-alpha',
'option_category' => 'button',
'custom_color' => true,
'default' => '',
'tab_slug' => 'advanced',
'toggle_slug' => 'field_label',
'hover' => 'tabs',
'mobile_options' => true,
'priority' => 5,
),
'fields_width' => ET_Builder_Module_Helper_Woocommerce_Modules::get_field(
'fields_width'
),
'__checkout_billing' => array(
'type' => 'computed',
'computed_callback' => array(
'ET_Builder_Module_Woocommerce_Checkout_Billing',
'get_checkout_billing',
),
'computed_depends_on' => array(
/*
* `depends_on` arg is required. Otherwise AJAX will return null.
* @see et_pb_process_computed_property().
* `product` will not be processed since there is no definition in
* @see ET_Builder_Module_Woocommerce_Checkout_Order::get_fields()
*/
'product',
),
),
'placeholder_color' => ET_Builder_Module_Helper_Woocommerce_Modules::get_field(
'placeholder_color'
),
);
return $fields;
}
/**
* {@inheritdoc}
*/
public function get_transition_fields_css_props() {
$fields = parent::get_transition_fields_css_props();
$fields['required_field_indicator_color'] = array(
'color' => '%%order_class%% form .form-row .required',
);
$fields['placeholder_color'] = array(
'color' => array(
'%%order_class%% form .input-text::placeholder',
'%%order_class%% form .input-text::-webkit-input-placeholder',
'%%order_class%% form .input-text::-moz-placeholder',
'%%order_class%% form .input-text:-ms-input-placeholder',
),
);
return $fields;
}
/**
* Swaps Checkout Order Details template.
*
* Coupon Remove Link must be shown in VB. Hence we swap the template.
*
* @param string $template Template.
* @param string $template_name Template name.
* @param array $args Arguments.
* @param string $template_path Template path.
* @param string $default_path Default path.
*
* @return string
*/
public static function swap_template( $template, $template_name, $args, $template_path, $default_path ) {
$is_template_override = in_array(
$template_name,
array(
'checkout/form-checkout.php',
),
true
);
if ( $is_template_override ) {
return trailingslashit( ET_BUILDER_DIR ) . 'feature/woocommerce/templates/' . $template_name;
}
return $template;
}
/**
* Reset hooks.
*
* @since 4.14.8 $conditional_tags param added.
*
* @param array $conditional_tags List of conditional tags.
*/
public static function maybe_reset_hooks( $conditional_tags ) {
$is_tb = et_()->array_get( $conditional_tags, 'is_tb', false );
ET_Builder_Module_Helper_Woocommerce_Modules::attach_wc_checkout_coupon_form();
ET_Builder_Module_Helper_Woocommerce_Modules::attach_wc_checkout_login_form();
ET_Builder_Module_Helper_Woocommerce_Modules::attach_wc_checkout_order_review();
ET_Builder_Module_Helper_Woocommerce_Modules::attach_wc_checkout_payment();
if ( ! et_fb_is_computed_callback_ajax() && ! $is_tb ) {
remove_filter(
'wc_get_template',
[
'ET_Builder_Module_Woocommerce_Checkout_Billing',
'swap_template',
],
10,
5
);
}
add_action(
'woocommerce_checkout_shipping',
[
WC_Checkout::instance(),
'checkout_form_shipping',
]
);
}
/**
* Handle hooks.
*
* @since 4.14.8 $conditional_tags param added.
*
* @param array $conditional_tags List of conditional tags.
*/
public static function maybe_handle_hooks( $conditional_tags = array() ) {
$is_tb = et_()->array_get( $conditional_tags, 'is_tb', false );
ET_Builder_Module_Helper_Woocommerce_Modules::detach_wc_checkout_coupon_form();
ET_Builder_Module_Helper_Woocommerce_Modules::detach_wc_checkout_login_form();
ET_Builder_Module_Helper_Woocommerce_Modules::detach_wc_checkout_order_review();
ET_Builder_Module_Helper_Woocommerce_Modules::detach_wc_checkout_payment();
if ( ! et_fb_is_computed_callback_ajax() && ! $is_tb ) {
add_filter(
'wc_get_template',
[
'ET_Builder_Module_Woocommerce_Checkout_Billing',
'swap_template',
],
10,
5
);
}
remove_action(
'woocommerce_checkout_shipping',
[
WC_Checkout::instance(),
'checkout_form_shipping',
]
);
}
/**
* Gets the Billing markup.
*
* @param array $args List of Shortcode attributes.
* @param array $conditional_tags List of conditional tags.
*
* @return string
*/
public static function get_checkout_billing( $args = array(), $conditional_tags = array() ) {
if ( ! class_exists( 'WC_Shortcode_Checkout' ) ||
! method_exists( 'WC_Shortcode_Checkout', 'output' ) ) {
return '';
}
self::maybe_handle_hooks( $conditional_tags );
$is_cart_empty = function_exists( 'WC' ) && isset( WC()->cart ) && WC()->cart->is_empty();
$is_pb_mode = et_fb_is_computed_callback_ajax() || is_et_pb_preview();
$class = 'ET_Builder_Module_Helper_Woocommerce_Modules';
// Set dummy cart contents to output Billing when no product is in cart.
if ( ( $is_cart_empty && $is_pb_mode ) || is_et_pb_preview() ) {
add_filter(
'woocommerce_get_cart_contents',
// phpcs:ignore WordPress.Arrays.CommaAfterArrayItem.NoComma -- Call to a function.
array( $class, 'set_dummy_cart_contents' )
);
}
ob_start();
WC_Shortcode_Checkout::output( array() );
$markup = ob_get_clean();
if ( ( $is_cart_empty && $is_pb_mode ) || is_et_pb_preview() ) {
remove_filter(
'woocommerce_get_cart_contents',
// phpcs:ignore WordPress.Arrays.CommaAfterArrayItem.NoComma -- Call to a function.
array( $class, 'set_dummy_cart_contents' )
);
}
self::maybe_reset_hooks( $conditional_tags );
// Fallback.
if ( ! is_string( $markup ) ) {
$markup = '';
}
return $markup;
}
/**
* Renders the module output.
*
* @param array $attrs List of attributes.
* @param string $content Content being processed.
* @param string $render_slug Slug of module that is used for rendering output.
*
* @return string
*/
public function render( $attrs, $content, $render_slug ) {
if ( function_exists( 'is_order_received_page' )
&& is_order_received_page() ) {
return '';
}
$output = self::get_checkout_billing();
$fields_width = et_()->array_get( $this->props, 'fields_width', false );
if ( false !== $fields_width ) {
$this->add_classname( "et_pb_fields_layout_{$fields_width}" );
}
// Handle Required Field Indicator Color responsive and hover fields.
$required_field_indicator_color_values = et_pb_responsive_options()->get_property_values( $this->props, 'required_field_indicator_color' );
$required_field_indicator_color_hover = $this->get_hover_value( 'required_field_indicator_color' );
$required_field_indicator_selector = '%%order_class%% form .form-row .required';
et_pb_responsive_options()->generate_responsive_css(
$required_field_indicator_color_values,
$required_field_indicator_selector,
'color',
$render_slug,
' !important;',
'color'
);
// Placeholder Color.
$placeholder_selectors = array(
'%%order_class%% form .form-row input.input-text::placeholder',
'%%order_class%% form .form-row input.input-text::-webkit-input-placeholder',
'%%order_class%% form .form-row input.input-text::-moz-placeholder',
'%%order_class%% form .form-row input.input-text:-ms-input-placeholder',
);
$this->generate_styles(
array(
'base_attr_name' => 'placeholder_color',
'selector' => join( ', ', $placeholder_selectors ),
'hover_pseudo_selector_location' => 'suffix',
'sticky_pseudo_selector_location' => 'prefix',
'css_property' => 'color',
'important' => false,
'render_slug' => $render_slug,
'type' => 'color',
)
);
if ( et_builder_is_hover_enabled( 'required_field_indicator_color', $this->props ) ) {
ET_Builder_Element::set_style(
$render_slug,
array(
'selector' => '%%order_class%% form .form-row:hover .required',
'declaration' => sprintf(
'color: %1$s;',
esc_html( $required_field_indicator_color_hover )
),
)
);
}
$this->add_classname( $this->get_text_orientation_classname() );
global $wp;
if ( ! empty( $wp->query_vars['order-pay'] ) ) {
$this->add_classname( 'et_pb_wc_order_pay' );
}
if ( isset( WC()->cart )
&& ! is_null( WC()->cart && method_exists( WC()->cart, 'check_cart_items' ) )
&& ! is_et_pb_preview() ) {
$return = WC()->cart->check_cart_items();
if ( wc_notice_count( 'error' ) > 0 ) {
$this->add_classname( 'et_pb_hide_module' );
}
}
return $this->_render_module_wrapper( $output, $render_slug );
}
}
new ET_Builder_Module_Woocommerce_Checkout_Billing();
@@ -0,0 +1,678 @@
<?php
/**
* WooCommerce Modules: ET_Builder_Module_Woocommerce_Checkout_Order_Details class
*
* The ET_Builder_Module_Woocommerce_Checkout_Order_Details Class is responsible for rendering the
* Checkout order details section using the WooCommerce template.
*
* @package Divi\Builder
*
* @since 4.14.0
*/
defined( 'ABSPATH' ) || exit;
/**
* Class representing Woo Checkout Details component.
*/
class ET_Builder_Module_Woocommerce_Checkout_Order_Details extends ET_Builder_Module {
/**
* Initialize.
*/
public function init() {
$this->name = esc_html__( 'Woo Checkout Details', 'et_builder' );
$this->plural = esc_html__( 'Woo Checkout Details', 'et_builder' );
$this->slug = 'et_pb_wc_checkout_order_details';
$this->vb_support = 'on';
$this->folder_name = 'et_pb_woo_modules';
$this->settings_modal_toggles = array(
'advanced' => array(
'toggles' => array(
'title' => array(
'title' => esc_html__( 'Title Text', 'et_builder' ),
'priority' => 55,
),
'column_label' => array(
'title' => esc_html__( 'Column Label', 'et_builder' ),
'priority' => 60,
),
'body' => array(
'title' => esc_html__( 'Body Text', 'et_builder' ),
'tabbed_subtoggles' => true,
'sub_toggles' => array(
'p' => array(
'name' => 'P',
'icon' => 'text-left',
),
'a' => array(
'name' => 'A',
'icon' => 'text-link',
),
),
'priority' => 65,
),
'table' => array(
'title' => esc_html__( 'Table', 'et_builder' ),
'priority' => 70,
),
'table_row' => array(
'title' => esc_html__( 'Table Row', 'et_builder' ),
'priority' => 75,
),
'table_cell' => array(
'title' => esc_html__( 'Table Cell', 'et_builder' ),
'priority' => 80,
),
),
),
);
$this->advanced_fields = array(
'fonts' => array(
'title' => array(
'label' => esc_html__( 'Title', 'et_builder' ),
'css' => array(
'main' => '%%order_class%% #order_review_heading',
),
'font_size' => array(
'default' => '22px',
),
'line_height' => array(
'default' => '1em',
),
),
'column_label' => array(
'label' => esc_html__( 'Column Label', 'et_builder' ),
'css' => array(
'main' => '%%order_class%% table.shop_table thead th',
),
'font_size' => array(
'default' => '14px',
),
'line_height' => array(
'default' => '1.5em',
),
),
'body' => array(
'label' => esc_html__( 'Body', 'et_builder' ),
'css' => array(
// Accepts only string and not array. Hence using `implode`.
'main' => implode(
', ',
array(
'%%order_class%% td',
'%%order_class%% tfoot th',
)
),
// Accepts only string and not array. Hence using `implode`.
'line_height' => implode(
', ',
array(
'%%order_class%% table.shop_table th',
'%%order_class%% table.shop_table td',
)
),
),
'font_size' => array(
'default' => '14px',
),
'line_height' => array(
'default' => '1.5em',
),
'toggle_slug' => 'body',
'sub_toggle' => 'p',
),
'link' => array(
'label' => esc_html__( 'Link', 'et_builder' ),
'css' => array(
'main' => '%%order_class%% td a',
'line_height' => '%%order_class%% td a',
),
'font_size' => array(
'default' => '14px',
),
'line_height' => array(
'default' => '1.5em',
),
'toggle_slug' => 'body',
'sub_toggle' => 'a',
),
),
'text' => array(
'css' => array(
'text_orientation' => '%%order_class%% h3, table.shop_table th, table.shop_table tr td',
// Refer ET_Builder_Module_Field_TextShadow::update_styles for selector
// definition.
'text_shadow' => '%%order_class%% h3, table.shop_table th, table.shop_table tr td',
),
),
'link_options' => false,
'form_field' => array(
'table' => array(
'label' => esc_html__( 'Table', 'et_builder' ),
'css' => array(
'main' => '%%order_class%% table.shop_table',
),
'background_color' => array(
'description' => esc_html__( 'Pick a color to fill the module\'s table.', 'et_builder' ),
),
'font_field' => false,
'margin_padding' => array(
'css' => array(
'main' => '%%order_class%% table.shop_table',
'important' => array( 'custom_margin' ),
),
'depends_on' => array(
'collapse_table_gutters_borders',
),
'depends_show_if' => 'off',
),
'text_color' => false,
'focus_background_color' => false,
'focus_text_color' => false,
'border_styles' => array(
'table' => array(
'label_prefix' => esc_html__( 'Table', 'et_builder' ),
'css' => array(
'main' => array(
'border_styles' => '%%order_class%% table.shop_table',
'border_radii' => '%%order_class%% table.shop_table',
),
),
'use_focus_borders' => false,
'defaults' => array(
'border_radii' => 'on|5px|5px|5px|5px',
'border_styles' => array(
'width' => '1px',
),
),
'depends_on' => array(
'collapse_table_gutters_borders',
),
'depends_show_if' => 'off',
),
),
'box_shadow' => array(
'css' => array(
'main' => '%%order_class%% table.shop_table',
),
),
),
'table_row' => array(
'label' => esc_html__( 'Table Row', 'et_builder' ),
'css' => array(
'main' => '%%order_class%% table.shop_table tr',
),
'background_color' => array(
'description' => esc_html__( 'Pick a color to fill the module\'s table row.', 'et_builder' ),
),
'font_field' => false,
'margin_padding' => array(
'css' => array(
'main' => '%%order_class%% table.shop_table tr th, %%order_class%% table.shop_table tr td',
),
'use_margin' => false,
'use_padding' => false,
),
'text_color' => false,
'focus_background_color' => false,
'focus_text_color' => false,
'border_styles' => array(
'table_row' => array(
'label_prefix' => esc_html__( 'Table Row', 'et_builder' ),
'css' => array(
'main' => array(
// Accepts only string and not array. Hence using `implode`.
'border_radii' => implode(
', ',
array(
'%%order_class%% table.shop_table th',
'%%order_class%% table.shop_table td',
)
),
'border_styles' => implode(
', ',
array(
'%%order_class%% table.shop_table th',
'%%order_class%% table.shop_table td',
)
),
),
'important' => true,
),
'use_focus_borders' => false,
'defaults' => array(
'border_radii' => 'on|0px|0px|0px|0px',
'border_styles' => array(
'width' => '1px',
),
),
'depends_on' => array(
'collapse_table_gutters_borders',
),
'depends_show_if' => 'on',
'use_radius' => false,
),
),
'box_shadow' => array(
'css' => array(
'main' => '%%order_class%% table.shop_table tr',
),
),
),
'table_cell' => array(
'label' => esc_html__( 'Table Cell', 'et_builder' ),
'css' => array(
'main' => '%%order_class%% table.shop_table tr th, %%order_class%% table.shop_table tr td',
),
'background_color' => array(
'description' => esc_html__( 'Pick a color to fill the module\'s table cell.', 'et_builder' ),
),
'font_field' => false,
'margin_padding' => array(
'css' => array(
'main' => implode(
', ',
array(
'%%order_class%% table.shop_table tr th',
'%%order_class%% table.shop_table tr td',
)
),
),
'use_margin' => false,
),
'text_color' => false,
'focus_background_color' => false,
'focus_text_color' => false,
'border_styles' => array(
'table_cell' => array(
'label_prefix' => esc_html__( 'Table Cell', 'et_builder' ),
'css' => array(
'main' => array(
'border_styles' => '%%order_class%% table.shop_table tr th,%%order_class%% table.shop_table tr td',
'border_radii' => '%%order_class%% table.shop_table tr th, %%order_class%% table.shop_table tr td',
),
'important' => array( 'border-color' ),
),
'use_focus_borders' => false,
'defaults' => array(
'border_radii' => 'on|0px|0px|0px|0px',
'border_styles' => array(
'width' => '0px',
'style' => 'solid',
),
'composite' => array(
'border_top' => array(
'border_width_top' => '1px',
'border_style_top' => 'solid',
'border_color_top' => '#eeeeee',
),
),
),
'depends_on' => array(
'collapse_table_gutters_borders',
),
'depends_show_if' => 'off',
),
),
'box_shadow' => array(
'css' => array(
'main' => '%%order_class%% table.shop_table tr th, %%order_class%% table.shop_table td',
),
),
),
),
// Use !important in Spacing OG — Margin values.
'margin_padding' => array(
'css' => array(
'important' => array( 'custom_margin' ),
),
),
);
$this->custom_css_fields = array(
'title_text' => array(
'label' => esc_html__( 'Title Text', 'et_builder' ),
'selector' => '%%order_class%% h1, %%order_class%% h2, %%order_class%% h3, %%order_class%% h4, %%order_class%% h5, %%order_class%% h6',
),
);
$this->help_videos = array(
array(
'id' => esc_html( '7X03vBPYJ1o' ),
'name' => esc_html__( 'Divi WooCommerce Modules', 'et_builder' ),
),
);
}
/**
* {@inheritdoc}
*/
public function get_fields() {
$fields = array(
'__checkout_order_details' => array(
'type' => 'computed',
'computed_callback' => array(
'ET_Builder_Module_Woocommerce_Checkout_Order_Details',
// phpcs:ignore WordPress.Arrays.CommaAfterArrayItem.NoComma -- This is a function call.
'get_checkout_order_details'
),
'computed_depends_on' => array(
/*
* `depends_on` arg is required. Otherwise AJAX will return null.
* @see et_pb_process_computed_property().
* `product` will not be processed since there is no definition in
* @see ET_Builder_Module_Woocommerce_Checkout_Order::get_fields()
*/
'product',
),
),
'collapse_table_gutters_borders' => ET_Builder_Module_Helper_Woocommerce_Modules::get_field( 'collapse_table_gutters_borders' ),
'vertical_gutter_width' => ET_Builder_Module_Helper_Woocommerce_Modules::get_field( 'vertical_gutter_width' ),
'horizontal_gutter_width' => ET_Builder_Module_Helper_Woocommerce_Modules::get_field( 'horizontal_gutter_width' ),
);
return $fields;
}
/**
* Swaps Checkout Order Details template.
*
* Coupon Remove Link must be shown in VB. Hence we swap the template.
*
* @param string $template Template.
* @param string $template_name Template name.
* @param array $args Arguments.
* @param string $template_path Template path.
* @param string $default_path Default path.
*
* @return string
*/
public static function swap_template_fe( $template, $template_name, $args, $template_path, $default_path ) {
$is_template_override = in_array(
$template_name,
array(
'checkout/form-checkout.php',
),
true
);
if ( $is_template_override ) {
return trailingslashit( ET_BUILDER_DIR ) . 'feature/woocommerce/templates/' . $template_name;
}
return $template;
}
/**
* Swaps Checkout Order Details template.
*
* Coupon Remove Link must be shown in VB. Hence we swap the template.
*
* @param string $template Template.
* @param string $template_name Template name.
* @param array $args Arguments.
* @param string $template_path Template path.
* @param string $default_path Default path.
*
* @return string
*/
public static function swap_template( $template, $template_name, $args, $template_path, $default_path ) {
$is_template_override = in_array(
$template_name,
array(
'checkout/review-order.php',
),
true
);
if ( $is_template_override ) {
return trailingslashit( ET_BUILDER_DIR ) . 'feature/woocommerce/templates/' . $template_name;
}
return $template;
}
/**
* Reset hooks.
*
* @param array $conditional_tags Array of conditional tags.
*/
public static function maybe_reset_hooks( $conditional_tags ) {
$is_tb = et_()->array_get( $conditional_tags, 'is_tb', false );
ET_Builder_Module_Helper_Woocommerce_Modules::attach_wc_checkout_coupon_form();
ET_Builder_Module_Helper_Woocommerce_Modules::attach_wc_checkout_login_form();
ET_Builder_Module_Helper_Woocommerce_Modules::attach_wc_checkout_billing();
ET_Builder_Module_Helper_Woocommerce_Modules::attach_wc_checkout_shipping();
ET_Builder_Module_Helper_Woocommerce_Modules::attach_wc_checkout_payment();
if ( et_fb_is_computed_callback_ajax() || $is_tb ) {
remove_filter(
'wc_get_template',
[
'ET_Builder_Module_Woocommerce_Checkout_Order_Details',
'swap_template',
],
10,
5
);
}
if ( ! et_fb_is_computed_callback_ajax() && ! $is_tb ) {
remove_filter(
'wc_get_template',
[
'ET_Builder_Module_Woocommerce_Checkout_Order_Details',
'swap_template_fe',
],
10,
5
);
}
}
/**
* Handle hooks.
*
* @param array $conditional_tags Array of conditional tags.
*/
public static function maybe_handle_hooks( $conditional_tags ) {
$is_tb = et_()->array_get( $conditional_tags, 'is_tb', false );
ET_Builder_Module_Helper_Woocommerce_Modules::detach_wc_checkout_coupon_form();
ET_Builder_Module_Helper_Woocommerce_Modules::detach_wc_checkout_login_form();
ET_Builder_Module_Helper_Woocommerce_Modules::detach_wc_checkout_billing();
ET_Builder_Module_Helper_Woocommerce_Modules::detach_wc_checkout_shipping();
ET_Builder_Module_Helper_Woocommerce_Modules::detach_wc_checkout_payment();
if ( et_fb_is_computed_callback_ajax() || $is_tb ) {
add_filter(
'wc_get_template',
[
'ET_Builder_Module_Woocommerce_Checkout_Order_Details',
'swap_template',
],
10,
5
);
}
if ( ! et_fb_is_computed_callback_ajax() && ! $is_tb ) {
add_filter(
'wc_get_template',
[
'ET_Builder_Module_Woocommerce_Checkout_Order_Details',
'swap_template_fe',
],
10,
5
);
}
}
/**
* Gets the Checkout Order Details markup.
*
* @param array $args Array of `depends_on` key/value pairs.
* @param array $conditional_tags Array of conditional tags.
*
* @return string
*/
public static function get_checkout_order_details( $args = array(), $conditional_tags = array() ) {
if ( ! class_exists( 'WC_Shortcode_Checkout' )
|| ! method_exists( 'WC_Shortcode_Checkout', 'output' ) ) {
return '';
}
self::maybe_handle_hooks( $conditional_tags );
$is_cart_empty = function_exists( 'WC' ) && isset( WC()->cart ) && WC()->cart->is_empty();
$is_pb_mode = et_fb_is_computed_callback_ajax() || is_et_pb_preview();
$class = 'ET_Builder_Module_Helper_Woocommerce_Modules';
// Set dummy cart contents to output Billing when no product is in cart.
if ( ( $is_cart_empty && $is_pb_mode ) || is_et_pb_preview() ) {
add_filter(
'woocommerce_get_cart_contents',
// phpcs:ignore WordPress.Arrays.CommaAfterArrayItem.NoComma -- This is a function call.
array( $class, 'set_dummy_cart_contents' )
);
}
ob_start();
WC_Shortcode_Checkout::output( array() );
$markup = ob_get_clean();
if ( ( $is_cart_empty && $is_pb_mode ) || is_et_pb_preview() ) {
remove_filter(
'woocommerce_get_cart_contents',
// phpcs:ignore WordPress.Arrays.CommaAfterArrayItem.NoComma -- This is a function call.
array( $class, 'set_dummy_cart_contents' )
);
}
self::maybe_reset_hooks( $conditional_tags );
// Fallback.
if ( ! is_string( $markup ) ) {
$markup = '';
}
return $markup;
}
/**
* Renders the module output.
*
* @param array $attrs List of attributes.
* @param string $content Content being processed.
* @param string $render_slug Slug of module that is used for rendering output.
*
* @return string
*/
public function render( $attrs, $content, $render_slug ) {
if ( function_exists( 'is_order_received_page' )
&& is_order_received_page() ) {
return '';
}
$this->add_classname( $this->get_text_orientation_classname() );
$output = self::get_checkout_order_details();
$collapse_table_gutters_borders_style_values = array();
$table_border_spacing_style_values = array();
foreach ( et_pb_responsive_options()->get_modes() as $device ) {
$collapse_table_gutters_borders = et_pb_responsive_options()->get_property_value(
$attrs,
'collapse_table_gutters_borders',
'off',
$device,
true
);
$horizontal_gutter_width_value = et_pb_responsive_options()->get_property_value(
$attrs,
'horizontal_gutter_width',
'0px',
$device,
true
);
$vertical_gutter_width_value = et_pb_responsive_options()->get_property_value(
$attrs,
'vertical_gutter_width',
'0px',
$device,
true
);
if ( 'on' === $collapse_table_gutters_borders ) {
$collapse_table_gutters_borders_style_values[ $device ] = array(
'border-collapse' => 'collapse',
);
$table_border_spacing_style_values[ $device ] = array(
'border-spacing' => '0 0',
);
} else {
$collapse_table_gutters_borders_style_values[ $device ] = array(
'border-collapse' => 'separate',
);
$table_border_spacing_style_values[ $device ] = array(
'border-spacing' => sprintf(
'%s %s',
$horizontal_gutter_width_value,
$vertical_gutter_width_value
),
);
}
}
et_pb_responsive_options()->generate_responsive_css(
$collapse_table_gutters_borders_style_values,
'%%order_class%% table.shop_table',
'border-collapse',
$render_slug,
'',
'border-collapse' /* Can be anything other than `range`. */
);
et_pb_responsive_options()->generate_responsive_css(
$table_border_spacing_style_values,
'%%order_class%% table.shop_table',
'border-spacing',
$render_slug,
'',
'border-spacing' /* Can be anything other than `range`. */
);
if ( isset( WC()->cart )
&& ! is_null( WC()->cart && method_exists( WC()->cart, 'check_cart_items' ) )
&& ! is_et_pb_preview() ) {
$return = WC()->cart->check_cart_items();
if ( wc_notice_count( 'error' ) > 0 ) {
$this->add_classname( 'et_pb_hide_module' );
}
}
global $wp;
if ( ! empty( $wp->query_vars['order-pay'] ) ) {
$this->add_classname( 'et_pb_wc_order_pay' );
}
return $this->_render_module_wrapper( $output, $render_slug );
}
}
new ET_Builder_Module_Woocommerce_Checkout_Order_Details();
@@ -0,0 +1,694 @@
<?php
/**
* WooCommerce Modules: ET_Builder_Module_Woocommerce_Checkout_Payment_Info class
*
* The ET_Builder_Module_Woocommerce_Checkout_Payment_Info Class is responsible for rendering the
* Checkout payment info using the WooCommerce template.
*
* @package Divi\Builder
*
* @since 4.14.0
*/
defined( 'ABSPATH' ) || exit;
/**
* Class representing WooCommerce Checkout Payment component.
*/
class ET_Builder_Module_Woocommerce_Checkout_Payment_Info extends ET_Builder_Module {
/**
* Initialize.
*/
public function init() {
$this->name = esc_html__( 'Woo Checkout Payment', 'et_builder' );
$this->plural = esc_html__( 'Woo Checkout Payment', 'et_builder' );
$this->slug = 'et_pb_wc_checkout_payment_info';
$this->vb_support = 'on';
$this->folder_name = 'et_pb_woo_modules';
$this->main_css_element = implode(
',',
array(
'%%order_class%% .woocommerce-checkout #payment',
'%%order_class%% .woocommerce-order',
)
);
$this->settings_modal_toggles = array(
'advanced' => array(
'toggles' => array(
'body' => array(
'title' => esc_html__( 'Body Text', 'et_builder' ),
'tabbed_subtoggles' => true,
'sub_toggles' => array(
'p' => array(
'name' => 'P',
'icon' => 'text-left',
),
'a' => array(
'name' => 'A',
'icon' => 'text-link',
),
),
'priority' => 52,
),
'radio_button' => array(
'title' => esc_html__( 'Radio Buttons', 'et_builder' ),
'priority' => 65,
),
'selected_radio_button' => array(
'title' => esc_html__( 'Selected Radio Button', 'et_builder' ),
'priority' => 70,
),
),
),
);
$this->advanced_fields = array(
'fonts' => array(
'body' => array(
'label' => et_builder_i18n( 'Body' ),
'css' => array(
'main' => implode(
',',
array(
'%%order_class%% .woocommerce-privacy-policy-text',
'%%order_class%% .woocommerce-privacy-policy-text a',
'%%order_class%% .wc_payment_method a',
// Order confirmation Page elements.
'%%order_class%% .woocommerce-order p',
'%%order_class%% .woocommerce-order .woocommerce-order-overview',
)
),
'important' => array( 'size', 'line-height' ),
),
'font_size' => array(
'default' => '14px',
),
'line_height' => array(
'default' => '1.7em',
),
'toggle_slug' => 'body',
'sub_toggle' => 'p',
),
'link' => array(
'label' => et_builder_i18n( 'Link' ),
'css' => array(
'main' => implode(
',',
array(
'%%order_class%% .woocommerce-privacy-policy-text a',
'%%order_class%% .wc_payment_method a',
)
),
// CPT style uses `!important` so outputting important is inevitable.
'important' => 'all',
),
'font_size' => array(
'default' => '14px',
),
'line_height' => array(
'default' => '1.7em',
),
'toggle_slug' => 'body',
'sub_toggle' => 'a',
),
),
'link_options' => false,
'button' => array(
'button' => array(
'label' => esc_html__( 'Button', 'et_builder' ),
'css' => array(
'main' => '%%order_class%% #payment #place_order',
),
'use_alignment' => false,
'border_width' => array(
'default' => '2px',
),
'box_shadow' => array(
'css' => array(
'main' => '%%order_class%% #payment #place_order',
),
),
'margin_padding' => array(
'css' => array(
'important' => 'all',
),
),
'toggle_priority' => 80,
),
),
'form_field' => array(
'radio_button' => array(
'label' => esc_html__( 'Radio Button', 'et_builder' ),
'css' => array(
'main' => '%%order_class%% #payment .wc_payment_method',
'text_shadow' => '%%order_class%% #payment .wc_payment_method label',
),
'background_color' => array(
'description' => esc_html__( 'Pick a color to fill the module\'s radio buttons.', 'et_builder' ),
),
'text_color' => array(
'description' => esc_html__( 'Pick a color to be used for the text written next to radio button.', 'et_builder' ),
),
'box_shadow' => array(
'css' => array(
'main' => '%%order_class%% #payment .wc_payment_method',
),
),
'border_styles' => array(
'radio_button' => array(
'label_prefix' => esc_html__( 'Radio Button', 'et_builder' ),
'css' => array(
'main' => array(
'border_styles' => '%%order_class%% #payment .wc_payment_method',
'border_radii' => '%%order_class%% #payment .wc_payment_method',
),
),
'defaults' => array(
'border_radii' => 'off|0px|0px|0px|0px',
'border_style' => array(
'width' => '0px',
'style' => 'none',
),
),
),
),
'font_field' => array(
'css' => array(
'main' => '%%order_class%% #payment .wc_payment_method label',
'focus' => '%%order_class%% #payment .input-radio:focus',
'text_align' => '%%order_class%% #payment ul.payment_methods li',
),
'font_size' => array(
'default' => '14px',
),
'line_height' => array(
'default' => '1.4em',
),
),
'focus_background_color' => false,
'focus_text_color' => false,
'margin_padding' => array(
'css' => array(
// Different from main css selector for added specificity.
'margin' => '%%order_class%% #payment ul.payment_methods li',
'padding' => '%%order_class%% #payment ul.payment_methods li',
),
),
'width' => array(),
),
'selected_radio_button' => array(
'label' => esc_html__( 'Selected Radio Button', 'et_builder' ),
'css' => array(
'main' => '%%order_class%% #payment .wc_payment_method.et_pb_checked',
'text_shadow' => '%%order_class%% #payment .wc_payment_method.et_pb_checked label',
),
'background_color' => array(
'description' => esc_html__( 'Pick a color to fill the module\'s selected radio button.', 'et_builder' ),
),
'text_color' => array(
'description' => esc_html__( 'Pick a color to be used for the text written next to selected radio button.', 'et_builder' ),
),
'box_shadow' => array(
'css' => array(
'main' => '%%order_class%% #payment .wc_payment_method.et_pb_checked',
),
),
'border_styles' => array(
'selected_radio_button' => array(
'label_prefix' => esc_html__( 'Selected Radio Button', 'et_builder' ),
'css' => array(
'main' => array(
'border_styles' => '%%order_class%% #payment .wc_payment_method.et_pb_checked',
'border_radii' => '%%order_class%% #payment .wc_payment_method.et_pb_checked',
),
),
'defaults' => array(
'border_radii' => 'off|0px|0px|0px|0px',
'border_style' => array(
'width' => '0px',
'style' => 'none',
),
),
),
),
'font_field' => array(
'css' => array(
'main' => '%%order_class%% #payment .wc_payment_method.et_pb_checked label',
'focus' => '%%order_class%% #payment .wc_payment_method.et_pb_checked .input-radio:focus',
'text_align' => '%%order_class%% #payment ul.payment_methods li.et_pb_checked',
),
'font_size' => array(
'default' => '14px',
),
'line_height' => array(
'default' => '1.4em',
),
),
'focus_background_color' => false,
'focus_text_color' => false,
'margin_padding' => array(
'css' => array(
// Different from main css selector for added specificity.
'margin' => '%%order_class%% #payment ul.payment_methods li.et_pb_checked',
'padding' => '%%order_class%% #payment ul.payment_methods li.et_pb_checked',
),
),
'width' => array(),
),
'tooltip' => array(
'label' => esc_html__( 'Tooltip', 'et_builder' ),
'css' => array(
'main' => '%%order_class%% #payment div.payment_box',
),
'background_color' => array(
'description' => esc_html__( 'Pick a color to fill the module\'s tooltip.', 'et_builder' ),
),
'font_field' => array(
'css' => array(
'main' => '%%order_class%% .wc_payment_method p',
),
'font_size' => array(
'default' => '',
'allowed_values' => et_builder_get_acceptable_css_string_values( 'width' ),
'allow_empty' => true,
),
'line_height' => array(
'default' => '1.5em',
),
'hide_text_color' => false,
),
'margin_padding' => array(
'css' => array(
'main' => '%%order_class%% #payment div.payment_box',
),
),
'text_color' => false,
'focus_background_color' => false,
'focus_text_color' => false,
'border_styles' => array(
'tooltip' => array(
'label_prefix' => 'Tooltip',
'css' => array(
'main' => array(
'border_styles' => '%%order_class%% #payment div.payment_box',
'border_radii' => '%%order_class%% #payment div.payment_box',
),
),
'defaults' => array(
'border_radii' => 'on|2px|2px|2px|2px',
),
),
),
'box_shadow' => array(
'css' => array(
'main' => '%%order_class%% #payment div.payment_box',
),
),
'toggle_priority' => 70,
),
'form_notice' => array(
'label' => esc_html__( 'Form Notice', 'et_builder' ),
'css' => array(
'main' => '%%order_class%% #payment ul.payment_methods li.woocommerce-info',
),
'background_color' => array(
'description' => esc_html__( 'Pick a color to fill the module\'s notice.', 'et_builder' ),
),
'font_field' => array(
'css' => array(
'main' => '%%order_class%% #payment ul.payment_methods li.woocommerce-notice',
'important' => array( 'size', 'text-shadow' ),
),
'font_size' => array(
'default' => '18px',
),
'line_height' => array(
'default' => '1.7em',
),
'hide_text_color' => false,
),
'margin_padding' => array(
'css' => array(
'main' => '%%order_class%% #payment ul.payment_methods li.woocommerce-info',
'important' => array( 'custom_padding' ),
),
'custom_padding' => array(
'default' => '15px|15px|15px|15px|false|false',
),
),
'text_color' => false,
'focus_background_color' => false,
'focus_text_color' => false,
'border_styles' => array(
'form_notice' => array(
'label_prefix' => esc_html__( 'Notice', 'et_builder' ),
'css' => array(
'main' => array(
'border_styles' => '%%order_class%% #payment ul.payment_methods li.woocommerce-info',
'border_radii' => '%%order_class%% #payment ul.payment_methods li.woocommerce-info',
),
'important' => true,
),
'defaults' => array(
'border_radii' => 'on|0px|0px|0px|0px',
'border_styles' => array(
'width' => '0px',
'style' => 'solid',
),
),
'use_focus_borders' => false,
),
),
'box_shadow' => array(
'css' => array(
'main' => '%%order_class%% #payment ul.payment_methods li.woocommerce-info',
'important' => true,
),
),
'toggle_priority' => 75,
),
),
'background' => array(
'css' => array(
// Backgrounds need to be applied to module wrapper.
'main' => '%%order_class%%.et_pb_wc_checkout_payment_info',
),
'options' => array(
'background_color' => array(
'default' => '#ebe9eb',
),
),
),
'borders' => array(
'default' => array(
'css' => array(
'main' => implode(
',',
array(
'%%order_class%% .woocommerce-checkout #payment',
'%%order_class%% .woocommerce-order',
)
),
),
'defaults' => array(
'border_radii' => 'on|5px|5px|5px|5px',
'border_styles' => array(
'width' => '0px',
'style' => 'solid',
'color' => '#eee',
),
),
),
),
'margin_padding' => array(
'css' => array(
'main' => implode(
',',
array(
'%%order_class%% .woocommerce-checkout #payment',
'%%order_class%% .woocommerce-order',
)
),
),
'custom_padding' => array(
'default' => '1em|1em|1em|1em|false|false',
),
),
);
$this->custom_css_fields = array(
'fields' => array(
'label' => esc_html__( 'Fields', 'et_builder' ),
'selector' => '%%order_class%% #payment .input-radio',
),
'body' => array(
'label' => esc_html__( 'Body', 'et_builder' ),
'selector' => '%%order_class%% .woocommerce-privacy-policy-text',
),
'body_anchor' => array(
'label' => esc_html__( 'Body Link', 'et_builder' ),
'selector' => '%%order_class%% .woocommerce-privacy-policy-text a',
),
'button' => array(
'label' => esc_html__( 'Button', 'et_builder' ),
'selector' => '%%order_class%% #payment #place_order',
),
'tooltip' => array(
'label' => esc_html__( 'Tooltip', 'et_builder' ),
'selector' => '%%order_class%% #payment div.payment_box',
),
'form_notice' => array(
'label' => esc_html__( 'Form Notice', 'et_builder' ),
'selector' => '%%order_class%% #payment ul.payment_methods li.woocommerce-info',
),
);
$this->help_videos = array(
array(
'id' => esc_html( '7X03vBPYJ1o' ),
'name' => esc_html__( 'Divi WooCommerce Modules', 'et_builder' ),
),
);
}
/**
* {@inheritdoc}
*/
public function get_fields() {
$fields = array(
'__checkout_payment_info' => array(
'type' => 'computed',
'computed_callback' => array(
'ET_Builder_Module_Woocommerce_Checkout_Payment_Info',
// phpcs:ignore WordPress.Arrays.CommaAfterArrayItem.NoComma -- This is a function call.
'get_checkout_payment_info'
),
'computed_depends_on' => array(
/*
* `depends_on` arg is required. Otherwise AJAX will return null.
* @see et_pb_process_computed_property().
* `product` will not be processed since there is no definition in
* @see ET_Builder_Module_Woocommerce_Checkout_Order::get_fields()
*/
'product',
),
),
);
return $fields;
}
/**
* Gets the Button classname.
*
* @used-by ET_Builder_Module_Helper_Woocommerce_Modules::add_custom_button_icons()
*
* @return string
*/
public function get_button_classname() {
return 'button';
}
/**
* Swaps login form template.
*
* By default WooCommerce displays these only when logged-out.
* However these templates must be shown in VB when logged-in. Hence we use these templates.
*
* @param string $template Template.
* @param string $template_name Template name.
* @param array $args Arguments.
* @param string $template_path Template path.
* @param string $default_path Default path.
*
* @return string
*/
public static function swap_template( $template, $template_name, $args, $template_path, $default_path ) {
$is_template_override = in_array(
$template_name,
array(
'checkout/payment.php',
'checkout/payment-method.php',
),
true
);
if ( $is_template_override ) {
return trailingslashit( ET_BUILDER_DIR ) . 'feature/woocommerce/templates/' . $template_name;
}
return $template;
}
/**
* Reset hooks.
*/
public static function maybe_reset_hooks() {
ET_Builder_Module_Helper_Woocommerce_Modules::attach_wc_checkout_coupon_form();
ET_Builder_Module_Helper_Woocommerce_Modules::attach_wc_checkout_login_form();
ET_Builder_Module_Helper_Woocommerce_Modules::attach_wc_checkout_billing();
ET_Builder_Module_Helper_Woocommerce_Modules::attach_wc_checkout_shipping();
ET_Builder_Module_Helper_Woocommerce_Modules::attach_wc_checkout_order_review();
}
/**
* Handle hooks.
*/
public static function maybe_handle_hooks() {
ET_Builder_Module_Helper_Woocommerce_Modules::detach_wc_checkout_coupon_form();
ET_Builder_Module_Helper_Woocommerce_Modules::detach_wc_checkout_login_form();
ET_Builder_Module_Helper_Woocommerce_Modules::detach_wc_checkout_billing();
ET_Builder_Module_Helper_Woocommerce_Modules::detach_wc_checkout_shipping();
ET_Builder_Module_Helper_Woocommerce_Modules::detach_wc_checkout_order_review();
}
/**
* Gets the Checkout Payment info markup.
*
* @param array $args Additional arguments.
* @param array $conditional_tags Array of conditional tags.
*
* @return string
*/
public static function get_checkout_payment_info( $args = array(), $conditional_tags = array() ) {
if ( ! class_exists( 'WC_Shortcode_Checkout' )
|| ! method_exists( 'WC_Shortcode_Checkout', 'output' ) ) {
return '';
}
$is_tb = et_()->array_get( $conditional_tags, 'is_tb', false );
self::maybe_handle_hooks();
$is_cart_empty = function_exists( 'WC' ) && isset( WC()->cart ) && WC()->cart->is_empty();
$is_pb_mode = et_fb_is_computed_callback_ajax() || is_et_pb_preview();
$class = 'ET_Builder_Module_Helper_Woocommerce_Modules';
// Set dummy cart contents to output Billing when no product is in cart.
if ( ( $is_cart_empty && $is_pb_mode ) || is_et_pb_preview() ) {
add_filter(
'woocommerce_get_cart_contents',
array( $class, 'set_dummy_cart_contents' )
);
}
if ( et_fb_is_computed_callback_ajax() || $is_tb || is_et_pb_preview() ) {
/*
* Show Login form in VB.
*
* The swapped login form will display irrespective of the user logged-in status.
*
* Previously swapped template (FE) will only display the form when
* a user is not logged-in. Hence we use a different template in VB.
*/
add_filter(
'wc_get_template',
[
'ET_Builder_Module_Woocommerce_Checkout_Payment_Info',
'swap_template',
],
10,
5
);
}
ob_start();
if ( is_et_pb_preview() ) {
printf(
'<div className="et_pb_wc_inactive__message">%s</div>',
esc_html__( 'Woo Checkout Payment module can be used on a page and cannot be previewd.', 'et_builder' )
);
} else {
WC_Shortcode_Checkout::output( array() );
}
$markup = ob_get_clean();
if ( et_fb_is_computed_callback_ajax() || $is_tb || is_et_pb_preview() ) {
remove_filter(
'wc_get_template',
[
'ET_Builder_Module_Woocommerce_Checkout_Payment_Info',
'swap_template',
],
10,
5
);
}
if ( ( $is_cart_empty && $is_pb_mode ) || is_et_pb_preview() ) {
remove_filter(
'woocommerce_get_cart_contents',
array( $class, 'set_dummy_cart_contents' )
);
}
self::maybe_reset_hooks();
// Fallback.
if ( ! is_string( $markup ) ) {
$markup = '';
}
return $markup;
}
/**
* Renders the module output.
*
* @param array $attrs List of attributes.
* @param string $content Content being processed.
* @param string $render_slug Slug of module that is used for rendering output.
*
* @return string
*/
public function render( $attrs, $content, $render_slug ) {
ET_Builder_Module_Helper_Woocommerce_Modules::process_custom_button_icons( $render_slug, $this );
// Module classname.
$this->add_classname( $this->get_text_orientation_classname() );
if ( $this->_module_has_background() ) {
ET_Builder_Element::set_style(
$render_slug,
array(
'selector' => '%%order_class%% .woocommerce-checkout #payment, %%order_class%% .woocommerce-order',
'declaration' => 'background: transparent !important;',
)
);
}
$output = self::get_checkout_payment_info( $attrs );
return $this->_render_module_wrapper( $output, $render_slug );
}
/**
* Checks if module has background.
*
* @since 4.15.0
*
* @return bool
*/
protected function _module_has_background() {
$has_background_color = ! empty( $this->props['background_color'] );
$has_background_gradient = isset( $this->props['use_background_color_gradient'] ) && 'on' === $this->props['use_background_color_gradient'];
$has_background_image = ! empty( $this->props['background_image'] );
$has_background_video_mp4 = ! empty( $this->props['background_video_mp4'] );
$has_background_video_webm = ! empty( $this->props['background_video_webm'] );
$has_background_pattern = isset( $this->props['background_enable_pattern_style'] ) && 'on' === $this->props['background_enable_pattern_style'] && ! empty( $this->props['background_pattern_style'] );
$has_background_mask = isset( $this->props['background_enable_pattern_style'] ) && 'on' === $this->props['background_enable_mask_style'] && ! empty( $this->props['background_mask_style'] );
return $has_background_color
|| $has_background_gradient
|| $has_background_image
|| $has_background_video_mp4
|| $has_background_video_webm
|| $has_background_pattern
|| $has_background_mask;
}
}
new ET_Builder_Module_Woocommerce_Checkout_Payment_Info();
@@ -0,0 +1,595 @@
<?php
/**
* WooCommerce Modules: ET_Builder_Module_Woocommerce_Checkout_Shipping class
*
* The ET_Builder_Module_Woocommerce_Checkout_Shipping Class is responsible for rendering the
* Checkout shipping section using the WooCommerce template.
*
* @package Divi\Builder
*
* @since 4.14.0
*/
defined( 'ABSPATH' ) || exit;
/**
* Class representing WooCommerce Checkout shipping component.
*
* @since 4.14.0
*/
class ET_Builder_Module_Woocommerce_Checkout_Shipping extends ET_Builder_Module {
/**
* Initialize.
*/
public function init() {
$this->name = esc_html__( 'Woo Checkout Shipping', 'et_builder' );
$this->plural = esc_html__( 'Woo Checkout Shipping', 'et_builder' );
$this->slug = 'et_pb_wc_checkout_shipping';
$this->vb_support = 'on';
$this->folder_name = 'et_pb_woo_modules';
$this->settings_modal_toggles = array(
'advanced' => array(
'toggles' => array(
'layout' => array(
'title' => et_builder_i18n( 'Layout' ),
'priority' => 45,
),
'title' => array(
'title' => esc_html__( 'Title Text', 'et_builder' ),
'priority' => 55,
),
'field_label' => array(
'title' => esc_html__( 'Field Labels', 'et_builder' ),
'priority' => 60,
),
'form_field' => array(
'title' => esc_html__( 'Fields', 'et_builder' ),
'priority' => 65,
),
),
),
);
$this->advanced_fields = array(
'fonts' => array(
// Use `title` in place of `header` since `header` needs a workaround in Copy/Paste.
'title' => array(
'label' => esc_html__( 'Title', 'et_builder' ),
'css' => array(
'main' => '%%order_class%% h3',
),
'font_size' => array(
'default' => '22px',
),
'line_height' => array(
'default' => '1em',
),
'tab_slug' => 'advanced',
'toggle_slug' => 'title',
),
'field_label' => array(
'label' => esc_html__( 'Field Label', 'et_builder' ),
'css' => array(
'main' => '%%order_class%% form .form-row label',
),
'font_size' => array(
'default' => '14px',
),
'line_height' => array(
'default' => '2em',
),
'toggle_slug' => 'field_label',
),
),
'text' => array(
'use_background_layout' => false,
'use_text_orientation' => true,
),
'button' => false,
'link_options' => false,
'form_field' => array(
'form_field' => array(
'label' => esc_html__( 'Fields', 'et_builder' ),
'css' => array(
'main' => implode(
',',
array(
'.woocommerce %%order_class%% .select2-container--default .select2-selection--single',
'.woocommerce %%order_class%% form .form-row .input-text',
)
),
'background_color_hover' => implode(
',',
[
'%%order_class%% .select2-container--default .select2-selection--single:hover',
'.woocommerce %%order_class%% form .form-row .input-text:hover',
]
),
'focus_background_color' => implode(
',',
[
'.woocommerce %%order_class%% .select2-container--open .select2-selection',
'.woocommerce %%order_class%% form .input-text:focus',
]
),
'focus_background_color_hover' => implode(
',',
[
'.woocommerce %%order_class%% .select2-container--open:hover .select2-selection',
'.woocommerce %%order_class%% form .input-text:focus:hover',
]
),
'focus_text_color' => implode(
',',
array(
'.woocommerce %%order_class%% .select2-container--open .select2-selection__rendered',
'.woocommerce %%order_class%% form .form-row input.input-text:focus',
)
),
'focus_text_color_hover' => implode(
',',
array(
'.woocommerce %%order_class%% .select2-container--open:hover .select2-selection__rendered',
'.woocommerce %%order_class%% form .form-row input.input-text:focus:hover',
)
),
'form_text_color' => implode(
',',
array(
'.woocommerce %%order_class%% .select2-container--default .select2-selection--single .select2-selection__rendered',
'.woocommerce %%order_class%% form .form-row .input-text',
)
),
'form_text_color_hover' => implode(
',',
array(
'.woocommerce %%order_class%% .select2-container .select2-selection--single:hover .select2-selection__rendered',
'.woocommerce %%order_class%% form .form-row .input-text:hover',
)
),
),
'box_shadow' => array(
'css' => array(
'main' => implode(
',',
array(
'%%order_class%% .select2-container--default .select2-selection--single',
'%%order_class%% form .form-row input.input-text',
)
),
),
),
'border_styles' => array(
'form_field' => array(
'label_prefix' => esc_html__( 'Fields', 'et_builder' ),
'css' => array(
'main' => array(
'border_styles' => implode(
',',
array(
'.woocommerce %%order_class%% .select2-container--default .select2-selection--single',
'.woocommerce %%order_class%% form .form-row .input-text',
)
),
'border_radii' => implode(
',',
array(
'.woocommerce %%order_class%% .select2-container--default .select2-selection--single',
'.woocommerce %%order_class%% form .form-row input.input-text',
)
),
),
),
'defaults' => array(
'border_radii' => 'on|0px|0px|0px|0px',
'border_styles' => array(
'width' => '0px',
'style' => 'solid',
),
),
),
'form_field_focus' => array(
'label_prefix' => esc_html__( 'Fields Focus', 'et_builder' ),
'css' => array(
'main' => array(
'border_styles' => implode(
',',
array(
'.woocommerce %%order_class%% .select2-container--default.select2-container--open .select2-selection--single',
'.woocommerce %%order_class%% form .form-row .input-text:focus',
)
),
'border_radii' => implode(
',',
array(
'.woocommerce %%order_class%% .select2-container--default.select2-container--open .select2-selection--single',
'.woocommerce %%order_class%% form .form-row input.input-text:focus',
)
),
),
),
'defaults' => array(
'border_radii' => 'on|0px|0px|0px|0px',
'border_styles' => array(
'width' => '0px',
'style' => 'solid',
),
),
),
),
'font_field' => array(
'css' => array(
'main' => implode(
',',
[
'.woocommerce %%order_class%% .select2-container--default .select2-selection--single',
'.woocommerce %%order_class%% form .form-row .input-text',
]
),
// Required to override default WooCommerce styles.
'important' => array( 'line-height', 'size', 'font' ),
),
'font_size' => array(
'default' => '14px',
),
'line_height' => array(
'default' => '1.7em',
),
),
'margin_padding' => array(
'css' => array(
'main' => '%%order_class%% form .form-row input.input-text, %%order_class%% .select2-container--default .select2-selection--single .select2-selection__rendered',
'padding' => '%%order_class%% form .form-row input.input-text, %%order_class%% .select2-container--default .select2-selection--single',
'margin' => '%%order_class%% form .form-row input.input-text, %%order_class%% .select2-container--default .select2-selection--single',
),
),
'width' => array(),
'toggle_priority' => 65,
),
),
);
$this->custom_css_fields = array(
'title_text' => array(
'label' => esc_html__( 'Title Text', 'et_builder' ),
'selector' => '%%order_class%% h3',
),
'field_label' => array(
'label' => esc_html__( 'Field Label', 'et_builder' ),
'selector' => '%%order_class%% form .form-row label',
),
'form_field' => array(
'label' => esc_html__( 'Fields', 'et_builder' ),
'selector' => implode(
',',
array(
'%%order_class%% .select2-container--default .select2-selection--single',
'%%order_class%% form .form-row .input-text',
)
),
),
);
$this->help_videos = array(
array(
'id' => esc_html( '7X03vBPYJ1o' ),
'name' => esc_html__( 'Divi WooCommerce Modules', 'et_builder' ),
),
);
}
/**
* {@inheritdoc}
*/
public function get_fields() {
$fields = array(
'required_field_indicator_color' => array(
'label' => esc_html__( 'Required Field Indicator Color', 'et_builder' ),
'description' => esc_html__( 'Pick a color to be used for the required field indicator.', 'et_builder' ),
'type' => 'color-alpha',
'option_category' => 'button',
'custom_color' => true,
'default' => '',
'tab_slug' => 'advanced',
'toggle_slug' => 'field_label',
'hover' => 'tabs',
'mobile_options' => true,
'priority' => 5,
),
'fields_width' => ET_Builder_Module_Helper_Woocommerce_Modules::get_field(
'fields_width'
),
'__checkout_shipping' => array(
'type' => 'computed',
'computed_callback' => array(
'ET_Builder_Module_Woocommerce_Checkout_Shipping',
'get_checkout_shipping',
),
'computed_depends_on' => array(
/*
* `depends_on` arg is required. Otherwise AJAX will return null.
* @see et_pb_process_computed_property().
* `product` will not be processed since there is no definition in
* @see ET_Builder_Module_Woocommerce_Checkout_Order::get_fields()
*/
'product',
),
),
'placeholder_color' => ET_Builder_Module_Helper_Woocommerce_Modules::get_field(
'placeholder_color'
),
);
return $fields;
}
/**
* {@inheritdoc}
*/
public function get_transition_fields_css_props() {
$fields = parent::get_transition_fields_css_props();
$fields['required_field_indicator_color'] = array(
'color' => '%%order_class%% form .form-row .required',
);
$fields['placeholder_color'] = array(
'color' => array(
'%%order_class%% form .input-text::placeholder',
'%%order_class%% form .input-text::-webkit-input-placeholder',
'%%order_class%% form .input-text::-moz-placeholder',
'%%order_class%% form .input-text:-ms-input-placeholder',
),
);
return $fields;
}
/**
* Swaps Checkout Order Details template.
*
* Coupon Remove Link must be shown in VB. Hence we swap the template.
*
* @param string $template Template.
* @param string $template_name Template name.
* @param array $args Arguments.
* @param string $template_path Template path.
* @param string $default_path Default path.
*
* @return string
*/
public static function swap_template( $template, $template_name, $args, $template_path, $default_path ) {
$is_template_override = in_array(
$template_name,
array(
'checkout/form-checkout.php',
),
true
);
if ( $is_template_override ) {
return trailingslashit( ET_BUILDER_DIR ) . 'feature/woocommerce/templates/' . $template_name;
}
return $template;
}
/**
* Handle hooks.
*/
public static function maybe_handle_hooks( $conditional_tags ) {
$is_tb = et_()->array_get( $conditional_tags, 'is_tb', false );
ET_Builder_Module_Helper_Woocommerce_Modules::detach_wc_checkout_coupon_form();
ET_Builder_Module_Helper_Woocommerce_Modules::detach_wc_checkout_login_form();
ET_Builder_Module_Helper_Woocommerce_Modules::detach_wc_checkout_order_review();
ET_Builder_Module_Helper_Woocommerce_Modules::detach_wc_checkout_payment();
if ( ! et_fb_is_computed_callback_ajax() && ! $is_tb ) {
add_filter(
'wc_get_template',
[
'ET_Builder_Module_Woocommerce_Checkout_Shipping',
'swap_template',
],
10,
5
);
}
remove_action(
'woocommerce_checkout_billing',
[
WC_Checkout::instance(),
'checkout_form_billing',
]
);
}
/**
* Reset hooks.
*/
public static function maybe_reset_hooks( $conditional_tags ) {
$is_tb = et_()->array_get( $conditional_tags, 'is_tb', false );
ET_Builder_Module_Helper_Woocommerce_Modules::attach_wc_checkout_coupon_form();
ET_Builder_Module_Helper_Woocommerce_Modules::attach_wc_checkout_login_form();
ET_Builder_Module_Helper_Woocommerce_Modules::attach_wc_checkout_order_review();
ET_Builder_Module_Helper_Woocommerce_Modules::attach_wc_checkout_payment();
if ( ! et_fb_is_computed_callback_ajax() && ! $is_tb ) {
remove_filter(
'wc_get_template',
[
'ET_Builder_Module_Woocommerce_Checkout_Shipping',
'swap_template',
],
10,
5
);
}
add_action(
'woocommerce_checkout_billing',
[
WC_Checkout::instance(),
'checkout_form_billing',
]
);
}
/**
* Gets the Checkout Shipping markup.
*
* @return string
*/
public static function get_checkout_shipping( $args = array(), $conditional_tags = array() ) {
self::maybe_handle_hooks( $conditional_tags );
$is_cart_empty = function_exists( 'WC' ) && isset( WC()->cart ) && WC()->cart->is_empty();
$is_pb_mode = et_fb_is_computed_callback_ajax() || is_et_pb_preview();
$class = 'ET_Builder_Module_Helper_Woocommerce_Modules';
// Set dummy cart contents to output Billing when no product is in cart.
if ( ( $is_cart_empty && $is_pb_mode ) || is_et_pb_preview() ) {
add_filter(
'woocommerce_get_cart_contents',
// phpcs:ignore WordPress.Arrays.CommaAfterArrayItem.NoComma -- Call to a function.
array( $class, 'set_dummy_cart_contents' )
);
}
if ( $is_pb_mode ) {
add_filter( 'woocommerce_cart_needs_shipping_address', '__return_true' );
}
ob_start();
WC_Shortcode_Checkout::output( array() );
$markup = ob_get_clean();
if ( $is_pb_mode ) {
remove_filter( 'woocommerce_cart_needs_shipping_address', '__return_true' );
}
if ( ( $is_cart_empty && $is_pb_mode ) || is_et_pb_preview() ) {
remove_filter(
'woocommerce_get_cart_contents',
array(
$class,
// phpcs:ignore WordPress.Arrays.CommaAfterArrayItem.NoComma -- Call to a function.
'set_dummy_cart_contents'
)
);
}
self::maybe_reset_hooks( $conditional_tags );
// Fallback.
if ( ! is_string( $markup ) ) {
$markup = '';
}
return $markup;
}
/**
* Renders the module output.
*
* @param array $attrs List of attributes.
* @param string $content Content being processed.
* @param string $render_slug Slug of module that is used for rendering output.
*
* @return string
*/
public function render( $attrs, $content, $render_slug ) {
if ( function_exists( 'is_order_received_page' )
&& is_order_received_page() ) {
return '';
}
// The module will styled to remain hidden when the class is added.
if ( function_exists( 'wc_ship_to_billing_address_only' ) && wc_ship_to_billing_address_only() ) {
$this->add_classname( 'et_pb_wc_ship_to_billing_address_only' );
}
$output = self::get_checkout_shipping();
$fields_width = et_()->array_get( $this->props, 'fields_width', false );
if ( false !== $fields_width ) {
$this->add_classname( "et_pb_fields_layout_{$fields_width}" );
}
// Handle Required Field Indicator Color responsive and hover fields.
$required_field_indicator_color_values = et_pb_responsive_options()->get_property_values( $this->props, 'required_field_indicator_color' );
$required_field_indicator_color_hover = $this->get_hover_value( 'required_field_indicator_color' );
$required_field_indicator_selector = '%%order_class%% form .form-row .required';
et_pb_responsive_options()->generate_responsive_css(
$required_field_indicator_color_values,
$required_field_indicator_selector,
'color',
$render_slug,
' !important;',
'color'
);
// Placeholder Color.
$placeholder_selectors = array(
'%%order_class%% form .form-row input.input-text::placeholder',
'%%order_class%% form .form-row input.input-text::-webkit-input-placeholder',
'%%order_class%% form .form-row input.input-text::-moz-placeholder',
'%%order_class%% form .form-row input.input-text:-ms-input-placeholder',
);
$this->generate_styles(
array(
'base_attr_name' => 'placeholder_color',
'selector' => join( ', ', $placeholder_selectors ),
'hover_pseudo_selector_location' => 'suffix',
'sticky_pseudo_selector_location' => 'prefix',
'css_property' => 'color',
'important' => false,
'render_slug' => $render_slug,
'type' => 'color',
)
);
if ( et_builder_is_hover_enabled( 'required_field_indicator_color', $this->props ) ) {
ET_Builder_Element::set_style(
$render_slug,
array(
'selector' => '%%order_class%% form .form-row:hover .required',
'declaration' => sprintf(
'color: %1$s;',
esc_html( $required_field_indicator_color_hover )
),
)
);
}
$this->add_classname( $this->get_text_orientation_classname() );
if ( isset( WC()->cart )
&& ! is_null( WC()->cart && method_exists( WC()->cart, 'check_cart_items' ) )
&& ! is_et_pb_preview() ) {
$return = WC()->cart->check_cart_items();
if ( wc_notice_count( 'error' ) > 0 ) {
$this->add_classname( 'et_pb_hide_module' );
}
}
global $wp;
if ( ! empty( $wp->query_vars['order-pay'] ) ) {
$this->add_classname( 'et_pb_wc_order_pay' );
}
return $this->_render_module_wrapper( $output, $render_slug );
}
}
new ET_Builder_Module_Woocommerce_Checkout_Shipping();
@@ -0,0 +1,282 @@
<?php
/**
* WooCommerce Modules: ET_Builder_Module_Woocommerce_Cross_Sells class
*
* The ET_Builder_Module_Woocommerce_Cross_Sells Class is responsible for rendering the
* Cross sells using the WooCommerce template.
*
* @since 4.14.0
* @package Divi\Builder
*/
defined( 'ABSPATH' ) || exit;
/**
* Class representing WooCommerce Cart Upsells component.
*
* @since 4.14.0
*/
class ET_Builder_Module_Woocommerce_Cross_Sells extends ET_Builder_Module {
/**
* Initialize.
*/
public function init() {
$this->name = esc_html__( 'Woo Cross Sells', 'et_builder' );
$this->plural = esc_html__( 'Woo Cross Sells', 'et_builder' );
$this->slug = 'et_pb_wc_cross_sells';
$this->vb_support = 'on';
$this->folder_name = 'et_pb_woo_modules';
$this->main_css_element = '%%order_class%%.et_pb_wc_cross_sells';
$this->advanced_fields = array(
'fonts' => array(
'title' => array(
'label' => et_builder_i18n( 'Title' ),
'css' => array(
'main' => implode(
',',
[
"{$this->main_css_element} ul.products li.product h3",
"{$this->main_css_element} ul.products li.product h1",
"{$this->main_css_element} ul.products li.product h2",
"{$this->main_css_element} ul.products li.product h4",
"{$this->main_css_element} ul.products li.product h5",
"{$this->main_css_element} ul.products li.product h6",
]
),
'hover' => implode(
',',
[
"{$this->main_css_element} .woocommerce ul.products li.product h3:hover",
"{$this->main_css_element} .woocommerce ul.products li.product h1:hover",
"{$this->main_css_element} .woocommerce ul.products li.product h2:hover",
"{$this->main_css_element} .woocommerce ul.products li.product h4:hover",
"{$this->main_css_element} .woocommerce ul.products li.product h5:hover",
"{$this->main_css_element} .woocommerce ul.products li.product h6:hover",
]
),
'important' => 'plugin_only',
),
'font_size' => array(
'default' => '14px',
),
'line_height' => array(
'default' => '1em',
),
),
'price' => array(
'label' => esc_html__( 'Price', 'et_builder' ),
'css' => array(
'main' => implode(
',',
[
"{$this->main_css_element} ul.products li.product .price",
"{$this->main_css_element} ul.products li.product .price .amount",
]
),
),
'font_size' => array(
'default' => '14px',
),
'line_height' => array(
'range_settings' => array(
'min' => '1',
'max' => '100',
'step' => '1',
),
'default' => '26px',
),
),
),
);
$this->help_videos = array(
array(
'id' => esc_html( '7X03vBPYJ1o' ),
'name' => esc_html__( 'Divi WooCommerce Modules', 'et_builder' ),
),
);
}
/**
* {@inheritdoc}
*/
public function get_fields() {
$fields = array(
'__cross_sells' => array(
'type' => 'computed',
'computed_callback' => array(
'ET_Builder_Module_Woocommerce_Cross_Sells',
'get_cross_sells',
),
'computed_depends_on' => array(
/*
* `depends_on` arg is required. Otherwise AJAX will return null.
* @see et_pb_process_computed_property().
* `product` will not be processed since there is no definition in
* @see ET_Builder_Module_Woocommerce_Checkout_Order::get_fields()
*/
'product',
),
),
);
return $fields;
}
/**
* Swaps Cross-sells template.
*
* @param string $template Template.
* @param string $template_name Template name.
* @param array $args Arguments.
* @param string $template_path Template path.
* @param string $default_path Default path.
*
* @return string
*/
public static function swap_template( $template, $template_name, $args, $template_path, $default_path ) {
$is_template_override = in_array(
$template_name,
array(
'cart/cross-sells.php',
),
true
);
if ( $is_template_override ) {
return trailingslashit( ET_BUILDER_DIR ) . 'feature/woocommerce/templates/' . $template_name;
}
return $template;
}
/**
* Gets Cross sells markup.
*
* @param array $args Props.
* @param array $conditional_tags Conditional tags set during computed property AJAX call.
*
* @return string
*/
public static function get_cross_sells( $args = array(), $conditional_tags = array() ) {
if ( is_checkout() ) {
return;
}
if ( ! function_exists( 'woocommerce_cross_sell_display' ) ) {
return;
}
$is_tb = et_()->array_get( $conditional_tags, 'is_tb', false );
$output = '';
if ( ( $is_tb || et_fb_is_computed_callback_ajax() || is_et_pb_preview() ) ) {
$cross_sell_items = array(
1001 => array(
'name' => esc_html__( 'Product 4', 'et_builder' ),
'price' => '12.00',
),
1002 => array(
'name' => esc_html__( 'Product 5', 'et_builder' ),
'price' => '75.00',
),
1003 => array(
'name' => esc_html__( 'Product 6', 'et_builder' ),
'price' => '38.00',
),
);
$cross_sell_products = [];
foreach ( $cross_sell_items as $id => $details ) {
$product = new ET_Builder_Woocommerce_Product_Simple_Placeholder();
$product->set_name( $details['name'] );
$product->set_id( $id );
$product->set_price( $details['price'] );
$cross_sell_products[] = $product;
}
wc_set_loop_prop( 'name', 'cross-sells' );
wc_set_loop_prop( 'columns', apply_filters( 'woocommerce_cross_sells_columns', 2 ) );
$orderby = apply_filters( 'woocommerce_cross_sells_orderby', 'rand' );
$order = apply_filters( 'woocommerce_cross_sells_order', 'desc' );
$cross_sells = wc_products_array_orderby( $cross_sell_products, $orderby, $order );
$limit = apply_filters( 'woocommerce_cross_sells_total', 0 );
$cross_sells = $limit > 0 ? array_slice( $cross_sells, 0, $limit ) : $cross_sells;
// Runs only on Builder mode.
add_filter(
'wc_get_template',
[
'ET_Builder_Module_Woocommerce_Cross_Sells',
'swap_template',
],
10,
5
);
ob_start();
wc_get_template(
'cart/cross-sells.php',
array(
'cross_sells' => $cross_sells,
// Not used now, but used in previous version of up-sells.php.
'posts_per_page' => $limit,
'orderby' => $orderby,
'columns' => 2,
)
);
$output = ob_get_clean();
remove_filter(
'wc_get_template',
[
'ET_Builder_Module_Woocommerce_Cross_Sells',
'swap_template',
],
10,
5
);
} else {
if ( ! is_null( WC()->cart ) ) {
ob_start();
woocommerce_cross_sell_display( 0 );
$output = ob_get_clean();
}
}
return $output;
}
/**
* Renders the module output.
*
* @param array $attrs List of attributes.
* @param string $content Content being processed.
* @param string $render_slug Slug of module that is used for rendering output.
*
* @return string
*/
public function render( $attrs, $content, $render_slug ) {
// Module classnames.
$this->add_classname(
array(
$this->get_text_orientation_classname(),
)
);
$output = self::get_cross_sells();
return $this->_render_module_wrapper( $output, $render_slug );
}
}
new ET_Builder_Module_Woocommerce_Cross_Sells();

Some files were not shown because too many files have changed in this diff Show More