function av_rotator_item($atts, $content = "", $shortcodename = "")
 {
     $atts = shortcode_atts(array('title' => '', 'link' => '', 'linktarget' => '', 'custom_title' => ''), $atts, 'av_rotator_item');
     extract($atts);
     $this->count++;
     $style = AviaHelper::style_string($atts, 'custom_title', 'color');
     $style = AviaHelper::style_string($style);
     $link = AviaHelper::get_url($link);
     $blank = strpos($linktarget, '_blank') !== false || $linktarget == 'yes' ? ' target="_blank" ' : "";
     $blank .= strpos($linktarget, 'nofollow') !== false ? ' rel="nofollow" ' : "";
     $tags = !empty($link) ? array("a href='{$link}' {$blank} ", 'a') : array('span', 'span');
     $output = "";
     $output .= "<{$tags[0]} {$style} class='av-rotator-text-single av-rotator-text-single-{$this->count}'>";
     $output .= ShortcodeHelper::avia_remove_autop($title, true);
     $output .= "</{$tags[1]}>";
     return $output;
 }
Exemple #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 = "";
     $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;
 }
Exemple #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 = "")
 {
     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 ($atts['padding'] == "0px" || $atts['padding'] == "0" || $atts['padding'] == "0%") {
         $extraClass .= " av-zero-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');
     }
     $outer_style .= AviaHelper::style_string($atts, 'vertical_align', 'vertical-align');
     $outer_style .= AviaHelper::style_string($atts, 'padding');
     $outer_style .= AviaHelper::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;
 }
 /**
  * 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 = "")
 {
     $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;
 }