/** * 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 = "") { $custom_class = !empty($meta['custom_class']) ? $meta['custom_class'] : ""; $output = ''; $markup = avia_markup_helper(array('context' => 'entry', 'echo' => false, 'custom_markup' => $meta['custom_markup'])); $markup_text = avia_markup_helper(array('context' => 'entry_content', 'echo' => false, 'custom_markup' => $meta['custom_markup'])); $output .= '<section class="av_textblock_section" ' . $markup . '>'; $output .= "<div class='avia_textblock {$custom_class}' {$markup_text}>" . ShortcodeHelper::avia_apply_autop(ShortcodeHelper::avia_remove_autop($content)) . "</div>"; $output .= '</section>'; 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 = "") { extract(shortcode_atts(array('font_color' => "", 'color' => '', 'size' => ''), $atts, $this->config['shortcode'])); $custom_class = !empty($meta['custom_class']) ? $meta['custom_class'] : ""; $output = ''; $markup = avia_markup_helper(array('context' => 'entry', 'echo' => false, 'custom_markup' => $meta['custom_markup'])); $markup_text = avia_markup_helper(array('context' => 'entry_content', 'echo' => false, 'custom_markup' => $meta['custom_markup'])); $extra_styling = ""; if ($size) { $extra_styling .= "font-size:{$size}px; "; } if ($font_color == "custom") { $custom_class .= " av_inherit_color"; $extra_styling .= !empty($color) ? "color:{$color}; " : ""; } if ($extra_styling) { $extra_styling = " style='{$extra_styling}'"; } $output .= '<section class="av_textblock_section" ' . $markup . '>'; $output .= "<div class='avia_textblock {$custom_class}' {$extra_styling} {$markup_text}>" . ShortcodeHelper::avia_apply_autop(ShortcodeHelper::avia_remove_autop($content)) . "</div>"; $output .= '</section>'; return $output; }
protected function advanced_slide() { $html = ""; $counter = 0; $this->ie8_fallback = ""; foreach ($this->id_array as $key => $id) { $meta = array_merge(array('content' => $this->subslides[$key]['content'], 'title' => '', 'link_apply' => '', 'link' => '', 'link_target' => '', 'button_label' => '', 'button_color' => 'light', 'link1' => '', 'link_target1' => '', 'button_label2' => '', 'button_color2' => 'light', 'link2' => '', 'link_target2' => '', 'position' => 'center center', 'caption_pos' => 'capt-bottom capt-left', 'video_cover' => '', 'video_controls' => '', 'video_mute' => '', 'video_loop' => '', 'video_format' => '', 'video_autoplay' => '', 'video_ratio' => '16:9', 'video_mobile_disabled' => '', 'video_mobile' => 'mobile-fallback-image', 'mobile_image' => '', 'slide_type' => '', 'custom_markup' => ''), $this->subslides[$key]['attr']); extract($meta); if (isset($this->slides[$id]) || $slide_type == 'video') { $img = array(''); $slide = ""; $attachment_id = isset($this->slides[$id]) ? $id : false; $link = AviaHelper::get_url($link, $attachment_id); $extra_class = ""; $linkdescription = ""; $linkalt = ""; $this->service = false; $slider_data = ""; $stretch_height = false; $final_ratio = ""; $viewport = 16 / 9; $markup_url = avia_markup_helper(array('context' => 'image_url', 'echo' => false, 'id' => $attachment_id, 'custom_markup' => $custom_markup)); if ($slide_type == 'video') { $this->service = avia_slideshow_video_helper::which_video_service($video); $video = avia_slideshow_video_helper::set_video_slide($video, $this->service, $meta); $video_class = !empty($video_controls) ? " av-hide-video-controls" : ""; $video_class .= !empty($video_mute) ? " av-mute-video" : ""; $video_class .= !empty($video_loop) ? " av-loop-video" : ""; $video_class .= !empty($video_mobile) ? " av-" . $video_mobile : ""; $extra_class .= " av-video-slide " . $video_cover . " av-video-service-" . $this->service . " " . $video_class; $slider_data .= " data-controls='{$video_controls}' data-mute='{$video_mute}' data-loop='{$video_loop}' data-disable-autoplay='{$video_autoplay}' "; if ($mobile_image) { $fallback_img = wp_get_attachment_image_src($mobile_image, $this->config['size']); $slider_data .= " data-mobile-img='" . $fallback_img[0] . "'"; } //if we dont use a fullscreen slider pass the video ratio to the slider if ($this->config['bg_slider'] != "true") { global $avia_config; //if we use the small slideshow only allow the "full" $video_format if ($this->config['handle'] == 'av_slideshow') { $video_format = "full"; } //calculate the viewport ratio if (!empty($avia_config['imgSize'][$this->config['size']])) { $viewport = $avia_config['imgSize'][$this->config['size']]['width'] / $avia_config['imgSize'][$this->config['size']]['height']; } //calculate the ratio when passed as a string (eg: 16:9, 4:3). fallback is 16:9 $video_ratio = explode(':', trim($video_ratio)); if (empty($video_ratio[0])) { $video_ratio[0] = 16; } if (empty($video_ratio[1])) { $video_ratio[1] = 9; } $final_ratio = (int) $video_ratio[0] / (int) $video_ratio[1]; switch ($video_format) { case "": $final_ratio = $viewport; break; case "stretch": $final_ratio = $viewport; $stretch_height = ceil($viewport / ($video_ratio[0] / $video_ratio[1]) * 100); $stretch_pos = ($stretch_height - 100) / 2 * -1; $slider_data .= " data-video-height='{$stretch_height}'"; $slider_data .= " data-video-toppos='{$stretch_pos}'"; $extra_class .= " av-video-stretch"; break; case "full": // do nothing and apply the entered ratio break; } $slider_data .= " data-video-ratio='{$final_ratio}'"; } } else { $slide = $this->slides[$id]; $linktitle = trim($slide->post_title) ? esc_attr($slide->post_title) : ""; if ($linktitle == "-") { $linktitle = ""; } $linkdescription = trim($slide->post_content) && empty($link) ? "title='" . esc_attr($slide->post_content) . "'" : ""; $linkalt = get_post_meta($slide->ID, '_wp_attachment_image_alt', true); $linkalt = !empty($linkalt) ? esc_attr($linkalt) : ''; $img = wp_get_attachment_image_src($slide->ID, $this->config['size']); $video = ""; } if ($this->slide_count === 1) { $extra_class .= " av-single-slide"; } $blank = strpos($link_target, '_blank') !== false || $link_target == 'yes' ? ' target="_blank" ' : ""; $blank .= strpos($link_target, 'nofollow') !== false ? ' rel="nofollow" ' : ""; $tags = !empty($link) && $link_apply == 'image' ? array("a href='{$link}'{$blank}", 'a') : array('div', 'div'); $caption = ""; $button_html = ""; $counter++; $button_count = ""; if (strpos($link_apply, 'button-two') !== false) { $button_count = "avia-multi-slideshow-button"; } //if we got a CTA button apply the link to the button istead of the slide if (strpos($link_apply, 'button') !== false) { $button_html .= $this->slideshow_cta_button($link1, $link_target1, $button_color, $button_label, $button_count); $tags = array('div', 'div'); } if (strpos($link_apply, 'button-two') !== false) { $button_count .= " avia-slideshow-button-2"; $button_html .= $this->slideshow_cta_button($link2, $link_target2, $button_color2, $button_label2, $button_count); } //check if we got a caption $markup_description = avia_markup_helper(array('context' => 'description', 'echo' => false, 'id' => $attachment_id, 'custom_markup' => $custom_markup)); $markup_name = avia_markup_helper(array('context' => 'name', 'echo' => false, 'id' => $attachment_id, 'custom_markup' => $custom_markup)); if (trim($title) != "") { $title = "<h2 class='avia-caption-title' {$markup_name}>" . trim(apply_filters('avf_slideshow_title', $title)) . "</h2>"; } if (is_array($content)) { $content = implode(' ', $content); } //temp fix for trim() expects string warning until I can actually reproduce the problem if (trim($content) != "") { $content = "<div class='avia-caption-content' {$markup_description}>" . ShortcodeHelper::avia_apply_autop(ShortcodeHelper::avia_remove_autop(trim($content))) . "</div>"; } if (trim($title . $content . $button_html) != "") { if (trim($title) != "" && trim($button_html) != "" && trim($content) == "") { $content = "<br/>"; } if ($this->config['handle'] == 'av_slideshow_full' || $this->config['handle'] == 'av_fullscreen') { $caption .= '<div class = "caption_fullwidth ' . $caption_pos . '">'; $caption .= '<div class = "container caption_container">'; $caption .= '<div class = "slideshow_caption">'; $caption .= '<div class = "slideshow_inner_caption">'; $caption .= '<div class = "slideshow_align_caption">'; $caption .= $title; $caption .= $content; $caption .= $button_html; $caption .= '</div>'; $caption .= '</div>'; $caption .= '</div>'; $caption .= '</div>'; $caption .= '</div>'; } else { $caption = '<div class="avia-caption"><div class="avia-inner-caption">' . $title . $content . "</div></div>"; } } if (!empty($img[0])) { $slider_data .= $this->config['bg_slider'] == "true" ? "style='background-position:{$position};' data-img-url='" . $img[0] . "'" : ""; if ($slider_data) { if (empty($this->ie8_fallback)) { $this->ie8_fallback .= "<!--[if lte IE 8]>"; $this->ie8_fallback .= "<style type='text/css'>"; } $this->ie8_fallback .= "\n #{$this->config['css_id']} .slide-{$counter}{"; $this->ie8_fallback .= "\n -ms-filter: \"progid:DXImageTransform.Microsoft.AlphaImageLoader(src='{$img[0]}', sizingMethod='scale')\"; "; $this->ie8_fallback .= "\n filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='{$img[0]}', sizingMethod='scale'); "; $this->ie8_fallback .= "\n } \n"; } } $html .= "<li {$slider_data} class='{$extra_class} slide-{$counter} ' >"; $html .= "<" . $tags[0] . " data-rel='slideshow-" . avia_slideshow::$slider . "' class='avia-slide-wrap' {$linkdescription} >{$caption}"; if ($this->config['bg_slider'] != "true" && empty($video)) { $html .= "<img src='" . $img[0] . "' width='" . $img[1] . "' height='" . $img[2] . "' title='" . $linktitle . "' alt='" . $linkalt . "' {$markup_url} />"; } $html .= $video; $html .= "</" . $tags[1] . ">"; $html .= "</li>"; } else { $this->slide_count--; } } if (!empty($this->ie8_fallback)) { $this->ie8_fallback .= "</style> <![endif]-->"; add_action('wp_footer', array($this, 'add_ie8_fallback_to_footer')); } return $html; }
/** * 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 = "") { $atts = shortcode_atts(array('name' => '', 'src' => '', 'description' => '', 'job' => '', 'custom_markup' => '', 'font_color' => '', 'custom_title' => '', 'custom_content' => ''), $atts, $this->config['shortcode']); extract($atts); $title_styling = ""; $content_styling = ""; $content_class = ""; $title_class = ""; if ($font_color == "custom") { $title_styling .= !empty($custom_title) ? "color:{$custom_title}; " : ""; $content_styling .= !empty($custom_content) ? "color:{$custom_content}; " : ""; if ($title_styling) { $title_styling = " style='{$title_styling}'"; $title_class = "av_opacity_variation"; } if ($content_styling) { $content_styling = " style='{$content_styling}'"; $content_class = "av_inherit_color"; } } $socials = ShortcodeHelper::shortcode2array($content); $output = ""; $markup = avia_markup_helper(array('context' => 'person', 'echo' => false, 'custom_markup' => $custom_markup)); $output .= "<section class='avia-team-member " . $meta['el_class'] . "' {$markup}>"; if ($src) { $output .= "<div class='team-img-container'>"; $markup = avia_markup_helper(array('context' => 'single_image', 'echo' => false, 'custom_markup' => $custom_markup)); $output .= "<img class='avia_image avia_image_team' src='" . $src . "' alt='" . esc_attr($name) . "' {$markup} />"; if (!empty($socials)) { $output .= "<div class='team-social'>"; $output .= "<div class='team-social-inner'>"; foreach ($socials as $social) { //set defaults $social['attr'] = shortcode_atts(array('link' => '', 'link_target' => '', 'icon' => '', 'font' => '', 'title' => ''), $social['attr'], 'av_social'); //build link for each social item $tooltip = $social['attr']['title'] ? 'data-avia-tooltip="' . $social['attr']['title'] . '"' : ""; $target = $social['attr']['link_target'] ? "target='_blank'" : ""; //apply special class in case its a link to a known social media service $social_class = $this->get_social_class($social['attr']['link']); if (strstr($social['attr']['link'], '@')) { $markup = avia_markup_helper(array('context' => 'email', 'echo' => false, 'custom_markup' => $custom_markup)); } else { $markup = avia_markup_helper(array('context' => 'url', 'echo' => false, 'custom_markup' => $custom_markup)); } $display_char = av_icon($social['attr']['icon'], $social['attr']['font']); $output .= "<span class='hidden av_member_url_markup {$social_class}' {$markup}>" . $social['attr']['link'] . "</span>"; $output .= "<a rel='v:url' {$tooltip} {$target} class='{$social_class} avia-team-icon ' href='" . $social['attr']['link'] . "' {$display_char}>"; $output .= "</a>"; } $output .= "</div>"; $output .= "</div>"; } $output .= "</div>"; } if ($name) { $markup = avia_markup_helper(array('context' => 'name', 'echo' => false, 'custom_markup' => $custom_markup)); $output .= "<h3 class='team-member-name' {$title_styling} {$markup}>{$name}</h3>"; } if ($job) { $markup = avia_markup_helper(array('context' => 'job', 'echo' => false, 'custom_markup' => $custom_markup)); $output .= "<div class='team-member-job-title {$title_class}' {$title_styling} {$markup}>{$job}</div>"; } if ($description) { $markup = avia_markup_helper(array('context' => 'description', 'echo' => false, 'custom_markup' => $custom_markup)); $output .= "<div class='team-member-description {$content_class}' {$markup} {$content_styling}>" . ShortcodeHelper::avia_apply_autop(ShortcodeHelper::avia_remove_autop($description)) . "</div>"; } $markup = avia_markup_helper(array('context' => 'affiliation', 'echo' => false, 'custom_markup' => $custom_markup)); $output .= "<span class='hidden team-member-affiliation' {$markup}>" . get_bloginfo('name') . "</span>"; $output .= "</section>"; return $output; }
function av_toggle($atts, $content = "", $shortcodename = "") { $output = $titleClass = $contentClass = ""; $toggle_atts = shortcode_atts(array('title' => '', 'tags' => '', 'custom_id' => ''), $atts); if (is_numeric(avia_sc_toggle::$initial) && avia_sc_toggle::$counter == avia_sc_toggle::$initial) { $titleClass = "activeTitle"; $contentClass = "activeToggle"; } if (empty($toggle_atts['title'])) { $toggle_atts['title'] = avia_sc_toggle::$counter; } if (empty($toggle_atts['custom_id'])) { $toggle_atts['custom_id'] = 'toggle-id-' . avia_sc_toggle::$toggle_id++; } $output .= '<div class="single_toggle" ' . $this->create_tag_string($toggle_atts['tags']) . ' >'; $output .= '<p data-fake-id="#' . $toggle_atts['custom_id'] . '" class="toggler ' . $titleClass . '">' . $toggle_atts['title'] . '<span class="toggle_icon">'; $output .= '<span class="vert_icon"></span><span class="hor_icon"></span></span></p>'; $output .= '<div id="' . $toggle_atts['custom_id'] . '-container" class="toggle_wrap ' . $contentClass . '" >'; $output .= '<div class="toggle_content invers-color">'; $output .= ShortcodeHelper::avia_apply_autop(ShortcodeHelper::avia_remove_autop($content)); $output .= '</div>'; $output .= '</div>'; $output .= '</div>'; avia_sc_toggle::$counter++; return $output; }
function helper_array2form_fields($base) { $form_fields = array(); $labels = array(); if (is_array($base)) { foreach ($base as $key => $field) { $sanizited_id = trim(strtolower($field['attr']['label'])); $labels[$sanizited_id] = empty($labels[$sanizited_id]) ? 1 : $labels[$sanizited_id] + 1; if ($labels[$sanizited_id] > 1) { $sanizited_id = $sanizited_id . '_' . $labels[$sanizited_id]; } $form_fields[$sanizited_id] = $field['attr']; if (!empty($field['content'])) { $form_fields[$sanizited_id]['content'] = ShortcodeHelper::avia_apply_autop($field['content']); } } } return $form_fields; }
function av_iconlist_item($atts, $content = "", $shortcodename = "") { $icon_el = $this->elements[0]['subelements'][3]; $chars = $icon_el['chars']; if (!is_array($chars)) { include $icon_el['chars']; } $display_char = isset($chars[$atts['icon'] - 1]) ? $chars[$atts['icon'] - 1] : $chars[0]; $atts['linktarget'] = !empty($atts['linktarget']) && $atts['linktarget'] == 'no' ? '' : 'target="_blank"'; if (!empty($atts['link'])) { $atts['link'] = aviaHelper::get_url($atts['link']); $atts['title'] = "<a href='{$atts['link']}' title='" . esc_attr($atts['title']) . "'>{$atts['title']}</a>"; } $output = ""; $output .= "<li>"; $output .= "<div class='iconlist_icon avia-font-" . $icon_el['font'] . "'><span class='iconlist-char'>{$display_char}</span></div>"; $output .= "<div class='iconlist_content_wrap'>"; $output .= "<h4 class='iconlist_title'>" . $atts['title'] . "</h4>"; $output .= "<div class='iconlist_content'>" . ShortcodeHelper::avia_apply_autop(ShortcodeHelper::avia_remove_autop($content)) . "</div>"; $output .= "</div>"; $output .= "<div class='iconlist-timeline'></div>"; $output .= "</li>"; 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 = "") { extract(shortcode_atts(array('title' => 'Title', 'icon' => '1', 'position' => 'left', 'link' => '', 'linktarget' => 'no'), $atts)); $icon_el = $this->elements[0]; $chars = $icon_el['chars']; $font = $icon_el['font']; if (!is_array($chars)) { include $icon_el['chars']; } $display_char = isset($chars[$icon - 1]) ? $chars[$icon - 1] : $chars[0]; if ($position == 'top') { $position .= " main_color"; } $linktarget = $linktarget == 'no' ? '' : 'target="_blank"'; $link = aviaHelper::get_url($link); if (!empty($link)) { $title = "<a href='{$link}' title='" . esc_attr($title) . "' {$linktarget}>{$title}</a>"; } // add blockquotes to the content $output = '<div class="iconbox iconbox_' . $position . ' ' . $meta['el_class'] . '">'; $output .= '<div class="iconbox_content">'; $output .= '<div class="iconbox_icon heading-color avia-font-' . $font . '">' . $display_char . '</div>'; $output .= '<h3 class="iconbox_content_title">' . $title . "</h3>"; $output .= ShortcodeHelper::avia_apply_autop(ShortcodeHelper::avia_remove_autop($content)); $output .= '</div></div>'; 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 = "") { extract(shortcode_atts(array('tag' => 'h3', 'padding' => '5', 'heading' => '', 'color' => '', 'style' => '', 'custom_font' => '', 'size' => '', 'subheading_active' => '', 'subheading_size' => ''), $atts, $this->config['shortcode'])); $output = ""; $styling = ""; $subheading = ""; $border_styling = ""; $before = $after = ""; $class = $meta['el_class']; if ($heading) { // add seo markup $markup = avia_markup_helper(array('context' => 'entry_title', 'echo' => false, 'custom_markup' => $meta['custom_markup'])); // filter heading for & symbol and convert them $heading = apply_filters('avia_ampersand', wptexturize($heading)); //if the heading contains a strong tag make apply a custom class that makes the rest of the font appear smaller for a better effect if (strpos($heading, '<strong>') !== false) { $class .= " av-thin-font"; } //apply the padding bottom styling $styling .= "padding-bottom:{$padding}px;"; // if the color is a custom hex value add the styling for both border and font if ($color == "custom-color-heading" && $custom_font) { $styling .= "color:{$custom_font};"; $border_styling = "style='border-color:{$custom_font}'"; } // if a custom font size is set apply it to the container and also apply the inherit class so the actual heading uses the size if (!empty($style) && !empty($size)) { $styling .= "font-size:{$size}px;"; $class .= " av-inherit-size"; } //finish up the styling string if (!empty($styling)) { $styling = "style='{$styling}'"; } //check if we got a subheading if (!empty($subheading_active) && !empty($content)) { $content = "<div class ='av-subheading av-{$subheading_active}' style='font-size:{$subheading_size}px;'>" . ShortcodeHelper::avia_apply_autop(ShortcodeHelper::avia_remove_autop($content)) . "</div>"; if ($subheading_active == "subheading_above") { $before = $content; } else { $after = $content; } } //html markup $output .= "<div {$styling} class='av-special-heading av-special-heading-{$tag} {$color} {$style} {$class}'>"; $output .= $before; $output .= "<{$tag} class='av-special-heading-tag' {$markup} {$styling}>{$heading}</{$tag}>"; $output .= $after; $output .= "<div class='special-heading-border'><div class='special-heading-inner-border' {$border_styling}></div></div>"; $output .= "</div>"; } 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 = "") { extract(shortcode_atts(array('title' => 'Title', 'icon' => '1', 'position' => 'left', 'link' => '', 'linktarget' => 'no', 'linkelement' => '', 'font' => ''), $atts)); $display_char = av_icon($icon, $font); $display_char_wrapper = array(); if ($position == 'top') { $position .= " main_color"; } $blank = strpos($linktarget, '_blank') !== false || $linktarget == 'yes' ? ' target="_blank" ' : ""; $blank .= strpos($linktarget, 'nofollow') !== false ? ' rel="nofollow" ' : ""; $link = aviaHelper::get_url($link); if (!empty($link)) { $linktitle = $title; switch ($linkelement) { case 'both': $title = "<a href='{$link}' title='" . esc_attr($linktitle) . "' {$blank}>{$linktitle}</a>"; $display_char_wrapper['start'] = "a href='{$link}' title='" . esc_attr($linktitle) . "' {$blank}"; $display_char_wrapper['end'] = 'a'; break; case 'only_icon': $display_char_wrapper['start'] = "a href='{$link}' title='" . esc_attr($linktitle) . "' {$blank}"; $display_char_wrapper['end'] = 'a'; break; default: $title = "<a href='{$link}' title='" . esc_attr($linktitle) . "' {$blank}>{$linktitle}</a>"; $display_char_wrapper['start'] = 'div'; $display_char_wrapper['end'] = 'div'; break; } } if (empty($display_char_wrapper)) { $display_char_wrapper['start'] = 'div'; $display_char_wrapper['end'] = 'div'; } // add blockquotes to the content $markup = avia_markup_helper(array('context' => 'entry', 'echo' => false)); $output = '<article class="iconbox iconbox_' . $position . ' ' . $meta['el_class'] . '" ' . $markup . '>'; $output .= ' <div class="iconbox_content">'; $output .= ' <header class="entry-content-header">'; $output .= ' <' . $display_char_wrapper['start'] . ' class="iconbox_icon heading-color" ' . $display_char . '></' . $display_char_wrapper['end'] . '>'; $markup = avia_markup_helper(array('context' => 'entry_title', 'echo' => false)); $output .= " <h3 class='iconbox_content_title' {$markup}>" . $title . "</h3>"; $output .= ' </header>'; $markup = avia_markup_helper(array('context' => 'entry_content', 'echo' => false)); $output .= " <div class='iconbox_content_container' {$markup}>"; $output .= ShortcodeHelper::avia_apply_autop(ShortcodeHelper::avia_remove_autop($content)); $output .= ' </div>'; $output .= ' </div>'; $output .= ' <footer class="entry-footer"></footer>'; $output .= '</article>'; 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 = "") { $output = ""; $class = ""; $alt = ""; $title = ""; /** * setting the variables for the extract function * * @var $src * @var $animation * @var $link * @var $attachment * @var $attachment_size * @var $target * @var $styling * @var $caption * @var $font_size * @var $appearance * @var $hover * @var $align * @var $overlay_opacity * @var $overlay_color * @var $overlay_text_color */ $atts = shortcode_atts(array('src' => '', 'animation' => 'no-animation', 'link' => '', 'attachment' => '', 'attachment_size' => '', 'target' => 'no', 'styling' => '', 'caption' => '', 'font_size' => '', 'appearance' => '', 'hover' => '', 'align' => 'center', 'overlay_opacity' => '0.4', 'overlay_color' => '#444444', 'overlay_text_color' => '#ffffff'), $atts, $this->config['shortcode']); extract($atts); $post_id = get_the_ID(); $primary_image = get_field('advertisement_package', $post_id) == '165' ? '' : $this->getPrimaryImage($post_id); if (!empty($primary_image)) { $alt = !empty($primary_image['alt']) ? esc_attr($primary_image['alt']) : ''; $title = trim($primary_image['title']) ? esc_attr($primary_image['title']) : ""; $src = $primary_image['url']; } else { $attachment = false; } if (!empty($src)) { $class = $animation == "no-animation" ? "" : "avia_animated_image avia_animate_when_almost_visible " . $animation; $class .= " av-styling-" . $styling . " " . $hover; if (is_numeric($src)) { //$output = wp_get_attachment_image($src,'large'); $output = wp_get_attachment_image($src, 'large', false, array('class' => "avia_image {$class} " . $this->class_by_arguments('align', $atts, true))); } else { $link = aviaHelper::get_url($link, $attachment); $blank = strpos($target, '_blank') !== false || $target == 'yes' ? ' target="_blank" ' : ""; $blank .= strpos($target, 'nofollow') !== false ? ' rel="nofollow" ' : ""; $overlay = ""; $style = ""; $style .= AviaHelper::style_string($atts, 'overlay_text_color', 'color'); if ($font_size) { // $style = "style='font-size: {$font_size}px;'"; $style .= AviaHelper::style_string($atts, 'font_size', 'font-size', 'px'); } $style = AviaHelper::style_string($style); if ($caption == "yes") { $caption_style = ""; $caption_style .= AviaHelper::style_string($atts, 'overlay_opacity', 'opacity'); $caption_style .= AviaHelper::style_string($atts, 'overlay_color', 'background-color'); $caption_style = AviaHelper::style_string($caption_style); $overlay_bg = "<div class='av-caption-image-overlay-bg' {$caption_style}></div>"; $content = ShortcodeHelper::avia_apply_autop(ShortcodeHelper::avia_remove_autop($content)); $overlay = "<div class='av-image-caption-overlay'>{$overlay_bg}<div class='av-image-caption-overlay-position'><div class='av-image-caption-overlay-center' {$style}>{$content}</div></div></div>"; $class .= " noHover "; if (empty($appearance)) { $appearance = "hover-deactivate"; } if ($appearance) { $class .= " av-overlay-" . $appearance; } } $markup_url = avia_markup_helper(array('context' => 'image_url', 'echo' => false, 'custom_markup' => $meta['custom_markup'])); $markup = avia_markup_helper(array('context' => 'image', 'echo' => false, 'custom_markup' => $meta['custom_markup'])); $output .= "<div class='avia-image-container {$class} " . $meta['el_class'] . " " . $this->class_by_arguments('align', $atts, true) . "' {$markup} >"; $output .= "<div class='avia-image-container-inner'>"; if ($link) { $output .= "<a href='{$link}' class='avia_image suppress-tooltip' {$blank}>{$overlay}<img class='avia_image ' src='{$src}' alt='{$alt}' title='{$title}' {$markup_url} /></a>"; } else { $output .= "{$overlay}<img class='avia_image suppress-tooltip' src='{$src}' alt='{$alt}' title='{$title}' {$markup_url} />"; } $output .= "</div>"; $output .= "</div>"; $output .= '<div class="hr hr-default"><span class="hr-inner "><span class="hr-inner-style"></span></span></div>'; } } return $output; }
function av_tab($atts, $content = "", $shortcodename = "") { $icon_el = $this->elements[2]['subelements'][2]; //last element is the icon container $chars = $icon_el['chars']; if (!is_array($chars)) { include $icon_el['chars']; } $output = $titleClass = $contentClass = $icon = ""; $tab_atts = shortcode_atts(array('title' => '', 'icon_select' => 'no', 'icon' => "1", 'custom_id' => ''), $atts); $display_char = isset($chars[$tab_atts['icon'] - 1]) ? $chars[$tab_atts['icon'] - 1] : $chars[0]; if (is_numeric(avia_sc_tab::$initial) && avia_sc_tab::$counter == avia_sc_tab::$initial) { $titleClass = "active_tab"; $contentClass = "active_tab_content"; } if (empty($tab_atts['title'])) { $tab_atts['title'] = avia_sc_toggle::$counter; } if ($tab_atts['icon_select'] == "yes") { $icon = "<span class='tab_icon avia-font-" . $icon_el['font'] . "'>{$display_char}</span>"; } if (empty($tab_atts['custom_id'])) { $tab_atts['custom_id'] = 'tab-id-' . avia_sc_tab::$tab_id++; } $output .= '<div data-fake-id="#' . $tab_atts['custom_id'] . '" class="tab ' . $titleClass . '">' . $icon . $tab_atts['title'] . '</div>' . "\n"; $output .= '<div id="' . $tab_atts['custom_id'] . '-container" class="tab_content ' . $contentClass . '" >' . "\n"; $output .= '<div class="tab_inner_content invers-color">' . "\n"; $output .= ShortcodeHelper::avia_apply_autop(ShortcodeHelper::avia_remove_autop($content)) . "\n"; $output .= '</div>' . "\n"; $output .= '</div>' . "\n"; avia_sc_tab::$counter++; 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 = "") { $custom_class = !empty($meta['custom_class']) ? $meta['custom_class'] : ""; return "<div class='avia_textblock {$custom_class}'>" . ShortcodeHelper::avia_apply_autop(ShortcodeHelper::avia_remove_autop($content)) . "</div>"; }
/** * 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_config['layout_container'] = "section"; avia_sc_section::$section_count++; $atts = shortcode_atts(array('src' => '', 'position' => 'top left', 'id' => '', 'myclass' => ''), $atts, $this->config['shortcode']); extract($atts); $output = ""; $class = "tab-body-content " . $color; $background = ""; 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; } // display class on front end if ($myclass != '') { $class = "tab-body-content " . $myclass . " " . $attach; } // end display class 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; } // this outputs our start tags $output .= "<div id='tab-content-" . avia_sc_section::$section_count . "' class='{$class} container_wrap " . avia_layout_class('main', false) . "'>"; //if the user uses the column shortcode without the layout builder make sure that paragraphs are applied to the text $content = empty($avia_config['conditionals']['is_builder_template']) ? ShortcodeHelper::avia_apply_autop(ShortcodeHelper::avia_remove_autop($content)) : ShortcodeHelper::avia_remove_autop($content, true); //Sarah these add the paralax section // $output .= avia_mynew_section($params); $output .= trim($content); unset($avia_config['layout_container']); $output .= '</div><!--sarahs end to parent tab section-->'; 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_button_full::$count++; $atts = shortcode_atts(array('label' => 'Click me', 'link' => '', 'link_target' => '', 'color' => 'theme-color', 'color_hover' => 'theme-color-subtle', 'custom_bg' => '#444444', 'custom_bg_hover' => '#444444', 'custom_font' => '#ffffff', 'position' => 'center', 'icon_select' => 'no', 'icon' => '', 'font' => '', 'icon_hover' => '', 'description_pos' => ''), $atts, $this->config['shortcode']); $display_char = av_icon($atts['icon'], $atts['font']); $style = "color:" . $atts['custom_font'] . "; "; $style_hover = ""; if ($atts['color'] == "custom") { $style .= "background-color:" . $atts['custom_bg'] . "; "; } if ($atts['color_hover'] == "custom") { $style_hover = "style='background-color:" . $atts['custom_bg_hover'] . "; '"; } $extraClass = $atts['icon_hover'] ? "av-icon-on-hover" : ""; $blank = strpos($atts['link_target'], '_blank') !== false ? ' target="_blank" ' : ""; $blank .= strpos($atts['link_target'], 'nofollow') !== false ? ' rel="nofollow" ' : ""; $link = AviaHelper::get_url($atts['link']); $link = $link == "http://" ? "" : $link; if ($style) { $style = "style='{$style}'"; } $content_html = ""; if ($content && $atts['description_pos'] == 'above') { $content_html .= "<div class='av-button-description av-button-description-above'>" . ShortcodeHelper::avia_apply_autop(ShortcodeHelper::avia_remove_autop($content)) . "</div>"; } if ('yes-left-icon' == $atts['icon_select']) { $content_html .= "<span class='avia_button_icon avia_button_icon_left ' {$display_char}></span>"; } $content_html .= "<span class='avia_iconbox_title' >" . $atts['label'] . "</span>"; if ('yes-right-icon' == $atts['icon_select']) { $content_html .= "<span class='avia_button_icon avia_button_icon_right' {$display_char}></span>"; } if ($content && $atts['description_pos'] == 'below') { $content_html .= "<div class='av-button-description av-button-description-below'>" . ShortcodeHelper::avia_apply_autop(ShortcodeHelper::avia_remove_autop($content)) . "</div>"; } $output = ""; $output .= "<a href='{$link}' class='avia-button avia-button-fullwidth {$extraClass} " . $this->class_by_arguments('icon_select, color', $atts, true) . "' {$blank} {$style} >"; $output .= $content_html; $output .= "<span class='avia_button_background avia-button avia-button-fullwidth avia-color-" . $atts['color_hover'] . "' {$style_hover}></span>"; $output .= "</a>"; $output = "<div class='avia-button-wrap avia-button-" . $atts['position'] . " " . $meta['el_class'] . "'>" . $output . "</div>"; $params['class'] = "main_color av-fullscreen-button avia-no-border-styling " . $meta['el_class']; $params['open_structure'] = false; $id = AviaHelper::save_string($atts['label'], '-'); $params['id'] = !empty($id) ? $id : "av-fullwidth-button-" . avia_sc_button_full::$count; $params['custom_markup'] = $meta['custom_markup']; //we dont need a closing structure if the element is the first one or if a previous fullwidth element was displayed before if ($meta['index'] == 0) { $params['close'] = false; } if (!empty($meta['siblings']['prev']['tag']) && in_array($meta['siblings']['prev']['tag'], AviaBuilder::$full_el_no_section)) { $params['close'] = false; } if (!ShortcodeHelper::is_top_level()) { return $output; } $button_html = $output; $output = avia_new_section($params); $output .= $button_html; $output .= avia_section_after_element_content($meta, 'after_fullwidth_button'); return $output; return $output; }
function av_testimonial_single($atts, $content = "", $shortcodename = "") { extract(shortcode_atts(array('src' => "", 'name' => "", 'subtitle' => "", 'link' => "", 'linktext' => ""), $atts)); $output = ""; $avatar = ""; $grid = avia_sc_testimonial::$style == 'grid' ? true : false; $class = avia_sc_testimonial::$columnClass . " avia-testimonial-row-" . avia_sc_testimonial::$rows . " "; //if(count($testimonials) <= $rows * $columns) $class.= " avia-testimonial-row-last "; if (avia_sc_testimonial::$counter == 1) { $class .= "avia-first-testimonial"; } if (avia_sc_testimonial::$counter == avia_sc_testimonial::$columns) { $class .= "avia-last-testimonial"; } if ($link && !$linktext) { $linktext = $link; } if (avia_sc_testimonial::$counter == 1) { $output .= "<div class ='avia-testimonial-row'>"; } //avatar if ($src) { $avatar = "<div class='avia-testimonial-image'>" . wp_get_attachment_image($src, 'thumbnail', false, array('alt' => esc_attr(strip_tags($name)))) . "</div>"; } //meta //final output $output .= "<div class='avia-testimonial {$class}'>"; if ($grid) { $output .= $avatar; } $output .= "<div class='avia-testimonial-content'>"; $output .= ShortcodeHelper::avia_apply_autop(ShortcodeHelper::avia_remove_autop($content)); $output .= "</div>"; $output .= "<div class='avia-testimonial-meta'><div class='avia-testimonial-arrow-wrap'><div class='avia-arrow'></div></div>"; if (!$grid) { $output .= $avatar; } $output .= "<div class='avia-testimonial-meta-mini'>"; if ($name) { $output .= "<strong class='avia-testimonial-name'>{$name}</strong>"; } if ($subtitle) { $output .= "<span class='avia-testimonial-subtitle'>{$subtitle}</span>"; } if ($link) { $output .= " – <a class='aviablank avia-testimonial-link' href='{$link}'>{$linktext}</a>"; } $output .= "</div>"; $output .= "</div>"; $output .= "</div>"; if (avia_sc_testimonial::$counter == avia_sc_testimonial::$columns) { $output .= "</div>"; } avia_sc_testimonial::$counter++; if (avia_sc_testimonial::$counter > avia_sc_testimonial::$columns) { avia_sc_testimonial::$counter = 1; avia_sc_testimonial::$rows++; } 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 = "") { $output = ""; $class = ""; $alt = ""; $title = ""; $atts = shortcode_atts(array('src' => '', 'animation' => 'no-animation', 'link' => '', 'attachment' => '', 'attachment_size' => '', 'target' => 'no', 'styling' => '', 'caption' => '', 'font_size' => '', 'appearance' => '', 'hover' => '', 'align' => 'center', 'overlay_opacity' => '0.4', 'overlay_color' => '#444444', 'overlay_text_color' => '#ffffff'), $atts, $this->config['shortcode']); extract($atts); if (!empty($attachment)) { $attachment_entry = get_post($attachment); if (!empty($attachment_entry)) { $alt = get_post_meta($attachment_entry->ID, '_wp_attachment_image_alt', true); $alt = !empty($alt) ? esc_attr($alt) : ''; $title = trim($attachment_entry->post_title) ? esc_attr($attachment_entry->post_title) : ""; 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 (!empty($src)) { $class = $animation == "no-animation" ? "" : "avia_animated_image avia_animate_when_almost_visible " . $animation; $class .= " av-styling-" . $styling . " " . $hover; if (is_numeric($src)) { //$output = wp_get_attachment_image($src,'large'); $output = wp_get_attachment_image($src, 'large', false, array('class' => "avia_image {$class} " . $this->class_by_arguments('align', $atts, true))); } else { $link = aviaHelper::get_url($link, $attachment); $blank = strpos($target, '_blank') !== false || $target == 'yes' ? ' target="_blank" ' : ""; $blank .= strpos($target, 'nofollow') !== false ? ' rel="nofollow" ' : ""; $overlay = ""; $style = ""; $style .= AviaHelper::style_string($atts, 'overlay_text_color', 'color'); if ($font_size) { // $style = "style='font-size: {$font_size}px;'"; $style .= AviaHelper::style_string($atts, 'font_size', 'font-size', 'px'); } $style = AviaHelper::style_string($style); if ($caption == "yes") { $caption_style = ""; $caption_style .= AviaHelper::style_string($atts, 'overlay_opacity', 'opacity'); $caption_style .= AviaHelper::style_string($atts, 'overlay_color', 'background-color'); $caption_style = AviaHelper::style_string($caption_style); $overlay_bg = "<div class='av-caption-image-overlay-bg' {$caption_style}></div>"; $content = ShortcodeHelper::avia_apply_autop(ShortcodeHelper::avia_remove_autop($content)); $overlay = "<div class='av-image-caption-overlay'>{$overlay_bg}<div class='av-image-caption-overlay-position'><div class='av-image-caption-overlay-center' {$style}>{$content}</div></div></div>"; $class .= " noHover "; if (empty($appearance)) { $appearance = "hover-deactivate"; } if ($appearance) { $class .= " av-overlay-" . $appearance; } } $markup_url = avia_markup_helper(array('context' => 'image_url', 'echo' => false, 'custom_markup' => $meta['custom_markup'])); $markup = avia_markup_helper(array('context' => 'image', 'echo' => false, 'custom_markup' => $meta['custom_markup'])); $output .= "<div class='avia-image-container {$class} " . $meta['el_class'] . " " . $this->class_by_arguments('align', $atts, true) . "' {$markup} >"; $output .= "<div class='avia-image-container-inner'>"; if ($link) { $output .= "<a href='{$link}' class='avia_image' {$blank}>{$overlay}<img class='avia_image ' src='{$src}' alt='{$alt}' title='{$title}' {$markup_url} /></a>"; } else { $output .= "{$overlay}<img class='avia_image ' src='{$src}' alt='{$alt}' title='{$title}' {$markup_url} />"; } $output .= "</div>"; $output .= "</div>"; } } return $output; }
function av_iconlist_item($atts, $content = "", $shortcodename = "") { $atts = shortcode_atts(array('title' => '', 'link' => '', 'icon' => '', 'font' => '', 'linkelement' => '', 'linktarget' => '', 'custom_markup' => ''), $atts, 'av_iconlist_item'); $display_char = av_icon($atts['icon'], $atts['font']); $display_char_wrapper = array(); $blank = strpos($atts['linktarget'], '_blank') !== false || $atts['linktarget'] == 'yes' ? ' target="_blank" ' : ""; $blank .= strpos($atts['linktarget'], 'nofollow') !== false ? ' rel="nofollow" ' : ""; if (!empty($atts['link'])) { $atts['link'] = aviaHelper::get_url($atts['link']); if (!empty($atts['link'])) { $linktitle = $atts['title']; switch ($atts['linkelement']) { case 'both': $atts['title'] = "<a href='{$atts['link']}' title='" . esc_attr($linktitle) . "'{$blank}>{$linktitle}</a>"; $display_char_wrapper['start'] = "a href='{$atts['link']}' title='" . esc_attr($linktitle) . "' {$blank}"; $display_char_wrapper['end'] = 'a'; break; case 'only_icon': $display_char_wrapper['start'] = "a href='{$atts['link']}' title='" . esc_attr($linktitle) . "' {$blank}"; $display_char_wrapper['end'] = 'a'; break; default: $atts['title'] = "<a href='{$atts['link']}' title='" . esc_attr($linktitle) . "'{$blank}>{$linktitle}</a>"; $display_char_wrapper['start'] = 'div'; $display_char_wrapper['end'] = 'div'; break; } } } if (empty($display_char_wrapper)) { $display_char_wrapper['start'] = 'div'; $display_char_wrapper['end'] = 'div'; } $contentClass = ""; if (trim($content) == "") { $contentClass = "av-iconlist-empty"; } $output = ""; $output .= "<li>"; $output .= "<{$display_char_wrapper['start']} {$this->icon_html_styling} class='iconlist_icon avia-font-" . $atts['font'] . "'><span class='iconlist-char' {$display_char}></span></{$display_char_wrapper['end']}>"; $output .= '<article class="article-icon-entry ' . $contentClass . '" ' . avia_markup_helper(array('context' => 'entry', 'echo' => false, 'custom_markup' => $atts['custom_markup'])) . '>'; $output .= "<div class='iconlist_content_wrap'>"; $output .= '<header class="entry-content-header">'; $markup = avia_markup_helper(array('context' => 'entry_title', 'echo' => false, 'custom_markup' => $atts['custom_markup'])); $output .= "<h4 class='iconlist_title' {$markup} {$this->title_styling}>" . $atts['title'] . "</h4>"; $output .= '</header>'; $markup = avia_markup_helper(array('context' => 'entry_content', 'echo' => false, 'custom_markup' => $atts['custom_markup'])); $output .= "<div class='iconlist_content {$this->content_class}' {$markup} {$this->content_styling}>" . ShortcodeHelper::avia_apply_autop(ShortcodeHelper::avia_remove_autop($content)) . "</div>"; $output .= "</div>"; $output .= '<footer class="entry-footer"></footer>'; $output .= '</article>'; $output .= "<div class='iconlist-timeline'></div>"; $output .= "</li>"; return $output; }
function av_tab($atts, $content = "", $shortcodename = "") { $output = $titleClass = $contentClass = $icon = ""; $tab_atts = shortcode_atts(array('title' => '', 'icon_select' => 'no', 'icon' => "", 'custom_id' => '', 'font' => '', 'custom_markup' => ''), $atts, 'av_tab'); $display_char = av_icon($tab_atts['icon'], $tab_atts['font']); if (is_numeric(avia_sc_tab::$initial) && avia_sc_tab::$counter == avia_sc_tab::$initial) { $titleClass = "active_tab"; $contentClass = "active_tab_content"; } if (empty($tab_atts['title'])) { $tab_atts['title'] = avia_sc_toggle::$counter; } if ($tab_atts['icon_select'] == "yes") { $icon = "<span class='tab_icon' {$display_char}></span>"; } if (empty($tab_atts['custom_id'])) { $tab_atts['custom_id'] = 'tab-id-' . avia_sc_tab::$tab_id++; } $markup_tab = avia_markup_helper(array('context' => 'entry', 'echo' => false, 'custom_markup' => $tab_atts['custom_markup'])); $markup_title = avia_markup_helper(array('context' => 'entry_title', 'echo' => false, 'custom_markup' => $tab_atts['custom_markup'])); $markup_text = avia_markup_helper(array('context' => 'entry_content', 'echo' => false, 'custom_markup' => $tab_atts['custom_markup'])); $output .= '<section class="av_tab_section" ' . $markup_tab . '>'; $output .= ' <div data-fake-id="#' . $tab_atts['custom_id'] . '" class="tab ' . $titleClass . '" ' . $markup_title . '>' . $icon . $tab_atts['title'] . '</div>' . "\n"; $output .= ' <div id="' . $tab_atts['custom_id'] . '-container" class="tab_content ' . $contentClass . '">' . "\n"; $output .= ' <div class="tab_inner_content invers-color" ' . $markup_text . '>' . "\n"; $output .= ShortcodeHelper::avia_apply_autop(ShortcodeHelper::avia_remove_autop($content)) . "\n"; $output .= ' </div>' . "\n"; $output .= ' </div>' . "\n"; $output .= '</section>' . "\n"; avia_sc_tab::$counter++; return $output; }
public function html() { $output = ""; $counter = 0; avia_content_slider::$slider++; if (empty($this->config['content'])) { return $output; } //$html .= empty($this->subslides) ? $this->default_slide() : $this->advanced_slide(); extract($this->config); $extraClass = 'first'; $grid = 'one_third'; $slide_loop_count = 1; $loop_counter = 1; $total = $columns % 2 ? "odd" : "even"; $heading = !empty($this->config['heading']) ? '<h3>' . $this->config['heading'] . '</h3>' : " "; $slide_count = count($content); switch ($columns) { case "1": $grid = 'av_fullwidth'; break; case "2": $grid = 'av_one_half'; break; case "3": $grid = 'av_one_third'; break; case "4": $grid = 'av_one_fourth'; break; case "5": $grid = 'av_one_fifth'; break; case "6": $grid = 'av_one_sixth'; break; } $data = AviaHelper::create_data_string(array('autoplay' => $autoplay, 'interval' => $interval, 'animation' => $animation, 'show_slide_delay' => 30)); $thumb_fallback = ""; $output .= "<div {$data} class='avia-content-slider-element-container avia-content-slider-element-{$type} avia-content-slider avia-smallarrow-slider avia-content-{$type}-active avia-content-slider" . avia_content_slider::$slider . " avia-content-slider-{$total} {$class}' >"; $heading_class = ''; if ($navigation == 'no') { $heading_class .= ' no-content-slider-navigation '; } if ($heading == ' ') { $heading_class .= ' no-content-slider-heading '; } $output .= "<div class='avia-smallarrow-slider-heading {$heading_class}'>"; $output .= "<div class='new-special-heading'>" . $heading . "</div>"; if ($slide_count > $columns && $type == 'slider' && $navigation != 'no') { if ($navigation == 'dots') { $output .= $this->slide_navigation_dots(); } if ($navigation == 'arrows') { $output .= $this->slide_navigation_arrows(); } } $output .= "</div>"; $output .= "<div class='avia-content-slider-inner'>"; foreach ($content as $key => $value) { $link = $linktarget = ""; extract($value['attr']); $link = aviaHelper::get_url($link); $blank = strpos($linktarget, '_blank') !== false || $linktarget == 'yes' ? ' target="_blank" ' : ""; $blank .= strpos($linktarget, 'nofollow') !== false ? ' rel="nofollow" ' : ""; $parity = $loop_counter % 2 ? 'odd' : 'even'; $last = $slide_count == $slide_loop_count ? " post-entry-last " : ""; $post_class = "post-entry slide-entry-overview slide-loop-{$slide_loop_count} slide-parity-{$parity} {$last}"; if ($loop_counter == 1) { $output .= "<div class='slide-entry-wrap'>"; } $markup = avia_markup_helper(array('context' => 'entry', 'echo' => false)); $output .= "<section class='slide-entry flex_column {$post_class} {$grid} {$extraClass}' {$markup}>"; $markup = avia_markup_helper(array('context' => 'entry_title', 'echo' => false)); $output .= !empty($title) ? "<h3 class='slide-entry-title entry-title' {$markup}>" : ''; $output .= !empty($link) && !empty($title) ? "<a href='{$link}' {$blank} title='" . esc_attr($title) . "'>" . $title . "</a>" : $title; $output .= !empty($title) ? '</h3>' : ''; $markup = avia_markup_helper(array('context' => 'entry_content', 'echo' => false)); $output .= !empty($value['content']) ? "<div class='slide-entry-excerpt entry-content' {$markup}>" . ShortcodeHelper::avia_apply_autop(ShortcodeHelper::avia_remove_autop($value['content'])) . "</div>" : ""; $output .= '</section>'; $loop_counter++; $slide_loop_count++; $extraClass = ""; if ($loop_counter > $columns) { $loop_counter = 1; $extraClass = 'first'; } if ($loop_counter == 1 || !empty($last)) { $output .= "</div>"; } } $output .= "</div>"; $output .= "</div>"; return $output; }
function helper_array2form_fields($base) { $form_fields = array(); $labels = array(); if (is_array($base)) { foreach ($base as $key => $field) { if (!empty($field['attr']['disabled']) && empty($field['attr']['check']) && $field['attr']['type'] != "button") { continue; } switch ($field['attr']['type']) { case "dropdown": $field['attr']['type'] = "select"; break; case "date": $field['attr']['type'] = "datepicker"; break; case "radio": $field['attr']['type'] = "select"; break; case "button": $field['attr']['type'] = "button"; break; case "number": $field['attr']['type'] = "number"; break; default: $field['attr']['type'] = 'text'; } $sanizited_id = $field['attr']['id']; $labels[$sanizited_id] = empty($labels[$sanizited_id]) ? 1 : $labels[$sanizited_id] + 1; if ($labels[$sanizited_id] > 1) { $sanizited_id = $sanizited_id . '_' . $labels[$sanizited_id]; } $form_fields[$sanizited_id] = $field['attr']; if (!empty($field['content'])) { $form_fields[$sanizited_id]['content'] = ShortcodeHelper::avia_apply_autop($field['content']); } } } return $form_fields; }
/** * 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_config['current_column'] = $shortcodename; $first = ''; if (isset($atts[0]) && trim($atts[0]) == 'first') { $first = 'first'; } $atts = shortcode_atts(array('padding' => '', 'background_color' => '', 'background_position' => '', 'background_repeat' => '', 'background_attachment' => '', 'fetch_image' => '', 'attachment_size' => '', 'attachment' => 'scroll', 'radius' => '', 'space' => '', 'border' => '', 'border_color' => '', 'border_style' => 'solid', 'margin' => '', 'custom_margin' => '', 'min_height' => '', 'vertical_alignment' => 'av-align-top'), $atts, $this->config['shortcode']); if ($first) { avia_sc_columns::$first_atts = $atts; } $extraClass = ""; $outer_style = ""; $inner_style = ""; $margin_style = ""; $output = ""; if (!empty($atts['attachment'])) { $src = wp_get_attachment_image_src($atts['attachment'], $atts['attachment_size']); if (!empty($src[0])) { $atts['fetch_image'] = $src[0]; } } if ($atts['background_repeat'] == "stretch") { $extraClass .= " avia-full-stretch"; } if (!empty(avia_sc_columns::$first_atts['space'])) { $extraClass .= " " . avia_sc_columns::$first_atts['space']; } if (!empty(avia_sc_columns::$first_atts['min_height'])) { $extraClass .= " flex_column_table_cell"; $extraClass .= " " . avia_sc_columns::$first_atts['min_height'] . " " . avia_sc_columns::$first_atts['vertical_alignment']; } else { $extraClass .= " flex_column_div"; } if (!empty(avia_sc_columns::$first_atts['custom_margin'])) { $explode_margin = explode(',', avia_sc_columns::$first_atts['margin']); if (count($explode_margin) <= 1) { $explode_margin[1] = $explode_margin[0]; } $atts['margin-top'] = $explode_margin[0]; $atts['margin-bottom'] = $explode_margin[1]; $margins = ""; $margins .= AviaHelper::style_string($atts, 'margin-top'); $margins .= AviaHelper::style_string($atts, 'margin-bottom'); if (!empty(avia_sc_columns::$first_atts['min_height'])) { $margin_style = AviaHelper::style_string($margins); } else { $outer_style .= $margins; } } $explode_padding = explode(',', $atts['padding']); if (count($explode_padding) > 1) { $atts['padding'] = ""; foreach ($explode_padding as $value) { if (empty($value)) { $value = "0"; } $atts['padding'] .= $value . " "; } } if ($atts['padding'] == "0px" || $atts['padding'] == "0" || $atts['padding'] == "0%") { $extraClass .= " av-zero-column-padding"; $atts['padding'] = ""; } $explode_radius = explode(',', $atts['radius']); if (count($explode_radius) > 1) { $atts['radius'] = ""; foreach ($explode_radius as $value) { if (empty($value)) { $value = "0"; } $atts['radius'] .= $value . " "; } } if ($atts['padding'] == "0px" || $atts['padding'] == "0" || $atts['padding'] == "0%") { $extraClass .= " av-zero-column-padding"; $atts['padding'] = ""; } if (!empty($atts['fetch_image'])) { $outer_style .= AviaHelper::style_string($atts, 'fetch_image', 'background-image'); $outer_style .= AviaHelper::style_string($atts, 'background_position', 'background-position'); $outer_style .= AviaHelper::style_string($atts, 'background_repeat', 'background-repeat'); $outer_style .= AviaHelper::style_string($atts, 'background_attachment', 'background-attachment'); } if (!empty($atts['border'])) { $outer_style .= AviaHelper::style_string($atts, 'border', 'border-width', 'px'); $outer_style .= AviaHelper::style_string($atts, 'border_color', 'border-color'); $outer_style .= AviaHelper::style_string($atts, 'border_style', 'border-style'); } $outer_style .= AviaHelper::style_string($atts, 'padding'); $outer_style .= AviaHelper::style_string($atts, 'background_color', 'background-color'); $outer_style .= AviaHelper::style_string($atts, 'radius', 'border-radius'); $outer_style = AviaHelper::style_string($outer_style); if ($first) { avia_sc_columns::$calculated_size = 0; if (!empty($meta['siblings']['prev']['tag']) && in_array($meta['siblings']['prev']['tag'], array('av_one_full', 'av_one_half', 'av_one_third', 'av_two_third', 'av_three_fourth', 'av_one_fourth', 'av_one_fifth', 'av_textblock'))) { avia_sc_columns::$extraClass = "column-top-margin"; } else { avia_sc_columns::$extraClass = ""; } } if (!empty(avia_sc_columns::$first_atts['min_height']) && avia_sc_columns::$calculated_size == 0) { $output .= "<div class='flex_column_table " . avia_sc_columns::$first_atts['min_height'] . "-flextable' {$margin_style}>"; } if (!$first && empty(avia_sc_columns::$first_atts['space']) && !empty(avia_sc_columns::$first_atts['min_height'])) { $output .= "<div class='av-flex-placeholder'></div>"; } avia_sc_columns::$calculated_size += avia_sc_columns::$size_array[$this->config['shortcode']]; $output .= '<div class="flex_column ' . $shortcodename . ' ' . $extraClass . ' ' . $first . ' ' . $meta['el_class'] . ' ' . avia_sc_columns::$extraClass . '" ' . $outer_style . '>'; //if the user uses the column shortcode without the layout builder make sure that paragraphs are applied to the text $content = empty($avia_config['conditionals']['is_builder_template']) ? ShortcodeHelper::avia_apply_autop(ShortcodeHelper::avia_remove_autop($content)) : ShortcodeHelper::avia_remove_autop($content, true); $output .= trim($content) . '</div>'; $force_close = false; if (isset($meta['siblings']) && isset($meta['siblings']['next']) && isset($meta['siblings']['next']['tag'])) { if (!array_key_exists($meta['siblings']['next']['tag'], avia_sc_columns::$size_array)) { $force_close = true; } } if (!empty(avia_sc_columns::$first_atts['min_height']) && (avia_sc_columns::$calculated_size >= 0.95 || $force_close)) { $output .= "</div><!--close column table wrapper. Autoclose: {$force_close} -->"; avia_sc_columns::$calculated_size = 0; } unset($avia_config['current_column']); 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 = "") { global $avia_config; $avia_config['layout_container'] = "section"; avia_sc_section::$section_count++; $atts = shortcode_atts(array('src' => '', 'position' => 'top left', 'repeat' => 'no-repeat', 'attach' => 'scroll', 'color' => 'main_color', 'custom_bg' => '', 'id' => '', 'myclass' => '', 'video' => '', 'video_ratio' => '16:9', 'video_mobile_disabled' => '', 'custom_markup' => '', 'attachment' => '', 'attachment_size' => '', 'bottom_border' => ''), $atts, $this->config['shortcode']); extract($atts); $output = ""; $class = "obey-color-section avia-section " . $color . " avia-section-" . $padding . " avia-" . $shadow . " avia-bg-style-" . $attach; $background = ""; 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; } // display class on front end if ($myclass != '') { $class = "obey-color-section " . $myclass . " avia-section " . $color . " avia-section-" . $padding . " avia-" . $shadow . " avia-bg-style-" . $attach; } // end display class 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; } // background color or image /*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 {$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['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; } } // end background color or image // this output adds the obeysection $output .= "<div id='{$id}' class='{$class} container_wrap " . avia_layout_class('main', false) . "' {$bg} {$data} {$style} {$background}>"; //if the user uses the column shortcode without the layout builder make sure that paragraphs are applied to the text $content = empty($avia_config['conditionals']['is_builder_template']) ? ShortcodeHelper::avia_apply_autop(ShortcodeHelper::avia_remove_autop($content)) : ShortcodeHelper::avia_remove_autop($content, true); //Sarah these add the paralax section $output .= avia_mynew_section($params); $output .= '<div class="container position-reg">' . trim($content) . '</div></div><!-- end obey container -->'; unset($avia_config['layout_container']); return $output; }
function av_testimonial_single($atts, $content = "", $shortcodename = "") { extract(shortcode_atts(array('src' => "", 'name' => "", 'subtitle' => "", 'link' => "", 'linktext' => "", 'custom_markup' => ''), $atts, 'av_testimonial_single')); $output = ""; $avatar = ""; $grid = avia_sc_testimonial::$style == 'grid' ? true : false; $class = avia_sc_testimonial::$columnClass . " avia-testimonial-row-" . avia_sc_testimonial::$rows . " "; //if(count($testimonials) <= $rows * $columns) $class.= " avia-testimonial-row-last "; if (avia_sc_testimonial::$counter == 1) { $class .= "avia-first-testimonial"; } if (avia_sc_testimonial::$counter == avia_sc_testimonial::$columns) { $class .= "avia-last-testimonial"; } if ($link && !$linktext) { $linktext = $link; } if ($link == 'http://') { $link = ""; } if (avia_sc_testimonial::$counter == 1) { $output .= "<section class ='avia-testimonial-row'>"; } //avatar size filter $avatar_size = apply_filters('avf_testimonials_avatar_size', 'square', $src, $class); //avatar $markup = avia_markup_helper(array('context' => 'single_image', 'echo' => false, 'custom_markup' => $custom_markup)); if ($src) { $avatar = "<div class='avia-testimonial-image' {$markup}>" . wp_get_attachment_image($src, $avatar_size, false, array('alt' => esc_attr(strip_tags($name)))) . "</div>"; } //meta $markup_text = avia_markup_helper(array('context' => 'entry', 'echo' => false, 'custom_markup' => $custom_markup)); $markup_name = avia_markup_helper(array('context' => 'name', 'echo' => false, 'custom_markup' => $custom_markup)); $markup_job = avia_markup_helper(array('context' => 'job', 'echo' => false, 'custom_markup' => $custom_markup)); if (strstr($link, '@')) { $markup_url = avia_markup_helper(array('context' => 'email', 'echo' => false, 'custom_markup' => $custom_markup)); } else { $markup_url = avia_markup_helper(array('context' => 'url', 'echo' => false, 'custom_markup' => $custom_markup)); } //final output $markup = avia_markup_helper(array('context' => 'person', 'echo' => false, 'custom_markup' => $custom_markup)); $output .= "<div class='avia-testimonial {$class}' {$markup}>"; $output .= "<div class='avia-testimonial_inner'>"; if ($grid) { $output .= $avatar; } $output .= "<div class='avia-testimonial-content {$this->content_class}' {$this->content_styling} {$markup_text}>"; $output .= ShortcodeHelper::avia_apply_autop(ShortcodeHelper::avia_remove_autop($content)); $output .= "</div>"; $output .= "<div class='avia-testimonial-meta'><div class='avia-testimonial-arrow-wrap'><div class='avia-arrow'></div></div>"; if (!$grid) { $output .= $avatar; } $output .= "<div class='avia-testimonial-meta-mini'>"; if ($name) { $output .= "<strong class='avia-testimonial-name' {$this->title_styling} {$markup_name}>{$name}</strong>"; } if ($subtitle) { $output .= "<span class='avia-testimonial-subtitle {$this->subtitle_class}' {$this->title_styling} {$markup_job}>{$subtitle}</span>"; } if ($link) { $output .= "<span class='hidden avia-testimonial-markup-link' {$markup_url}>{$link}</span>"; } if ($link) { $output .= " – <a class='aviablank avia-testimonial-link' href='{$link}' >{$linktext}</a>"; } $output .= "</div>"; $output .= "</div>"; $output .= "</div>"; $output .= "</div>"; if (avia_sc_testimonial::$counter == avia_sc_testimonial::$columns) { $output .= "</section>"; } avia_sc_testimonial::$counter++; if (avia_sc_testimonial::$counter > avia_sc_testimonial::$columns) { avia_sc_testimonial::$counter = 1; avia_sc_testimonial::$rows++; } 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 = "") { $atts = shortcode_atts(array('title' => '', 'color' => 'green', 'border' => '', 'custom_bg' => '#444444', 'custom_font' => '#ffffff', 'size' => 'large', 'icon_select' => 'yes', 'icon' => '', 'font' => ''), $atts, $this->config['shortcode']); $display_char = av_icon($atts['icon'], $atts['font']); $output = ""; $style = ""; if ($atts['color'] == "custom") { $style .= "style='background-color:" . $atts['custom_bg'] . "; color:" . $atts['custom_font'] . "; '"; } $output .= "<div {$style} class='avia_message_box " . $this->class_by_arguments('color, size, icon_select, border', $atts, true) . $meta['el_class'] . "'>"; if ($atts['title']) { $output .= "<span class='avia_message_box_title' >" . $atts['title'] . "</span>"; } $output .= "<div class='avia_message_box_content' >"; if ($atts['icon_select'] == 'yes') { $output .= "<span class='avia_message_box_icon' {$display_char}></span>"; } $output .= ShortcodeHelper::avia_apply_autop(ShortcodeHelper::avia_remove_autop($content)) . "</div>"; $output .= "</div>"; 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 = "") { global $avia_config; $atts = shortcode_atts(array('vertical_align' => '', 'padding' => '', 'color' => '', 'background_color' => '', 'background_position' => '', 'background_repeat' => '', 'background_attachment' => '', 'fetch_image' => '', 'attachment_size' => '', 'attachment' => ''), $atts, $this->config['shortcode']); $extraClass = ""; $outer_style = ""; $inner_style = ""; if (!empty(avia_sc_cell::$attr['min_height'])) { $min = (int) avia_sc_cell::$attr['min_height']; $outer_style = "height:{$min}px; min-height:{$min}px;"; } if (!empty($atts['attachment'])) { $src = wp_get_attachment_image_src($atts['attachment'], $atts['attachment_size']); if (!empty($src[0])) { $atts['fetch_image'] = $src[0]; } } if (!empty($atts['color'])) { $extraClass .= "av_inherit_color"; } if ($atts['background_repeat'] == "stretch") { $extraClass .= "avia-full-stretch"; } $explode_padding = explode(',', $atts['padding']); if (count($explode_padding) > 1) { $atts['padding'] = ""; foreach ($explode_padding as $value) { if (empty($value)) { $value = "0"; } $atts['padding'] .= $value . " "; } } if (!empty($atts['fetch_image'])) { $outer_style .= $this->style_string($atts, 'fetch_image', 'background-image'); $outer_style .= $this->style_string($atts, 'background_position', 'background-position'); $outer_style .= $this->style_string($atts, 'background_repeat', 'background-repeat'); $outer_style .= $this->style_string($atts, 'background_attachment', 'background-attachment'); } $outer_style .= $this->style_string($atts, 'vertical_align', 'vertical-align'); $outer_style .= $this->style_string($atts, 'padding'); $outer_style .= $this->style_string($atts, 'background_color', 'background-color'); $shortcodename = str_replace('av_cell_', 'av_', $shortcodename); $avia_config['current_column'] = $shortcodename; if (!empty($outer_style)) { $outer_style = "style='" . $outer_style . "'"; } if (!empty($inner_style)) { $inner_style = "style='" . $inner_style . "'"; } $output = '<div class="flex_cell no_margin ' . $shortcodename . ' ' . $meta['el_class'] . ' ' . $extraClass . ' ' . avia_sc_cell::$extraClass . '" ' . $outer_style . '>'; $output .= "<div class='flex_cell_inner' {$inner_style}>"; //if the user uses the column shortcode without the layout builder make sure that paragraphs are applied to the text $content = empty($avia_config['conditionals']['is_builder_template']) ? ShortcodeHelper::avia_apply_autop(ShortcodeHelper::avia_remove_autop($content)) : ShortcodeHelper::avia_remove_autop($content, true); $output .= $content . '</div>'; $output .= '</div>'; unset($avia_config['current_column']); return $output; }
function add_fallback_tooltip($hotspot, $counter) { $content = $hotspot['content']; if (empty($content)) { return; } $output = ""; $output .= "<div class='av-hotspot-fallback-tooltip'>"; $output .= "<div class='av-hotspot-fallback-tooltip-count'>"; $output .= $counter; $output .= "<div class='avia-arrow'></div></div>"; $output .= "<div class='av-hotspot-fallback-tooltip-inner clearfix'>"; $output .= ShortcodeHelper::avia_apply_autop($content); $output .= "</div>"; $output .= "</div>"; 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 = "") { extract(shortcode_atts(array('title' => 'Title', 'icon' => 'ue800', 'position' => 'left', 'link' => '', 'linktarget' => 'no', 'linkelement' => '', 'font' => '', 'boxed' => '', 'color' => '', 'custom_bg' => '', 'custom_border' => '', 'custom_font' => '', 'font_color' => "", 'custom_title' => '', 'custom_content' => ''), $atts, $this->config['shortcode'])); $display_char = av_icon($icon, $font); $display_char_wrapper = array(); if ($position == 'top' && empty($boxed)) { $position .= " main_color"; } if ($position != 'top') { $boxed = ""; } $blank = strpos($linktarget, '_blank') !== false || $linktarget == 'yes' ? ' target="_blank" ' : ""; $blank .= strpos($linktarget, 'nofollow') !== false ? ' rel="nofollow" ' : ""; $link = aviaHelper::get_url($link); if (!empty($link)) { $linktitle = $title; switch ($linkelement) { case 'both': $title = "<a href='{$link}' title='" . esc_attr($linktitle) . "' {$blank}>{$linktitle}</a>"; $display_char_wrapper['start'] = "a href='{$link}' title='" . esc_attr($linktitle) . "' {$blank}"; $display_char_wrapper['end'] = 'a'; break; case 'only_icon': $display_char_wrapper['start'] = "a href='{$link}' title='" . esc_attr($linktitle) . "' {$blank}"; $display_char_wrapper['end'] = 'a'; break; default: $title = "<a href='{$link}' title='" . esc_attr($linktitle) . "' {$blank} >{$linktitle}</a>"; $display_char_wrapper['start'] = 'div'; $display_char_wrapper['end'] = 'div'; break; } } if (empty($display_char_wrapper)) { $display_char_wrapper['start'] = 'div'; $display_char_wrapper['end'] = 'div'; } $icon_html_styling = ""; $title_styling = ""; $content_styling = ""; $content_class = ""; if ($color == "custom") { $icon_html_styling .= !empty($custom_bg) ? "background-color:{$custom_bg}; " : ""; $icon_html_styling .= !empty($custom_border) ? "border:1px solid {$custom_border}; " : ""; $icon_html_styling .= !empty($custom_font) ? "color:{$custom_font}; " : ""; if ($icon_html_styling) { $icon_html_styling = " style='{$icon_html_styling}'"; } } if ($font_color == "custom") { $title_styling .= !empty($custom_title) ? "color:{$custom_title}; " : ""; $content_styling .= !empty($custom_content) ? "color:{$custom_content}; " : ""; if ($title_styling) { $title_styling = " style='{$title_styling}'"; } if ($content_styling) { $content_styling = " style='{$content_styling}'"; $content_class = "av_inherit_color"; } } $icon_html = '<' . $display_char_wrapper['start'] . ' class="iconbox_icon heading-color" ' . $display_char . ' ' . $icon_html_styling . ' ></' . $display_char_wrapper['end'] . '>'; // add blockquotes to the content $markup = avia_markup_helper(array('context' => 'entry', 'echo' => false, 'custom_markup' => $meta['custom_markup'])); $output = '<article class="iconbox iconbox_' . $position . ' ' . $boxed . ' ' . $meta['el_class'] . '" ' . $markup . '>'; if ($position == 'left_content' || $position == 'right_content') { $output .= $icon_html; $icon_html = ""; } $output .= '<div class="iconbox_content">'; $output .= '<header class="entry-content-header">'; $output .= $icon_html; $markup = avia_markup_helper(array('context' => 'entry_title', 'echo' => false, 'custom_markup' => $meta['custom_markup'])); $output .= "<h3 class='iconbox_content_title' {$markup} {$title_styling}>" . $title . "</h3>"; $output .= '</header>'; $markup = avia_markup_helper(array('context' => 'entry_content', 'echo' => false, 'custom_markup' => $meta['custom_markup'])); $output .= "<div class='iconbox_content_container {$content_class}' {$markup} {$content_styling}>"; $output .= ShortcodeHelper::avia_apply_autop(ShortcodeHelper::avia_remove_autop($content)); $output .= '</div>'; $output .= '</div>'; $output .= '<footer class="entry-footer"></footer>'; $output .= '</article>'; 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 = "") { global $avia_config; $avia_config['current_column'] = $shortcodename; $first = ''; if (isset($atts[0]) && trim($atts[0]) == 'first') { $first = 'first'; } if ($first) { if (!empty($meta['siblings']['prev']['tag']) && in_array($meta['siblings']['prev']['tag'], array('av_one_full', 'av_one_half', 'av_one_third', 'av_two_third', 'av_three_fourth', 'av_one_fourth', 'av_one_fifth', 'av_textblock'))) { avia_sc_columns::$extraClass = "column-top-margin"; } else { avia_sc_columns::$extraClass = ""; } } $output = '<div class="flex_column ' . $shortcodename . ' ' . $first . ' ' . $meta['el_class'] . ' ' . avia_sc_columns::$extraClass . '">'; //if the user uses the column shortcode without the layout builder make sure that paragraphs are applied to the text $content = empty($avia_config['conditionals']['is_builder_template']) ? ShortcodeHelper::avia_apply_autop(ShortcodeHelper::avia_remove_autop($content)) : ShortcodeHelper::avia_remove_autop($content, true); $output .= $content . '</div>'; unset($avia_config['current_column']); return $output; }
private function advanced_slide() { $html = ""; $counter = 0; foreach ($this->id_array as $id) { if (isset($this->slides[$id])) { $slide = $this->slides[$id]; $meta = array_merge(array('content' => $this->subslides[$slide->ID]['content'], 'title' => '', 'link' => '', 'link_target' => '', 'position' => 'center center', 'caption_pos' => 'capt-bottom capt-left', 'link_apply' => '', 'button_label' => '', 'button_color' => 'light'), $this->subslides[$slide->ID]['attr']); extract($meta); //fetch image and link $counter++; $img = wp_get_attachment_image_src($slide->ID, $this->config['size']); $link = aviaHelper::get_url($link, $slide->ID); $link_target = !empty($link_target) ? " target='_blank' " : ""; $tags = !empty($link) ? array("a href='{$link}'{$link_target}", 'a') : array('div', 'div'); $caption = ""; $button_html = ""; //if we got a CTA button apply the link to the button istead of the slide if ($link_apply == 'button') { $button_html .= "<" . $tags[0] . " class='avia-slideshow-button avia-button-{$button_color}' data-duration='800' data-easing='easeInOutQuad'>"; $button_html .= $button_label; $button_html .= "</" . $tags[1] . ">"; $tags = array('div', 'div'); } //check if we got a caption if (trim($title) != "") { $title = "<h2 class='avia-caption-title'>" . trim(apply_filters('avf_slideshow_title', $title)) . "</h2>"; } if (trim($content) != "") { $content = "<div class='avia-caption-content'>" . ShortcodeHelper::avia_apply_autop(ShortcodeHelper::avia_remove_autop(trim($content))) . "</div>"; } if (trim($title . $content . $button_html) != "") { if (trim($title) != "" && trim($button_html) != "" && trim($content) == "") { $content = "<br/>"; } if ($this->config['handle'] == 'av_slideshow_full' || $this->config['handle'] == 'av_fullscreen') { $caption .= '<div class = "caption_fullwidth ' . $caption_pos . '">'; $caption .= '<div class = "container caption_container">'; $caption .= '<div class = "slideshow_caption">'; $caption .= '<div class = "slideshow_inner_caption">'; $caption .= '<div class = "slideshow_align_caption">'; $caption .= $title; $caption .= $content; $caption .= $button_html; $caption .= '</div>'; $caption .= '</div>'; $caption .= '</div>'; $caption .= '</div>'; $caption .= '</div>'; } else { $caption = '<div class="avia-caption"><div class="avia-inner-caption">' . $title . $content . "</div></div>"; } } $linkalt = get_post_meta($slide->ID, '_wp_attachment_image_alt', true); $linkalt = !empty($linkalt) ? esc_attr($linkalt) : ''; $linktitle = trim($slide->post_title) ? esc_attr($slide->post_title) : ""; $linkdescription = trim($slide->post_content) && empty($link) ? "title='" . esc_attr($slide->post_content) . "'" : ""; $bg_slider_style = $this->config['bg_slider'] == "true" ? "style='background-position:{$position};'" : ""; $html .= "<li {$bg_slider_style} class='slide-{$counter} slide-id-" . $slide->ID . "' data-img-url='" . $img[0] . "'>"; $html .= "<" . $tags[0] . " data-rel='slideshow-" . avia_slideshow::$slider . "' class='avia-slide-wrap' {$linkdescription} >{$caption}"; if ($this->config['bg_slider'] != "true") { $html .= "<img src='" . $img[0] . "' title='" . $linktitle . "' alt='" . $linkalt . "' />"; } $html .= "</" . $tags[1] . ">"; $html .= "</li>"; } else { $this->slide_count--; } } return $html; }