/** * Frontend Shortcode Handler * * @param array $atts array of attributes * @param string $content text within enclosing form of shortcode element * @param string $shortcodename the shortcode found, when == callback name * @return string $output returns the modified html string */ function shortcode_handler($atts, $content = "", $shortcodename = "", $meta = "") { global $avia_config; avia_sc_section::$section_count++; $atts = shortcode_atts(array('src' => '', 'position' => 'top left', 'repeat' => 'no-repeat', 'attach' => 'scroll', 'color' => 'main_color', 'custom_bg' => '', 'padding' => 'default', 'shadow' => 'shadow', 'id' => '', 'min_height' => '', 'min_height_px' => '', 'video' => '', 'video_ratio' => '16:9', 'video_mobile_disabled' => '', 'custom_markup' => '', 'attachment' => '', 'attachment_size' => '', 'bottom_border' => '', 'overlay_enable' => '', 'overlay_opacity' => '', 'overlay_color' => '', 'overlay_pattern' => '', 'overlay_custom_pattern' => '', 'scroll_down' => ''), $atts, $this->config['shortcode']); extract($atts); $output = ""; $class = "avia-section " . $color . " avia-section-" . $padding . " avia-" . $shadow; $background = ""; $params['id'] = !empty($id) ? AviaHelper::save_string($id, '-') : "av_section_" . avia_sc_section::$section_count; $params['custom_markup'] = $meta['custom_markup']; $params['attach'] = ""; if (!empty($attachment) && !empty($attachment_size)) { $attachment_entry = get_post($attachment); if (!empty($attachment_entry)) { if (!empty($attachment_size)) { $src = wp_get_attachment_image_src($attachment_entry->ID, $attachment_size); $src = !empty($src[0]) ? $src[0] : ""; } } } else { $attachment = false; } if ($custom_bg != "") { $background .= "background-color: {$custom_bg}; "; } /*set background image*/ if ($src != "") { if ($repeat == 'stretch') { $background .= "background-repeat: no-repeat; "; $class .= " avia-full-stretch"; } else { $background .= "background-repeat: {$repeat}; "; } $background .= "background-image: url({$src}); "; $background .= $attach == 'parallax' ? "background-attachment: scroll; " : "background-attachment: {$attach}; "; $background .= "background-position: {$position}; "; if ($attach == 'parallax') { $attachment_class = ""; if ($repeat == 'stretch' || $repeat == 'no-repeat') { $attachment_class .= " avia-full-stretch"; } $class .= " av-parallax-section"; $speed = apply_filters('avf_parallax_speed', "0.3", $params['id']); $params['attach'] .= "<div class='av-parallax' data-avia-parallax-ratio='{$speed}' >"; $params['attach'] .= "<div class='av-parallax-inner {$color} {$attachment_class}' style = '{$background}' >"; $params['attach'] .= "</div>"; $params['attach'] .= "</div>"; $background = ""; } $params['data'] = "data-section-bg-repeat='{$repeat}'"; } else { $attach = "scroll"; } if ($custom_bg != "") { $background .= "background-color: {$custom_bg}; "; } if ($background) { $background = "style = '{$background}'"; } /*check/create overlay*/ $overlay = ""; $pre_wrap = "<div class='av-section-color-overlay-wrap'>"; if (!empty($overlay_enable)) { $overlay_src = ""; $overlay = "opacity: {$overlay_opacity}; "; if (!empty($overlay_color)) { $overlay .= "background-color: {$overlay_color}; "; } if (!empty($overlay_pattern)) { if ($overlay_pattern == "custom") { $overlay_src = $overlay_custom_pattern; } else { $overlay_src = str_replace('{{AVIA_BASE_URL}}', AVIA_BASE_URL, $overlay_pattern); } } if (!empty($overlay_src)) { $overlay .= "background-image: url({$overlay_src}); background-repeat: repeat;"; } $overlay = "<div class='av-section-color-overlay' style='{$overlay}'></div>"; $class .= " av-section-color-overlay-active"; $params['attach'] .= $pre_wrap . $overlay; } if (!empty($scroll_down)) { if (!$overlay) { $params['attach'] .= $pre_wrap; } $params['attach'] .= "<a href='#next-section' title='' class='scroll-down-link' " . av_icon_string('scrolldown') . "></a>"; } $class .= " avia-bg-style-" . $attach; $params['class'] = $class . " " . $meta['el_class']; $params['bg'] = $background; $params['min_height'] = $min_height; $params['min_height_px'] = $min_height_px; $params['video'] = $video; $params['video_ratio'] = $video_ratio; $params['video_mobile_disabled'] = $video_mobile_disabled; if (isset($meta['index'])) { if ($meta['index'] == 0) { $params['main_container'] = true; } if ($meta['index'] == 0 || isset($meta['siblings']['prev']['tag']) && in_array($meta['siblings']['prev']['tag'], AviaBuilder::$full_el_no_section)) { $params['close'] = false; } } $avia_config['layout_container'] = "section"; $output .= avia_new_section($params); $output .= ShortcodeHelper::avia_remove_autop($content, true); /*set extra arrow element*/ if (strpos($bottom_border, 'border-extra') !== false) { $backgroundEl = ""; $backgroundElColor = !empty($custom_bg) ? $custom_bg : $avia_config['backend_colors']['color_set'][$color]['bg']; if ($backgroundElColor) { $backgroundEl = " style='background-color:{$backgroundElColor};' "; } avia_sc_section::$add_to_closing = "<div class='av-extra-border-element {$bottom_border}'><div class='av-extra-border-outer'><div class='av-extra-border-inner' {$backgroundEl}></div></div></div>"; } else { avia_sc_section::$add_to_closing = ""; } //next section needs an extra closing tag if overlay with wrapper was added: if ($overlay || !empty($scroll_down)) { avia_sc_section::$close_overlay = "</div>"; } else { avia_sc_section::$close_overlay = ""; } //if the next tag is a section dont create a new section from this shortcode if (!empty($meta['siblings']['next']['tag']) && in_array($meta['siblings']['next']['tag'], AviaBuilder::$full_el)) { $skipSecond = true; } //if there is no next element dont create a new section. if we got a sidebar always create a next section at the bottom if (empty($meta['siblings']['next']['tag']) && !avia_has_sidebar()) { $skipSecond = true; } if (empty($skipSecond)) { $new_params['id'] = "after_section_" . avia_sc_section::$section_count; $output .= avia_new_section($new_params); } unset($avia_config['layout_container']); return $output; }
/** * Frontend Shortcode Handler * * @param array $atts array of attributes * @param string $content text within enclosing form of shortcode element * @param string $shortcodename the shortcode found, when == callback name * @return string $output returns the modified html string */ function shortcode_handler($atts, $content = "", $shortcodename = "", $meta = "") { avia_sc_section::$section_count++; $atts = shortcode_atts(array('src' => '', 'position' => 'top left', 'repeat' => 'no-repeat', 'attach' => 'scroll', 'color' => 'main_color', 'custom_bg' => '', 'padding' => 'default', 'shadow' => 'shadow', 'id' => '', 'min_height' => '', 'video' => '', 'video_ratio' => '16:9', 'video_mobile_disabled' => '', 'custom_markup' => '', 'attachment' => '', 'attachment_size' => ''), $atts, $this->config['shortcode']); extract($atts); $output = ""; $class = "avia-section " . $color . " avia-section-" . $padding . " avia-" . $shadow . " avia-bg-style-" . $attach; $background = ""; $params['id'] = !empty($id) ? AviaHelper::save_string($id, '-') : "av_section_" . avia_sc_section::$section_count; $params['custom_markup'] = $meta['custom_markup']; if (!empty($attachment) && !empty($attachment_size)) { $attachment_entry = get_post($attachment); if (!empty($attachment_entry)) { if (!empty($attachment_size)) { $src = wp_get_attachment_image_src($attachment_entry->ID, $attachment_size); $src = !empty($src[0]) ? $src[0] : ""; } } } else { $attachment = false; } if ($src != "") { if ($repeat == 'stretch') { $background .= "background-repeat: no-repeat; "; $class .= " avia-full-stretch"; } else { $background .= "background-repeat: {$repeat}; "; } $background .= "background-image: url({$src}); "; $background .= $attach == 'parallax' ? "background-attachment: scroll; " : "background-attachment: {$attach}; "; $background .= "background-position: {$position}; "; if ($attach == 'parallax') { $attachment_class = ""; if ($repeat == 'stretch' || $repeat == 'no-repeat') { $attachment_class .= " avia-full-stretch"; } $class .= " av-parallax-section"; $speed = apply_filters('avf_parallax_speed', "0.3", $params['id']); $params['attach'] = "<div class='av-parallax {$attachment_class}' data-avia-parallax-ratio='{$speed}' style = '{$background}' ></div>"; $background = ""; } $params['data'] = "data-section-bg-repeat='{$repeat}'"; } if ($custom_bg != "") { $background .= "background-color: {$custom_bg}; "; } if ($background) { $background = "style = '{$background}'"; } $params['class'] = $class . " " . $meta['el_class']; $params['bg'] = $background; $params['min_height'] = $min_height; $params['video'] = $video; $params['video_ratio'] = $video_ratio; $params['video_mobile_disabled'] = $video_mobile_disabled; if (isset($meta['index'])) { if ($meta['index'] == 0) { $params['main_container'] = true; } if ($meta['index'] == 0 || isset($meta['siblings']['prev']['tag']) && in_array($meta['siblings']['prev']['tag'], AviaBuilder::$full_el_no_section)) { $params['close'] = false; } } global $avia_config; $avia_config['layout_container'] = "section"; $output .= avia_new_section($params); $output .= ShortcodeHelper::avia_remove_autop($content, true); //if the next tag is a section dont create a new section from this shortcode if (!empty($meta['siblings']['next']['tag']) && in_array($meta['siblings']['next']['tag'], AviaBuilder::$full_el)) { $skipSecond = true; } //if there is no next element dont create a new section. if we got a sidebar always create a next section at the bottom if (empty($meta['siblings']['next']['tag']) && !avia_has_sidebar()) { $skipSecond = true; } if (empty($skipSecond)) { $new_params['id'] = "after_section_" . avia_sc_section::$section_count; $output .= avia_new_section($new_params); } unset($avia_config['layout_container']); return $output; }
/** * Frontend Shortcode Handler * * @param array $atts array of attributes * @param string $content text within enclosing form of shortcode element * @param string $shortcodename the shortcode found, when == callback name * @return string $output returns the modified html string */ function shortcode_handler($atts, $content = "", $shortcodename = "", $meta = "") { avia_sc_section::$section_count++; extract(shortcode_atts(array('src' => '', 'position' => 'top left', 'repeat' => 'no-repeat', 'attach' => 'scroll', 'color' => 'main_color', 'custom_bg' => '', 'padding' => 'default', 'shadow' => 'shadow', 'id' => ''), $atts)); $output = ""; $class = "avia-section " . $color . " avia-section-" . $padding . " avia-" . $shadow; $background = ""; if ($src != "") { if ($repeat == 'stretch') { $background .= "background-repeat: no-repeat; "; $class .= " avia-full-stretch"; } else { $background .= "background-repeat: {$repeat}; "; } $background .= "background-image: url({$src}); "; $background .= "background-attachment: {$attach}; "; $background .= "background-position: {$position}; "; } if ($custom_bg != "") { $background .= "background-color: {$custom_bg}; "; } if ($background) { $background = "style = '{$background}'"; } $params['class'] = $class . " " . $meta['el_class']; $params['bg'] = $background; $params['id'] = !empty($id) ? AviaHelper::save_string($id, '-') : "av_section_" . avia_sc_section::$section_count; if (isset($meta['index'])) { if ($meta['index'] == 0 || isset($meta['siblings']['prev']['tag']) && in_array($meta['siblings']['prev']['tag'], array('av_layerslider', 'av_slideshow_full', 'av_fullscreen'))) { $params['close'] = false; } } $output .= avia_new_section($params); $output .= ShortcodeHelper::avia_remove_autop($content, true); //if the next tag is a section dont create a new section from this shortcode if (!empty($meta['siblings']['next']['tag']) && in_array($meta['siblings']['next']['tag'], array('av_layerslider', 'av_section', 'av_slideshow_full', 'av_fullscreen'))) { $skipSecond = true; } //if there is no next element dont create a new section. if we got a sidebar always create a next section at the bottom if (empty($meta['siblings']['next']['tag']) && !avia_has_sidebar()) { $skipSecond = true; } if (empty($skipSecond)) { $new_params['id'] = "after_section_" . avia_sc_section::$section_count; $output .= avia_new_section($new_params); } return $output; }