function _shortcode_callback($atts, $content = null, $function_name) { $this->shortcode_atts = shortcode_atts($this->get_shortcode_fields(), $atts); $this->_decode_double_quotes(); $this->_maybe_remove_default_atts_values(); $global_shortcode_content = false; // If the section/row/module is disabled, hide it if (isset($this->shortcode_atts['disabled']) && 'on' === $this->shortcode_atts['disabled']) { return; } //override module attributes for global module if (!empty($this->shortcode_atts['global_module'])) { $global_content = et_pb_load_global_module($this->shortcode_atts['global_module']); if ('' !== $global_content) { $global_atts = shortcode_parse_atts($global_content); foreach ($this->shortcode_atts as $single_attr => $value) { if (isset($global_atts[$single_attr])) { $this->shortcode_atts[$single_attr] = $global_atts[$single_attr]; } } if (false !== strpos($this->shortcode_atts['saved_tabs'], 'general') || 'all' === $this->shortcode_atts['saved_tabs']) { $global_shortcode_content = et_pb_extract_shortcode_content($global_content, $function_name); } } } self::set_order_class($function_name); $this->pre_shortcode_content(); $content = false !== $global_shortcode_content ? $global_shortcode_content : $content; $this->shortcode_content = !(isset($this->is_structure_element) && $this->is_structure_element) ? do_shortcode(et_pb_fix_shortcodes($content, $this->decode_entities)) : ''; $this->shortcode_atts(); $output = $this->shortcode_callback($atts, $content, $function_name); $this->_shortcode_callback_num++; $this->process_additional_options($function_name); $this->process_custom_css_options($function_name); if (empty($this->template_name)) { return $output; } return $this->shortcode_output(); }
function shortcode_callback($atts, $content = null, $function_name) { $module_id = $this->shortcode_atts['module_id']; $module_class = $this->shortcode_atts['module_class']; $background_color_1 = $this->shortcode_atts['background_color_1']; $background_color_2 = $this->shortcode_atts['background_color_2']; $background_color_3 = $this->shortcode_atts['background_color_3']; $bg_img_1 = $this->shortcode_atts['bg_img_1']; $bg_img_2 = $this->shortcode_atts['bg_img_2']; $bg_img_3 = $this->shortcode_atts['bg_img_3']; $padding_top_1 = $this->shortcode_atts['padding_top_1']; $padding_right_1 = $this->shortcode_atts['padding_right_1']; $padding_bottom_1 = $this->shortcode_atts['padding_bottom_1']; $padding_left_1 = $this->shortcode_atts['padding_left_1']; $padding_top_2 = $this->shortcode_atts['padding_top_2']; $padding_right_2 = $this->shortcode_atts['padding_right_2']; $padding_bottom_2 = $this->shortcode_atts['padding_bottom_2']; $padding_left_2 = $this->shortcode_atts['padding_left_2']; $padding_top_3 = $this->shortcode_atts['padding_top_3']; $padding_right_3 = $this->shortcode_atts['padding_right_3']; $padding_bottom_3 = $this->shortcode_atts['padding_bottom_3']; $padding_left_3 = $this->shortcode_atts['padding_left_3']; $padding_1_tablet = $this->shortcode_atts['padding_1_tablet']; $padding_2_tablet = $this->shortcode_atts['padding_2_tablet']; $padding_3_tablet = $this->shortcode_atts['padding_3_tablet']; $padding_1_phone = $this->shortcode_atts['padding_1_phone']; $padding_2_phone = $this->shortcode_atts['padding_2_phone']; $padding_3_phone = $this->shortcode_atts['padding_3_phone']; $gutter_width = $this->shortcode_atts['gutter_width']; $make_equal = $this->shortcode_atts['make_equal']; $custom_padding = $this->shortcode_atts['custom_padding']; $custom_padding_tablet = $this->shortcode_atts['custom_padding_tablet']; $custom_padding_phone = $this->shortcode_atts['custom_padding_phone']; $padding_mobile = $this->shortcode_atts['padding_mobile']; $column_padding_mobile = $this->shortcode_atts['column_padding_mobile']; $global_module = $this->shortcode_atts['global_module']; $use_custom_gutter = $this->shortcode_atts['use_custom_gutter']; $parallax_1 = $this->shortcode_atts['parallax_1']; $parallax_method_1 = $this->shortcode_atts['parallax_method_1']; $parallax_2 = $this->shortcode_atts['parallax_2']; $parallax_method_2 = $this->shortcode_atts['parallax_method_2']; $parallax_3 = $this->shortcode_atts['parallax_3']; $parallax_method_3 = $this->shortcode_atts['parallax_method_3']; $module_id_1 = $this->shortcode_atts['module_id_1']; $module_id_2 = $this->shortcode_atts['module_id_2']; $module_id_3 = $this->shortcode_atts['module_id_3']; $module_class_1 = $this->shortcode_atts['module_class_1']; $module_class_2 = $this->shortcode_atts['module_class_2']; $module_class_3 = $this->shortcode_atts['module_class_3']; $custom_css_before_1 = $this->shortcode_atts['custom_css_before_1']; $custom_css_before_2 = $this->shortcode_atts['custom_css_before_2']; $custom_css_before_3 = $this->shortcode_atts['custom_css_before_3']; $custom_css_main_1 = $this->shortcode_atts['custom_css_main_1']; $custom_css_main_2 = $this->shortcode_atts['custom_css_main_2']; $custom_css_main_3 = $this->shortcode_atts['custom_css_main_3']; $custom_css_after_1 = $this->shortcode_atts['custom_css_after_1']; $custom_css_after_2 = $this->shortcode_atts['custom_css_after_2']; $custom_css_after_3 = $this->shortcode_atts['custom_css_after_3']; global $et_pb_column_inner_backgrounds, $et_pb_column_inner_paddings, $et_pb_columns_inner_counter, $keep_column_padding_mobile, $et_pb_column_parallax, $et_pb_column_inner_css, $et_pb_column_inner_paddings_mobile; $keep_column_padding_mobile = $column_padding_mobile; if ('' !== $global_module) { $global_content = et_pb_load_global_module($global_module, $function_name); if ('' !== $global_content) { return do_shortcode($global_content); } } $padding_mobile_values = array('tablet' => explode('|', $custom_padding_tablet), 'phone' => explode('|', $custom_padding_phone)); $et_pb_columns_inner_counter = 0; $et_pb_column_inner_backgrounds = array(array($background_color_1, $bg_img_1), array($background_color_2, $bg_img_2), array($background_color_3, $bg_img_3)); $et_pb_column_inner_paddings = array(array('padding-top' => $padding_top_1, 'padding-right' => $padding_right_1, 'padding-bottom' => $padding_bottom_1, 'padding-left' => $padding_left_1), array('padding-top' => $padding_top_2, 'padding-right' => $padding_right_2, 'padding-bottom' => $padding_bottom_2, 'padding-left' => $padding_left_2), array('padding-top' => $padding_top_3, 'padding-right' => $padding_right_3, 'padding-bottom' => $padding_bottom_3, 'padding-left' => $padding_left_3)); $et_pb_column_parallax = array(array($parallax_1, $parallax_method_1), array($parallax_2, $parallax_method_2), array($parallax_3, $parallax_method_3)); $et_pb_column_inner_paddings_mobile = array(array('tablet' => explode('|', $padding_1_tablet), 'phone' => explode('|', $padding_1_phone)), array('tablet' => explode('|', $padding_2_tablet), 'phone' => explode('|', $padding_2_phone)), array('tablet' => explode('|', $padding_3_tablet), 'phone' => explode('|', $padding_3_phone))); $padding_values = explode('|', $custom_padding); if (!empty($padding_values)) { // old version of Rows support only top and bottom padding, so we need to handle it along with the full padding in the recent version if (2 === count($padding_values)) { $padding_settings = array('top' => isset($padding_values[0]) ? $padding_values[0] : '', 'bottom' => isset($padding_values[1]) ? $padding_values[1] : ''); } else { $padding_settings = array('top' => isset($padding_values[0]) ? $padding_values[0] : '', 'right' => isset($padding_values[1]) ? $padding_values[1] : '', 'bottom' => isset($padding_values[2]) ? $padding_values[2] : '', 'left' => isset($padding_values[3]) ? $padding_values[3] : ''); } foreach ($padding_settings as $padding_side => $value) { if ('' !== $value) { $element_style = array('selector' => '.et_pb_column %%order_class%%', 'declaration' => sprintf('padding-%1$s: %2$s;', esc_html($padding_side), esc_html($value))); if ('on' !== $padding_mobile) { $element_style['media_query'] = ET_Builder_Element::get_media_query('min_width_981'); } ET_Builder_Element::set_style($function_name, $element_style); } } } if (!empty($padding_mobile_values['tablet']) || !empty($padding_values['phone'])) { $padding_mobile_values_processed = array(); foreach (array('tablet', 'phone') as $device) { if (empty($padding_mobile_values[$device])) { continue; } $padding_mobile_values_processed[$device] = array('padding-top' => isset($padding_mobile_values[$device][0]) ? $padding_mobile_values[$device][0] : '', 'padding-right' => isset($padding_mobile_values[$device][1]) ? $padding_mobile_values[$device][1] : '', 'padding-bottom' => isset($padding_mobile_values[$device][2]) ? $padding_mobile_values[$device][2] : '', 'padding-left' => isset($padding_mobile_values[$device][3]) ? $padding_mobile_values[$device][3] : ''); } if (!empty($padding_mobile_values_processed)) { et_pb_generate_responsive_css($padding_mobile_values_processed, '.et_pb_column %%order_class%%', '', $function_name, ' !important; '); } } $et_pb_column_inner_css = array('css_class' => array($module_class_1, $module_class_2, $module_class_3), 'css_id' => array($module_id_1, $module_id_2, $module_id_3), 'custom_css_before' => array($custom_css_before_1, $custom_css_before_2, $custom_css_before_3), 'custom_css_main' => array($custom_css_main_1, $custom_css_main_2, $custom_css_main_3), 'custom_css_after' => array($custom_css_after_1, $custom_css_after_2, $custom_css_after_3)); $module_class .= ' et_pb_row_inner'; $module_class = ET_Builder_Element::add_module_order_class($module_class, $function_name); $inner_content = do_shortcode(et_pb_fix_shortcodes($content)); $module_class .= '' == trim($inner_content) ? ' et_pb_row_empty' : ''; $module_class .= 'on' === $make_equal ? ' et_pb_equal_columns' : ''; if ('on' === $use_custom_gutter && '' !== $gutter_width) { $gutter_width = '0' === $gutter_width ? '1' : $gutter_width; // set the gutter to 1 if 0 entered by user $module_class .= ' et_pb_gutters' . $gutter_width; } $output = sprintf('<div%4$s class="%2$s"> %1$s </div> <!-- .%3$s -->', $inner_content, esc_attr($module_class), esc_html($function_name), '' !== $module_id ? sprintf(' id="%1$s"', esc_attr($module_id)) : ''); return $output; }
function shortcode_callback($atts, $content = null, $function_name) { $module_id = $this->shortcode_atts['module_id']; $module_class = $this->shortcode_atts['module_class']; $background_color_1 = $this->shortcode_atts['background_color_1']; $background_color_2 = $this->shortcode_atts['background_color_2']; $background_color_3 = $this->shortcode_atts['background_color_3']; $bg_img_1 = $this->shortcode_atts['bg_img_1']; $bg_img_2 = $this->shortcode_atts['bg_img_2']; $bg_img_3 = $this->shortcode_atts['bg_img_3']; $padding_top_1 = $this->shortcode_atts['padding_top_1']; $padding_right_1 = $this->shortcode_atts['padding_right_1']; $padding_bottom_1 = $this->shortcode_atts['padding_bottom_1']; $padding_left_1 = $this->shortcode_atts['padding_left_1']; $padding_top_2 = $this->shortcode_atts['padding_top_2']; $padding_right_2 = $this->shortcode_atts['padding_right_2']; $padding_bottom_2 = $this->shortcode_atts['padding_bottom_2']; $padding_left_2 = $this->shortcode_atts['padding_left_2']; $padding_top_3 = $this->shortcode_atts['padding_top_3']; $padding_right_3 = $this->shortcode_atts['padding_right_3']; $padding_bottom_3 = $this->shortcode_atts['padding_bottom_3']; $padding_left_3 = $this->shortcode_atts['padding_left_3']; $gutter_width = $this->shortcode_atts['gutter_width']; $make_equal = $this->shortcode_atts['make_equal']; $custom_padding = $this->shortcode_atts['custom_padding']; $padding_mobile = $this->shortcode_atts['padding_mobile']; $global_module = $this->shortcode_atts['global_module']; $use_custom_gutter = $this->shortcode_atts['use_custom_gutter']; global $et_pb_column_inner_backgrounds, $et_pb_column_inner_paddings, $et_pb_columns_inner_counter; if ('' !== $global_module) { $global_content = et_pb_load_global_module($global_module, $function_name); if ('' !== $global_content) { return do_shortcode($global_content); } } $et_pb_columns_inner_counter = 0; $et_pb_column_inner_backgrounds = array(array($background_color_1, $bg_img_1), array($background_color_2, $bg_img_2), array($background_color_3, $bg_img_3)); $et_pb_column_inner_paddings = array(array('padding-top' => $padding_top_1, 'padding-right' => $padding_right_1, 'padding-bottom' => $padding_bottom_1, 'padding-left' => $padding_left_1), array('padding-top' => $padding_top_2, 'padding-right' => $padding_right_2, 'padding-bottom' => $padding_bottom_2, 'padding-left' => $padding_left_2), array('padding-top' => $padding_top_3, 'padding-right' => $padding_right_3, 'padding-bottom' => $padding_bottom_3, 'padding-left' => $padding_left_3)); $padding_values = explode('|', $custom_padding); if (!empty($padding_values)) { $padding_settings = array('top' => isset($padding_values[0]) ? $padding_values[0] : '', 'bottom' => isset($padding_values[1]) ? $padding_values[1] : ''); foreach ($padding_settings as $padding_side => $value) { if ('' !== $value) { ET_Builder_Element::set_style($function_name, array('selector' => '.et_pb_column %%order_class%%', 'declaration' => sprintf('padding-%1$s:%2$s%3$s;', esc_html($padding_side), esc_html($value), 'on' === $padding_mobile ? '!important' : ''))); } } } $module_class .= ' et_pb_row_inner'; $module_class = ET_Builder_Element::add_module_order_class($module_class, $function_name); $inner_content = do_shortcode(et_pb_fix_shortcodes($content)); $module_class .= '' == trim($inner_content) ? ' et_pb_row_empty' : ''; $module_class .= 'on' === $make_equal ? ' et_pb_equal_columns' : ''; $module_class .= 'on' === $use_custom_gutter ? ' et_pb_gutters' . $gutter_width : ''; $output = sprintf('<div%4$s class="%2$s"> %1$s </div> <!-- .%3$s -->', $inner_content, esc_attr($module_class), esc_html($function_name), '' !== $module_id ? sprintf(' id="%1$s"', esc_attr($module_id)) : ''); return $output; }
function _shortcode_passthru_callback($atts, $content = null, $function_name, $parent_address = '', $global_parent = '', $global_parent_type = '') { global $post; $attrs = array(); $fields = $this->process_fields($this->fields_unprocessed); $global_shortcode_content = false; $function_name_processed = et_fb_prepare_tag($function_name); //override module attributes for global module if (!empty($atts['global_module'])) { $global_content = et_pb_load_global_module($atts['global_module']); if ('' !== $global_content) { if (!isset($atts['saved_tabs']) || false !== strpos($atts['saved_tabs'], 'general') || 'all' === $atts['saved_tabs']) { $global_shortcode_content = et_pb_extract_shortcode_content($global_content, $function_name_processed); } // remove the shortcode content to avoid conflicts of parent attributes with similar attrs from child modules if (false !== $global_shortcode_content) { $global_content_processed = str_replace($global_shortcode_content, '', $global_content); } else { $global_content_processed = $global_content; } $global_atts = shortcode_parse_atts($global_content_processed); foreach ($this->shortcode_atts as $single_attr => $value) { if (isset($global_atts[$single_attr])) { $this->shortcode_atts[$single_attr] = $global_atts[$single_attr]; } } } else { // remove global_module attr if it doesn't exist in DB $this->shortcode_atts['global_module'] = ''; $global_parent = ''; } } // TODO, cleanup this loop. foreach ($this->shortcode_atts as $shortcode_attr_key => $shortcode_attr_value) { if (isset($fields[$shortcode_attr_key]['type']) && 'computed' === $fields[$shortcode_attr_key]['type']) { $field = $fields[$shortcode_attr_key]; $depends_on = array(); foreach ($field['computed_depends_on'] as $depends_on_field) { $depends_on[$depends_on_field] = $this->shortcode_atts[$depends_on_field]; } if (!is_callable($field['computed_callback'])) { die($shortcode_attr_key . ' Callback:' . $field['computed_callback'] . ' is not callable.... '); // TODO, fix this make it more graceful... } $value = call_user_func($field['computed_callback'], $depends_on); } else { $value = $shortcode_attr_value; } $attrs[$shortcode_attr_key] = is_string($value) ? html_entity_decode($value) : $value; } // Format FB component path // TODO, move this to class method and property, and allow both to be overridden $component_path = str_replace('et_pb_', '', $function_name_processed); $component_path = str_replace('_', '-', $component_path); $component_path = $component_path; // Prepare modules. $modules = 'child' === $this->type ? self::$child_modules : self::$parent_modules; if (isset($post->post_type, $modules[$post->post_type][$function_name_processed])) { $modules = $modules[$post->post_type][$function_name_processed]; } else { $modules = array(); } // Build custom CSS. $custom_css = array(); if (isset($modules->custom_css_options)) { foreach ($modules->custom_css_options as $custom_css_key => $custom_css_option) { $custom_css_option['key'] = "custom_css_{$custom_css_key}"; $custom_css[] = $custom_css_option; } } // Build advanced options and defaults. $advanced_options = array(); $advanced_defaults = array(); if (!empty($modules->advanced_options)) { $advanced_options = $modules->advanced_options; } if (isset($modules->fields_unprocessed)) { foreach ($modules->fields_unprocessed as $fields_unprocessed_key => $field_unprocessed) { if (isset($field_unprocessed['default'], $field_unprocessed['tab_slug']) && 'advanced' === $field_unprocessed['tab_slug']) { $advanced_defaults[$fields_unprocessed_key] = $field_unprocessed['default']; } } } $_i = isset($atts['_i']) ? $atts['_i'] : 0; $address = isset($atts['_address']) ? $atts['_address'] : '0'; // set the global parent if exists if ((!isset($attrs['global_module']) || '' === $attrs['global_module']) && '' !== $global_parent) { $attrs['global_parent'] = $global_parent; } if (isset($this->is_structure_element) && $this->is_structure_element) { $this->fb_support = true; } if (!$this->fb_support) { global $et_fb_processing_shortcode_object; $et_fb_processing_shortcode_object = false; $raw_child_content = $content; $content = $this->_shortcode_callback($atts, $content, $function_name_processed); $executed_shortcode = do_shortcode($content); $processed_content = false !== $global_shortcode_content ? $global_shortcode_content : $this->shortcode_content; $attrs['content_new'] = array_key_exists('content_new', $this->whitelisted_fields) ? $processed_content : et_fb_process_shortcode($processed_content, $address, $global_parent, $global_parent_type); $et_fb_processing_shortcode_object = true; } else { $processed_content = false !== $global_shortcode_content ? $global_shortcode_content : $this->shortcode_content; $content = array_key_exists('content_new', $this->whitelisted_fields) || 'et_pb_code' === $function_name_processed || 'et_pb_fullwidth_code' === $function_name_processed ? $processed_content : et_fb_process_shortcode($processed_content, $address, $global_parent, $global_parent_type); } if (is_array($content)) { $prepared_content = $content; } else { if ($this->fb_support && count(preg_split('/\\r\\n*\\n/', trim($content), -1, PREG_SPLIT_NO_EMPTY)) > 1) { $prepared_content = wpautop($content); } else { $prepared_content = html_entity_decode($content); } } // Build object. $object = array('_i' => $_i, '_order' => $_i, 'address' => $address, 'child_slug' => $this->child_slug, 'fb_support' => $this->fb_support, 'parent_address' => $parent_address, 'shortcode_index' => $this->_shortcode_callback_num, 'type' => $function_name, 'component_path' => $component_path, 'attrs' => $attrs, 'advanced_options' => $advanced_options, 'advanced_defaults' => $advanced_defaults, 'defaults' => isset($this->defaults) ? $this->defaults : '', 'fields_defaults' => isset($this->fields_defaults) ? $this->fields_defaults : '', 'custom_css' => $custom_css, 'content' => $prepared_content, 'is_module_child' => 'child' === $this->type, 'prepared_styles' => !$this->fb_support ? ET_Builder_Element::get_style() : ''); if (!$this->fb_support) { if (!empty($this->child_slug)) { $object['raw_child_content'] = $raw_child_content; } } return $object; }
function _shortcode_callback($atts, $content = null, $function_name) { $this->shortcode_atts = shortcode_atts($this->get_shortcode_fields(), $atts); $this->_decode_double_quotes(); $this->_maybe_remove_default_atts_values(); $global_shortcode_content = false; // If the section/row/module is disabled, hide it if (isset($this->shortcode_atts['disabled']) && 'on' === $this->shortcode_atts['disabled']) { return; } //override module attributes for global module if (!empty($this->shortcode_atts['global_module'])) { $global_content = et_pb_load_global_module($this->shortcode_atts['global_module']); if ('' !== $global_content) { $global_atts = shortcode_parse_atts($global_content); foreach ($this->shortcode_atts as $single_attr => $value) { if (isset($global_atts[$single_attr])) { $this->shortcode_atts[$single_attr] = $global_atts[$single_attr]; } } if (false !== strpos($this->shortcode_atts['saved_tabs'], 'general') || 'all' === $this->shortcode_atts['saved_tabs']) { $global_shortcode_content = et_pb_extract_shortcode_content($global_content, $function_name); } } } self::set_order_class($function_name); $this->pre_shortcode_content(); $content = false !== $global_shortcode_content ? $global_shortcode_content : $content; $this->shortcode_content = !(isset($this->is_structure_element) && $this->is_structure_element) ? do_shortcode(et_pb_fix_shortcodes($content, $this->decode_entities)) : ''; $this->shortcode_atts(); $output = $this->shortcode_callback($atts, $content, $function_name); $this->_shortcode_callback_num++; $this->process_additional_options($function_name); $this->process_custom_css_options($function_name); // Hide module on specific screens if needed if (isset($this->shortcode_atts['disabled_on']) && '' !== $this->shortcode_atts['disabled_on']) { $disabled_on_array = explode('|', $this->shortcode_atts['disabled_on']); $i = 0; $current_media_query = 'max_width_767'; foreach ($disabled_on_array as $value) { if ('on' === $value) { ET_Builder_Module::set_style($function_name, array('selector' => '%%order_class%%', 'declaration' => 'display: none !important;', 'media_query' => ET_Builder_Element::get_media_query($current_media_query))); } $i++; $current_media_query = 1 === $i ? '768_980' : 'min_width_981'; } } if (empty($this->template_name)) { return $output; } return $this->shortcode_output(); }
function _shortcode_callback($atts, $content = null, $function_name) { $this->shortcode_atts = shortcode_atts($this->get_shortcode_fields(), $atts); $this->_decode_double_quotes(); $this->_maybe_remove_default_atts_values(); $global_shortcode_content = false; $ab_testing_enabled = et_is_ab_testing_active(); $hide_subject_module = false; $post_id = apply_filters('et_is_ab_testing_active_post_id', get_the_ID()); // If the section/row/module is disabled, hide it if (isset($this->shortcode_atts['disabled']) && 'on' === $this->shortcode_atts['disabled']) { return; } // need to perform additional check and some modifications in case AB testing enabled if ($ab_testing_enabled) { // check if ab testing enabled for this module and if it shouldn't be displayed currently if (!$this->_is_display_module($this->shortcode_atts) && !et_pb_detect_cache_plugins()) { return; } // add class to the AB testing subject if needed if (isset($this->shortcode_atts['ab_subject_id']) && '' !== $this->shortcode_atts['ab_subject_id']) { $subject_class = sprintf(' et_pb_ab_subject et_pb_ab_subject_id-%1$s_%2$s', esc_attr($post_id), esc_attr($this->shortcode_atts['ab_subject_id'])); $this->shortcode_atts['module_class'] = isset($this->shortcode_atts['module_class']) && '' !== $this->shortcode_atts['module_class'] ? $this->shortcode_atts['module_class'] . $subject_class : $subject_class; if (et_pb_detect_cache_plugins()) { $hide_subject_module = true; } } // add class to the AB testing goal if needed if (isset($this->shortcode_atts['ab_goal']) && 'on' === $this->shortcode_atts['ab_goal']) { $goal_class = sprintf(' et_pb_ab_goal et_pb_ab_goal_id-%1$s', esc_attr($post_id)); $this->shortcode_atts['module_class'] = isset($this->shortcode_atts['module_class']) && '' !== $this->shortcode_atts['module_class'] ? $this->shortcode_atts['module_class'] . $goal_class : $goal_class; } } //override module attributes for global module if (!empty($this->shortcode_atts['global_module'])) { $global_content = et_pb_load_global_module($this->shortcode_atts['global_module']); if ('' !== $global_content) { $global_atts = shortcode_parse_atts($global_content); foreach ($this->shortcode_atts as $single_attr => $value) { if (isset($global_atts[$single_attr])) { $this->shortcode_atts[$single_attr] = $global_atts[$single_attr]; } } if (false !== strpos($this->shortcode_atts['saved_tabs'], 'general') || 'all' === $this->shortcode_atts['saved_tabs']) { $global_shortcode_content = et_pb_extract_shortcode_content($global_content, $function_name); } } } self::set_order_class($function_name); $this->pre_shortcode_content(); $content = false !== $global_shortcode_content ? $global_shortcode_content : $content; $this->shortcode_content = !(isset($this->is_structure_element) && $this->is_structure_element) ? do_shortcode(et_pb_fix_shortcodes($content, $this->decode_entities)) : ''; $this->shortcode_atts(); $this->process_additional_options($function_name); $this->process_custom_css_options($function_name); $output = $this->shortcode_callback($atts, $content, $function_name); $this->_shortcode_callback_num++; // Hide module on specific screens if needed if (isset($this->shortcode_atts['disabled_on']) && '' !== $this->shortcode_atts['disabled_on']) { $disabled_on_array = explode('|', $this->shortcode_atts['disabled_on']); $i = 0; $current_media_query = 'max_width_767'; foreach ($disabled_on_array as $value) { if ('on' === $value) { ET_Builder_Module::set_style($function_name, array('selector' => '%%order_class%%', 'declaration' => 'display: none !important;', 'media_query' => ET_Builder_Element::get_media_query($current_media_query))); } $i++; $current_media_query = 1 === $i ? '768_980' : 'min_width_981'; } } if ($hide_subject_module) { $previous_subjects_cache = get_post_meta($post_id, 'et_pb_subjects_cache', true); if (empty($previous_subjects_cache)) { $previous_subjects_cache = array(); } if (empty($this->template_name)) { $previous_subjects_cache[$this->shortcode_atts['ab_subject_id']] = $output; } else { $previous_subjects_cache[$this->shortcode_atts['ab_subject_id']] = $this->shortcode_output(); } // update the subjects cache in post meta to use it later update_post_meta($post_id, 'et_pb_subjects_cache', $previous_subjects_cache); // generate the placeholder to output on front-end instead of actual content $subject_placeholder = sprintf('<div class="et_pb_subject_placeholder et_pb_subject_placeholder_id_%1$s" style="display: none;"></div>', esc_attr($this->shortcode_atts['ab_subject_id'])); return $subject_placeholder; } if (empty($this->template_name)) { return $output; } return $this->shortcode_output(); }
function shortcode_callback($atts, $content = null, $function_name) { $module_id = $this->shortcode_atts['module_id']; $module_class = $this->shortcode_atts['module_class']; $background_color_1 = $this->shortcode_atts['background_color_1']; $background_color_2 = $this->shortcode_atts['background_color_2']; $background_color_3 = $this->shortcode_atts['background_color_3']; $bg_img_1 = $this->shortcode_atts['bg_img_1']; $bg_img_2 = $this->shortcode_atts['bg_img_2']; $bg_img_3 = $this->shortcode_atts['bg_img_3']; $padding_top_1 = $this->shortcode_atts['padding_top_1']; $padding_right_1 = $this->shortcode_atts['padding_right_1']; $padding_bottom_1 = $this->shortcode_atts['padding_bottom_1']; $padding_left_1 = $this->shortcode_atts['padding_left_1']; $padding_top_2 = $this->shortcode_atts['padding_top_2']; $padding_right_2 = $this->shortcode_atts['padding_right_2']; $padding_bottom_2 = $this->shortcode_atts['padding_bottom_2']; $padding_left_2 = $this->shortcode_atts['padding_left_2']; $padding_top_3 = $this->shortcode_atts['padding_top_3']; $padding_right_3 = $this->shortcode_atts['padding_right_3']; $padding_bottom_3 = $this->shortcode_atts['padding_bottom_3']; $padding_left_3 = $this->shortcode_atts['padding_left_3']; $gutter_width = $this->shortcode_atts['gutter_width']; $make_equal = $this->shortcode_atts['make_equal']; $custom_padding = $this->shortcode_atts['custom_padding']; $custom_margin = $this->shortcode_atts['custom_margin']; $padding_mobile = $this->shortcode_atts['padding_mobile']; $column_padding_mobile = $this->shortcode_atts['column_padding_mobile']; $global_module = $this->shortcode_atts['global_module']; $use_custom_gutter = $this->shortcode_atts['use_custom_gutter']; $parallax_1 = $this->shortcode_atts['parallax_1']; $parallax_method_1 = $this->shortcode_atts['parallax_method_1']; $parallax_2 = $this->shortcode_atts['parallax_2']; $parallax_method_2 = $this->shortcode_atts['parallax_method_2']; $parallax_3 = $this->shortcode_atts['parallax_3']; $parallax_method_3 = $this->shortcode_atts['parallax_method_3']; global $et_pb_column_inner_backgrounds, $et_pb_column_inner_paddings, $et_pb_columns_inner_counter, $keep_column_padding_mobile, $et_pb_column_parallax; $keep_column_padding_mobile = $column_padding_mobile; if ('' !== $global_module) { $global_content = et_pb_load_global_module($global_module, $function_name); if ('' !== $global_content) { return do_shortcode($global_content); } } $et_pb_columns_inner_counter = 0; $et_pb_column_inner_backgrounds = array(array($background_color_1, $bg_img_1), array($background_color_2, $bg_img_2), array($background_color_3, $bg_img_3)); $et_pb_column_inner_paddings = array(array('padding-top' => $padding_top_1, 'padding-right' => $padding_right_1, 'padding-bottom' => $padding_bottom_1, 'padding-left' => $padding_left_1), array('padding-top' => $padding_top_2, 'padding-right' => $padding_right_2, 'padding-bottom' => $padding_bottom_2, 'padding-left' => $padding_left_2), array('padding-top' => $padding_top_3, 'padding-right' => $padding_right_3, 'padding-bottom' => $padding_bottom_3, 'padding-left' => $padding_left_3)); $et_pb_column_parallax = array(array($parallax_1, $parallax_method_1), array($parallax_2, $parallax_method_2), array($parallax_3, $parallax_method_3)); $padding_values = explode('|', $custom_padding); $margin_values = explode('|', $custom_margin); if (!empty($padding_values)) { // old version of Rows support only top and bottom padding, so we need to handle it along with the full padding in the recent version if (2 === count($padding_values)) { $padding_settings = array('top' => isset($padding_values[0]) ? $padding_values[0] : '', 'bottom' => isset($padding_values[1]) ? $padding_values[1] : ''); } else { $padding_settings = array('top' => isset($padding_values[0]) ? $padding_values[0] : '', 'right' => isset($padding_values[1]) ? $padding_values[1] : '', 'bottom' => isset($padding_values[2]) ? $padding_values[2] : '', 'left' => isset($padding_values[3]) ? $padding_values[3] : ''); } foreach ($padding_settings as $padding_side => $value) { if ('' !== $value) { ET_Builder_Element::set_style($function_name, array('selector' => '.et_pb_column %%order_class%%', 'declaration' => sprintf('padding-%1$s:%2$s%3$s;', esc_html($padding_side), esc_html($value), 'on' === $padding_mobile ? '!important' : ''))); } } } if (!empty($margin_values)) { $margin_settings = array('top' => isset($margin_values[0]) ? $margin_values[0] : '', 'right' => isset($margin_values[1]) ? $margin_values[1] : '', 'bottom' => isset($margin_values[2]) ? $margin_values[2] : '', 'left' => isset($margin_values[3]) ? $margin_values[3] : ''); foreach ($margin_settings as $margin_side => $value) { if ('' !== $value) { $element_style = array('selector' => '%%order_class%%', 'declaration' => sprintf('margin-%1$s: %2$s;', esc_html($margin_side), esc_html($value))); ET_Builder_Element::set_style($function_name, $element_style); } } } $module_class .= ' et_pb_row_inner'; $module_class = ET_Builder_Element::add_module_order_class($module_class, $function_name); $inner_content = do_shortcode(et_pb_fix_shortcodes($content)); $module_class .= '' == trim($inner_content) ? ' et_pb_row_empty' : ''; $module_class .= 'on' === $make_equal ? ' et_pb_equal_columns' : ''; if ('on' === $use_custom_gutter) { $gutter_width = '0' === $gutter_width ? '1' : $gutter_width; // set the gutter to 1 if 0 entered by user $module_class .= ' et_pb_gutters' . $gutter_width; } $output = sprintf('<div%4$s class="%2$s"> %1$s </div> <!-- .%3$s -->', $inner_content, esc_attr($module_class), esc_html($function_name), '' !== $module_id ? sprintf(' id="%1$s"', esc_attr($module_id)) : ''); return $output; }