function shortcode_callback($atts, $content = null, $function_name) { $module_id = $this->shortcode_atts['module_id']; $module_class = $this->shortcode_atts['module_class']; $title = $this->shortcode_atts['title']; $subhead = $this->shortcode_atts['subhead']; $background_layout = $this->shortcode_atts['background_layout']; $text_orientation = $this->shortcode_atts['text_orientation']; $title_font = $this->shortcode_atts['title_font']; $title_font_color = $this->shortcode_atts['title_font_color']; $title_font_size = $this->shortcode_atts['title_font_size']; $subhead_font = $this->shortcode_atts['subhead_font']; $subhead_font_color = $this->shortcode_atts['subhead_font_color']; $subhead_font_size = $this->shortcode_atts['subhead_font_size']; $content_font = $this->shortcode_atts['content_font']; $content_font_color = $this->shortcode_atts['content_font_color']; $content_font_size = $this->shortcode_atts['content_font_size']; $button_one_text = $this->shortcode_atts['button_one_text']; $button_one_url = $this->shortcode_atts['button_one_url']; $button_two_text = $this->shortcode_atts['button_two_text']; $button_two_url = $this->shortcode_atts['button_two_url']; $header_fullscreen = $this->shortcode_atts['header_fullscreen']; $header_scroll_down = $this->shortcode_atts['header_scroll_down']; $scroll_down_icon = $this->shortcode_atts['scroll_down_icon']; $scroll_down_icon_color = $this->shortcode_atts['scroll_down_icon_color']; $scroll_down_icon_size = $this->shortcode_atts['scroll_down_icon_size']; $background_url = $this->shortcode_atts['background_url']; $background_color = $this->shortcode_atts['background_color']; $background_overlay_color = $this->shortcode_atts['background_overlay_color']; $parallax = $this->shortcode_atts['parallax']; $parallax_method = $this->shortcode_atts['parallax_method']; $logo_image_url = $this->shortcode_atts['logo_image_url']; $header_image_url = $this->shortcode_atts['header_image_url']; $content_orientation = $this->shortcode_atts['content_orientation']; $image_orientation = $this->shortcode_atts['image_orientation']; $custom_icon_1 = $this->shortcode_atts['button_one_icon']; $button_custom_1 = $this->shortcode_atts['custom_button_one']; $custom_icon_2 = $this->shortcode_atts['button_two_icon']; $button_custom_2 = $this->shortcode_atts['custom_button_two']; $max_width = $this->shortcode_atts['max_width']; $logo_title = $this->shortcode_atts['logo_title']; $logo_alt_text = $this->shortcode_atts['logo_alt_text']; if (is_rtl() && 'left' === $text_orientation) { $text_orientation = 'right'; } $module_class = ET_Builder_Element::add_module_order_class($module_class, $function_name); if ('' !== $max_width) { ET_Builder_Element::set_style($function_name, array('selector' => '%%order_class%% .header-content', 'declaration' => sprintf('max-width: %1$s !important;', esc_html(et_builder_process_range_value($max_width))))); } if ('' !== $title_font) { ET_Builder_Element::set_style($function_name, array('selector' => '%%order_class%%.et_pb_fullwidth_header .header-content h1', 'declaration' => sprintf('%1$s', et_builder_set_element_font($title_font)))); } if ('' !== $title_font_color) { ET_Builder_Element::set_style($function_name, array('selector' => '%%order_class%%.et_pb_fullwidth_header .header-content h1', 'declaration' => sprintf('color: %1$s !important;', esc_html($title_font_color)))); } if ('' !== $title_font_size) { ET_Builder_Element::set_style($function_name, array('selector' => '%%order_class%%.et_pb_fullwidth_header .header-content h1', 'declaration' => sprintf('font-size: %1$s;', esc_html(et_builder_process_range_value($title_font_size))))); } if ('' !== $subhead_font) { ET_Builder_Element::set_style($function_name, array('selector' => '%%order_class%%.et_pb_fullwidth_header .et_pb_fullwidth_header_subhead', 'declaration' => sprintf('%1$s', et_builder_set_element_font($subhead_font)))); } if ('' !== $subhead_font_color) { ET_Builder_Element::set_style($function_name, array('selector' => '%%order_class%%.et_pb_fullwidth_header .et_pb_fullwidth_header_subhead', 'declaration' => sprintf('color: %1$s !important;', esc_html($subhead_font_color)))); } if ('' !== $subhead_font_size) { ET_Builder_Element::set_style($function_name, array('selector' => '%%order_class%%.et_pb_fullwidth_header .et_pb_fullwidth_header_subhead', 'declaration' => sprintf('font-size: %1$s;', esc_html(et_builder_process_range_value($subhead_font_size))))); } if ('' !== $content_font) { ET_Builder_Element::set_style($function_name, array('selector' => '%%order_class%%.et_pb_fullwidth_header p', 'declaration' => sprintf('%1$s', et_builder_set_element_font($content_font)))); } if ('' !== $content_font_color) { ET_Builder_Element::set_style($function_name, array('selector' => '%%order_class%%.et_pb_fullwidth_header p', 'declaration' => sprintf('color: %1$s !important;', esc_html($content_font_color)))); } if ('' !== $content_font_size) { ET_Builder_Element::set_style($function_name, array('selector' => '%%order_class%%.et_pb_fullwidth_header p', 'declaration' => sprintf('font-size: %1$s;', esc_html(et_builder_process_range_value($content_font_size))))); } if ('' !== $scroll_down_icon_color) { ET_Builder_Element::set_style($function_name, array('selector' => '%%order_class%%.et_pb_fullwidth_header .et_pb_fullwidth_header_scroll a .et-pb-icon', 'declaration' => sprintf('color: %1$s;', esc_html($scroll_down_icon_color)))); } if ('' !== $scroll_down_icon_size) { ET_Builder_Element::set_style($function_name, array('selector' => '%%order_class%%.et_pb_fullwidth_header .et_pb_fullwidth_header_scroll a .et-pb-icon', 'declaration' => sprintf('font-size: %1$s;', esc_html(et_builder_process_range_value($scroll_down_icon_size))))); } if ('' !== $background_color) { ET_Builder_Element::set_style($function_name, array('selector' => '%%order_class%%.et_pb_fullwidth_header', 'declaration' => sprintf('background-color: %1$s;', esc_html($background_color)))); } if ('' !== $background_overlay_color) { ET_Builder_Element::set_style($function_name, array('selector' => '%%order_class%%.et_pb_fullwidth_header .et_pb_fullwidth_header_overlay', 'declaration' => sprintf('background-color: %1$s;', esc_html($background_overlay_color)))); } if ('' !== $background_url && 'off' === $parallax) { ET_Builder_Element::set_style($function_name, array('selector' => '%%order_class%%.et_pb_fullwidth_header', 'declaration' => sprintf('background-image: url(%1$s);', esc_html($background_url)))); } $button_output = ''; if ('' !== $button_one_text) { $button_output .= sprintf('<a href="%2$s" class="et_pb_more_button et_pb_button et_pb_button_one%4$s"%3$s>%1$s</a>', '' !== $button_one_text ? esc_attr($button_one_text) : '', '' !== $button_one_url ? esc_attr($button_one_url) : '#', '' !== $custom_icon_1 && 'on' === $button_custom_1 ? sprintf(' data-icon="%1$s"', esc_attr(et_pb_process_font_icon($custom_icon_1))) : '', '' !== $custom_icon_1 && 'on' === $button_custom_1 ? ' et_pb_custom_button_icon' : ''); } if ('' !== $button_two_text) { $button_output .= sprintf('<a href="%2$s" class="et_pb_more_button et_pb_button et_pb_button_two%4$s"%3$s>%1$s</a>', '' !== $button_two_text ? esc_attr($button_two_text) : '', '' !== $button_two_url ? esc_attr($button_two_url) : '#', '' !== $custom_icon_2 && 'on' === $button_custom_2 ? sprintf(' data-icon="%1$s"', esc_attr(et_pb_process_font_icon($custom_icon_2))) : '', '' !== $custom_icon_2 && 'on' === $button_custom_2 ? ' et_pb_custom_button_icon' : ''); } $class = " et_pb_module et_pb_bg_layout_{$background_layout} et_pb_text_align_{$text_orientation}"; $header_content = ''; if ('' !== $title || '' !== $subhead || '' !== $content || '' !== $button_output || '' !== $logo_image_url) { $logo_image = ''; if ('' !== $logo_image_url) { $logo_image = sprintf('<img src="%1$s" alt="%2$s"%3$s />', esc_attr($logo_image_url), esc_attr($logo_alt_text), '' !== $logo_title ? sprintf(' title="%1$s"', esc_attr($logo_title)) : ''); } $header_content = sprintf('<div class="header-content-container%6$s"> <div class="header-content"> %3$s %1$s %2$s %4$s %5$s </div> </div>', $title ? sprintf('<h1>%1$s</h1>', $title) : '', $subhead ? sprintf('<span class="et_pb_fullwidth_header_subhead">%1$s</span>', $subhead) : '', $logo_image, '' !== $content ? sprintf('<p>%1$s</p>', $this->shortcode_content) : '', '' !== $button_output ? $button_output : '', '' !== $content_orientation ? sprintf(' %1$s', $content_orientation) : ''); } $header_image = ''; if ('' !== $header_image_url) { $header_image = sprintf('<div class="header-image-container%2$s"> <div class="header-image"> <img src="%1$s" /> </div> </div>', '' !== $header_image_url ? esc_attr($header_image_url) : '', '' !== $image_orientation ? sprintf(' %1$s', $image_orientation) : ''); $module_class .= ' et_pb_header_with_image'; } $scroll_down_output = ''; if ('off' !== $header_scroll_down || '' !== $scroll_down_icon) { $scroll_down_output .= sprintf('<a href="#"><span class="scroll-down et-pb-icon">%1$s</span></a>', esc_html(et_pb_process_font_icon($scroll_down_icon, 'et_pb_get_font_down_icon_symbols'))); } $output = sprintf('<section%9$s class="et_pb_fullwidth_header%1$s%7$s%8$s%10$s"> %6$s <div class="et_pb_fullwidth_header_container%5$s"> %2$s %3$s </div> <div class="et_pb_fullwidth_header_overlay"></div> <div class="et_pb_fullwidth_header_scroll">%4$s</div> </section>', 'off' !== $header_fullscreen ? ' et_pb_fullscreen' : '', '' !== $header_content ? $header_content : '', '' !== $header_image ? $header_image : '', 'off' !== $header_scroll_down ? $scroll_down_output : '', '' !== $text_orientation ? sprintf(' %1$s', esc_attr($text_orientation)) : '', '' !== $background_url && 'on' === $parallax ? sprintf('<div class="et_parallax_bg%2$s" style="background-image: url(%1$s);"></div>', esc_attr($background_url), 'off' === $parallax_method ? ' et_pb_parallax_css' : '') : '', '' !== $background_url && 'on' === $parallax ? ' et_pb_section_parallax' : '', esc_attr($class), '' !== $module_id ? sprintf(' id="%1$s"', esc_attr($module_id)) : '', '' !== $module_class ? sprintf(' %1$s', esc_attr($module_class)) : ''); return $output; }
function process_advanced_button_options($function_name) { if (!isset($this->advanced_options['button'])) { return; } foreach ($this->advanced_options['button'] as $option_name => $option_settings) { $button_custom = $this->shortcode_atts["custom_{$option_name}"]; $button_text_size = $this->shortcode_atts["{$option_name}_text_size"]; $button_text_color = $this->shortcode_atts["{$option_name}_text_color"]; $button_bg_color = $this->shortcode_atts["{$option_name}_bg_color"]; $button_border_width = $this->shortcode_atts["{$option_name}_border_width"]; $button_border_color = $this->shortcode_atts["{$option_name}_border_color"]; $button_border_radius = $this->shortcode_atts["{$option_name}_border_radius"]; $button_font = $this->shortcode_atts["{$option_name}_font"]; $button_letter_spacing = $this->shortcode_atts["{$option_name}_letter_spacing"]; $button_use_icon = $this->shortcode_atts["{$option_name}_use_icon"]; $button_icon = $this->shortcode_atts["{$option_name}_icon"]; $button_icon_color = $this->shortcode_atts["{$option_name}_icon_color"]; $button_icon_placement = $this->shortcode_atts["{$option_name}_icon_placement"]; $button_on_hover = $this->shortcode_atts["{$option_name}_on_hover"]; $button_text_color_hover = $this->shortcode_atts["{$option_name}_text_color_hover"]; $button_bg_color_hover = $this->shortcode_atts["{$option_name}_bg_color_hover"]; $button_border_color_hover = $this->shortcode_atts["{$option_name}_border_color_hover"]; $button_border_radius_hover = $this->shortcode_atts["{$option_name}_border_radius_hover"]; $button_letter_spacing_hover = $this->shortcode_atts["{$option_name}_letter_spacing_hover"]; if ('on' === $button_custom) { $button_text_size = '' === $button_text_size || 'px' === $button_text_size ? '20px' : $button_text_size; $button_text_size = '' !== $button_text_size && false === strpos($button_text_size, 'px') ? $button_text_size . 'px' : $button_text_size; $css_element = !empty($option_settings['css']['main']) ? $option_settings['css']['main'] : $this->main_css_element . ' .et_pb_button'; $main_element_styles = sprintf('%1$s %2$s %3$s %4$s %5$s %6$s %7$s %8$s %9$s', '' !== $button_text_color ? sprintf('color:%1$s;', $button_text_color) : '', '' !== $button_bg_color ? sprintf('background:%1$s;', $button_bg_color) : '', '' !== $button_border_width && 'px' !== $button_border_width ? sprintf('border-width:%1$s !important;', et_builder_process_range_value($button_border_width)) : '', '' !== $button_border_color ? sprintf('border-color:%1$s;', $button_border_color) : '', '' !== $button_border_radius && 'px' !== $button_border_radius ? sprintf('border-radius:%1$s;', et_builder_process_range_value($button_border_radius)) : '', '' !== $button_letter_spacing && 'px' !== $button_letter_spacing ? sprintf('letter-spacing:%1$s;', et_builder_process_range_value($button_letter_spacing)) : '', '' !== $button_text_size && 'px' !== $button_text_size ? sprintf('font-size:%1$s;', et_builder_process_range_value($button_text_size)) : '', '' !== $button_font ? et_builder_set_element_font($button_font, true) : '', 'off' === $button_on_hover ? sprintf('padding-left:%1$s; padding-right: %2$s;', 'left' === $button_icon_placement ? '2em' : '0.7em', 'left' === $button_icon_placement ? '0.7em' : '2em') : ''); self::set_style($function_name, array('selector' => 'body #page-container ' . $css_element, 'declaration' => rtrim($main_element_styles))); $main_element_styles_hover = sprintf('%1$s %2$s %3$s %4$s %5$s %6$s', '' !== $button_text_color_hover ? sprintf('color:%1$s !important;', $button_text_color_hover) : '', '' !== $button_bg_color_hover ? sprintf('background:%1$s !important;', $button_bg_color_hover) : '', '' !== $button_border_color_hover ? sprintf('border-color:%1$s !important;', $button_border_color_hover) : '', '' !== $button_border_radius_hover ? sprintf('border-radius:%1$s;', et_builder_process_range_value($button_border_radius_hover)) : '', '' !== $button_letter_spacing_hover ? sprintf('letter-spacing:%1$spx;', $button_letter_spacing_hover) : '', 'off' === $button_on_hover ? '' : sprintf('padding-left:%1$s; padding-right: %2$s;', 'left' === $button_icon_placement ? '2em' : '0.7em', 'left' === $button_icon_placement ? '0.7em' : '2em')); self::set_style($function_name, array('selector' => 'body #page-container ' . $css_element . ':hover', 'declaration' => rtrim($main_element_styles_hover))); if ('off' === $button_use_icon) { $main_element_styles_after = 'display:none !important;'; $no_icon_styles = 'padding: 0.3em 1em !important;'; self::set_style($function_name, array('selector' => 'body #page-container ' . $css_element . ',' . $css_element . ':hover', 'declaration' => rtrim($no_icon_styles))); } else { $button_icon_code = '' !== $button_icon ? str_replace(';', '', str_replace('&#x', '', html_entity_decode(et_pb_process_font_icon($button_icon)))) : ''; $int_font_size = intval(str_replace('px', '', $button_text_size)); if ('' !== $button_text_size) { $button_icon_size = '35' !== $button_icon_code ? $button_text_size : $int_font_size * 1.6 . 'px'; } $main_element_styles_after = sprintf('%1$s %2$s %3$s %4$s %5$s %6$s %7$s', '' !== $button_icon_color ? sprintf('color:%1$s;', $button_icon_color) : '', '' !== $button_icon_code ? sprintf('line-height:%1$s;', '35' !== $button_icon_code ? '1.7em' : '1em') : '', '' !== $button_icon_code ? sprintf('font-size:%1$s !important;', $button_icon_size) : '', sprintf('opacity:%1$s;', 'on' === $button_on_hover ? '0' : '1'), 'off' !== $button_on_hover && '' !== $button_icon_code ? sprintf('margin-left:%1$s;left:%2$s;', 'left' === $button_icon_placement ? '0' : '-1em', 'left' === $button_icon_placement ? '1em' : 'auto') : '', 'off' === $button_on_hover ? sprintf('margin-left:%1$s;left:%2$s;', 'left' === $button_icon_placement ? '0' : '.3em', 'left' === $button_icon_placement ? '0.15em' : 'auto') : '', 'on' === $button_use_icon ? 'display: inline-block;' : ''); $hover_after_styles = sprintf('%1$s %2$s %3$s', '' !== $button_icon_code ? sprintf('margin-left:%1$s;', '35' !== $button_icon_code ? '.3em' : '0') : '', '' !== $button_icon_code ? sprintf('left:%1$s;margin-left:%2$s;', 'left' === $button_icon_placement ? '0.15em' : 'auto', '35' !== $button_icon_code ? '.3em' : '0') : '', 'on' === $button_on_hover ? 'opacity: 1;' : ''); self::set_style($function_name, array('selector' => 'body #page-container ' . $css_element . ':hover:after', 'declaration' => rtrim($hover_after_styles))); if ('' === $button_icon) { $default_icons_size = $int_font_size * 1.6 . 'px'; $custom_icon_size = $button_text_size; self::set_style($function_name, array('selector' => 'body #page-container ' . $css_element . ':after', 'declaration' => sprintf('font-size:%1$s;', $default_icons_size))); self::set_style($function_name, array('selector' => 'body.et_button_custom_icon #page-container ' . $css_element . ':after', 'declaration' => sprintf('font-size:%1$s;', $custom_icon_size))); } } self::set_style($function_name, array('selector' => 'body #page-container ' . $css_element . ':after', 'declaration' => rtrim($main_element_styles_after))); } } }