Ejemplo n.º 1
0
 /**
  * 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 = "";
     $src = "";
     $markup = avia_markup_helper(array('context' => 'image', 'echo' => false, 'custom_markup' => $meta['custom_markup']));
     $markup_url = avia_markup_helper(array('context' => 'image_url', 'echo' => false, 'custom_markup' => $meta['custom_markup']));
     $hotspots = ShortcodeHelper::shortcode2array($content, 1);
     extract(shortcode_atts(array('animation' => 'no-animation', 'attachment' => '', 'attachment_size' => '', 'hotspot_layout' => 'numbered', 'hotspot_mobile' => '', 'hotspot_tooltip_display' => ''), $atts, $this->config['shortcode']));
     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] : "";
             }
         }
     }
     //no src? return
     if (!empty($src)) {
         if (!ShortcodeHelper::is_top_level()) {
             $meta['el_class'] .= " av-non-fullwidth-hotspot-image";
         }
         $hotspot_html = "";
         $tooltip_html = "";
         $counter = 1;
         foreach ($hotspots as $hotspot) {
             if (!empty($hotspot_mobile)) {
                 $tooltip_html .= $this->add_fallback_tooltip($hotspot, $counter);
             }
             $extraClass = !empty($hotspot_mobile) ? " av-mobile-fallback-active " : "";
             $extraClass .= !empty($hotspot_tooltip_display) ? " {$hotspot_tooltip_display}-single " : "";
             $hotspot_html .= $this->add_hotspot($hotspot, $counter, $extraClass);
             $counter++;
         }
         //some custom classes
         $class .= $animation == "no-animation" ? "" : " avia_animated_image avia_animate_when_almost_visible " . $animation;
         $class .= " av-hotspot-" . $hotspot_layout;
         $class .= !empty($hotspot_mobile) ? " av-mobile-fallback-active " : "";
         $class .= " " . $hotspot_tooltip_display;
         $output .= "<div class='av-hotspot-image-container avia_animate_when_almost_visible {$class} " . $meta['el_class'] . " ' {$markup} >";
         $output .= "<div class='av-hotspot-container'>";
         $output .= "<div class='av-hotspot-container-inner-cell'>";
         $output .= "<div class='av-hotspot-container-inner-wrap'>";
         $output .= $hotspot_html;
         $output .= "<img class='avia_image ' src='{$src}' alt='{$alt}' title='{$title}'  {$markup_url} />";
         $output .= "</div>";
         $output .= "</div>";
         $output .= "</div>";
         $output .= $tooltip_html;
         $output .= "</div>";
     }
     if (!ShortcodeHelper::is_top_level()) {
         return $output;
     }
     $skipSecond = false;
     $params['class'] = "main_color av-fullwidth-hotspots " . $meta['el_class'];
     $params['open_structure'] = false;
     $params['id'] = !empty($atts['id']) ? AviaHelper::save_string($atts['id'], '-') : "";
     $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;
     }
     $image = $output;
     $output = avia_new_section($params);
     $output .= $image;
     $output .= "</div>";
     //close section
     //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 (empty($meta['siblings']['next']['tag'])) {
         $skipSecond = true;
     }
     if (empty($skipSecond)) {
         $output .= avia_new_section(array('close' => false, 'id' => "after_image_hotspots"));
     }
     return $output;
 }
Ejemplo n.º 2
0
 /**
  * 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 = "";
     $skipSecond = false;
     //check if we got a layerslider
     global $wpdb;
     $params['class'] = "main_color " . $meta['el_class'];
     $params['open_structure'] = false;
     $params['id'] = !empty($atts['id']) ? AviaHelper::save_string($atts['id'], '-') : "";
     //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 ($meta['index'] != 0) {
         $params['class'] .= " masonry-not-first";
     }
     if ($meta['index'] == 0 && get_post_meta(get_the_ID(), 'header', true) != "no") {
         $params['class'] .= " masonry-not-first";
     }
     if ($atts['gap'] == 'no') {
         $params['class'] .= " avia-no-border-styling";
     }
     $atts['container_class'] = "av-masonry-gallery";
     $masonry = new avia_masonry($atts);
     $masonry->query_entries_by_id();
     $masonry_html = $masonry->html();
     if (!ShortcodeHelper::is_top_level()) {
         return $masonry_html;
     }
     $output .= avia_new_section($params);
     $output .= $masonry_html;
     $output .= "</div><!-- close section -->";
     //close section
     //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 (empty($meta['siblings']['next']['tag'])) {
         $skipSecond = true;
     }
     if (empty($skipSecond)) {
         $output .= avia_new_section(array('close' => false, 'id' => "after_masonry"));
     }
     return $output;
 }
Ejemplo n.º 3
0
 /**
  * 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 = "";
     $params['class'] = "main_color " . $meta['el_class'];
     $params['open_structure'] = false;
     $params['id'] = !empty($atts['id']) ? AviaHelper::save_string($atts['id'], '-') : "";
     $params['custom_markup'] = $meta['custom_markup'];
     if ($atts['gap'] == 'no' && $atts['sort'] == "no" || $meta['index'] == 0) {
         $params['class'] .= " avia-no-border-styling";
     }
     //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 ($meta['index'] != 0) {
         $params['class'] .= " masonry-not-first";
     }
     if ($meta['index'] == 0 && get_post_meta(get_the_ID(), 'header', true) != "no") {
         $params['class'] .= " masonry-not-first";
     }
     $masonry = new avia_masonry($atts);
     $masonry->extract_terms();
     $masonry->query_entries();
     $masonry_html = $masonry->html();
     if (!ShortcodeHelper::is_top_level()) {
         return $masonry_html;
     }
     $output .= avia_new_section($params);
     $output .= $masonry_html;
     $output .= avia_section_after_element_content($meta, 'after_masonry');
     return $output;
 }
Ejemplo n.º 4
0
 /**
  * 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['class'] = !empty($meta['custom_class']) ? $meta['custom_class'] : "";
     if (current_theme_supports('avia_template_builder_custom_post_type_grid')) {
         if (isset($atts['link'])) {
             $atts['link'] = explode(',', $atts['link'], 2);
             $atts['taxonomy'] = $atts['link'][0];
             if (isset($atts['link'][1])) {
                 $atts['categories'] = $atts['link'][1];
             }
         }
         if (empty($atts['post_type']) || !current_theme_supports('add_avia_builder_post_type_option')) {
             $atts['post_type'] = get_post_types();
         }
         if (is_string($atts['post_type'])) {
             $atts['post_type'] = explode(',', $atts['post_type']);
         }
     }
     $atts['fullscreen'] = ShortcodeHelper::is_top_level();
     $grid = new avia_post_grid($atts);
     $grid->query_entries();
     $portfolio_html = $grid->html();
     if (!ShortcodeHelper::is_top_level()) {
         return $portfolio_html;
     }
     $params['class'] = "main_color avia-no-border-styling avia-fullwidth-portfolio " . $meta['el_class'];
     $params['open_structure'] = false;
     $params['id'] = !empty($atts['id']) ? AviaHelper::save_string($atts['id'], '-') : "";
     $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;
     }
     $output = avia_new_section($params);
     $output .= $portfolio_html;
     $output .= avia_section_after_element_content($meta, 'after_portfolio');
     return $output;
 }
Ejemplo n.º 5
0
 /**
  * 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('id' => '', 'height' => '', 'hue' => '', 'saturation' => '', 'zoom' => '', 'zoom_control' => '', 'pan_control' => '', 'mobile_drag_control' => '', 'handle' => $shortcodename, 'content' => ShortcodeHelper::shortcode2array($content, 1)), $atts, $this->config['shortcode']);
     $atts['zoom_control'] = empty($atts['zoom_control']) ? false : true;
     $atts['pan_control'] = empty($atts['pan_control']) ? false : true;
     $atts['mobile_drag_control'] = empty($atts['mobile_drag_control']) ? true : false;
     extract($atts);
     $output = "";
     $class = "";
     $skipSecond = false;
     avia_sc_gmaps::$map_count++;
     $params['class'] = "avia-google-maps avia-google-maps-section main_color " . $meta['el_class'] . $class;
     $params['open_structure'] = false;
     $params['id'] = empty($id) ? "avia-google-map-nr-" . avia_sc_gmaps::$map_count : $id;
     //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;
     }
     //print the javascript vars necessary in the frontend footer
     $this->generate_js_vars($content, $atts);
     add_action('wp_footer', array($this, 'send_var_to_frontend'), 2, 100000);
     //create the map div that will be used to insert the google map
     $map = "<div id='av_gmap_" . avia_sc_gmaps::$map_count . "' class='avia-google-map-container' data-mapid='" . avia_sc_gmaps::$map_count . "' " . $this->define_height($height) . "></div>";
     //if the element is nested within a section or a column dont create the section shortcode around it
     if (!ShortcodeHelper::is_top_level()) {
         return $map;
     }
     $output .= avia_new_section($params);
     $output .= $map;
     $output .= "</div>";
     //close section
     //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 (empty($meta['siblings']['next']['tag'])) {
         $skipSecond = true;
     }
     if (empty($skipSecond)) {
         $output .= avia_new_section(array('close' => false, 'id' => "after_full_slider_" . avia_sc_gmaps::$map_count));
     }
     return $output;
 }
Ejemplo n.º 6
0
 /**
  * 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 = "")
 {
     if (isset($atts['link'])) {
         $atts['link'] = explode(',', $atts['link'], 2);
         $atts['taxonomy'] = $atts['link'][0];
         if (isset($atts['link'][1])) {
             $atts['categories'] = $atts['link'][1];
         }
     }
     // $atts['class'] = $meta['el_class'];
     extract($atts);
     $output = "";
     $class = "";
     $skipSecond = false;
     avia_sc_featureimage_slider::$slide_count++;
     $params['class'] = "avia-featureimage-slider-wrap main_color  " . $meta['el_class'] . $class;
     $params['open_structure'] = false;
     $params['custom_markup'] = $atts['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 ($meta['index'] != 0) {
         $params['class'] .= " slider-not-first";
     }
     $params['id'] = "avia_feature_image_slider_" . avia_sc_slider_full::$slide_count;
     $slider = new avia_feature_image_slider($atts);
     $slider->query_entries();
     $slide_html = $slider->html();
     //if the element is nested within a section or a column dont create the section shortcode around it
     if (!ShortcodeHelper::is_top_level()) {
         return $slide_html;
     }
     // $slide_html  = "<div class='container'>" . $slide_html . "</div>";
     $output .= avia_new_section($params);
     $output .= $slide_html;
     $output .= "</div>";
     //close section
     //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 (empty($meta['siblings']['next']['tag'])) {
         $skipSecond = true;
     }
     if (empty($skipSecond)) {
         $output .= avia_new_section(array('close' => false, 'id' => "after_full_slider_" . avia_sc_slider_full::$slide_count));
     }
     return $output;
 }
Ejemplo n.º 7
0
 /**
  * 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('slide_type' => 'image-based', 'link' => '', 'size' => '', 'items' => '', 'autoplay' => 'false', 'title' => 'active', 'excerpt' => '', 'interval' => 5, 'offset' => 0, 'handle' => $shortcodename, 'content' => ShortcodeHelper::shortcode2array($content, 1)), $atts, $this->config['shortcode']);
     extract($atts);
     $output = "";
     $class = "";
     $skipSecond = false;
     avia_sc_slider_accordion::$slide_count++;
     $params['class'] = "avia-accordion-slider-wrap main_color avia-shadow " . $meta['el_class'] . $class;
     $params['open_structure'] = false;
     $params['custom_markup'] = $atts['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 ($meta['index'] != 0) {
         $params['class'] .= " slider-not-first";
     }
     $params['id'] = "accordion_slider_" . avia_sc_slider_full::$slide_count;
     $slider = new aviaccordion($atts);
     $slide_html = $slider->html();
     //if the element is nested within a section or a column dont create the section shortcode around it
     if (!ShortcodeHelper::is_top_level()) {
         return $slide_html;
     }
     $output .= avia_new_section($params);
     $output .= $slide_html;
     $output .= "</div>";
     //close section
     //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 (empty($meta['siblings']['next']['tag'])) {
         $skipSecond = true;
     }
     if (empty($skipSecond)) {
         $output .= avia_new_section(array('close' => false, 'id' => "after_full_slider_" . avia_sc_slider_full::$slide_count));
     }
     return $output;
 }
Ejemplo n.º 8
0
 /**
  * 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;
 }