Exemplo 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 = "")
 {
     $atts = shortcode_atts(array('email' => get_option('admin_email'), 'button' => __("Submit", 'avia_framework'), 'autorespond' => '', 'captcha' => '', 'subject' => '', 'sent' => __("Your message has been sent!", 'avia_framework'), 'title' => __("Send us mail", 'avia_framework')), $atts);
     extract($atts);
     $post_id = function_exists('avia_get_the_id') ? avia_get_the_id() : get_the_ID();
     $form_args = array("heading" => $title ? "<h3>" . $title . "</h3>" : "", "success" => "<h3 class='avia-form-success'>" . $sent . "</h3>", "submit" => $button, "myemail" => $email, "action" => get_permalink($post_id), "myblogname" => get_option('blogname'), "autoresponder" => $autorespond, "autoresponder_subject" => __('Thank you for your Message!', 'avia_framework'), "autoresponder_email" => $email, "subject" => $subject, "form_class" => $meta['el_class'], "multiform" => true, "label_first" => true);
     if (trim($form_args['myemail']) == '') {
         $form_args['myemail'] = get_option('admin_email');
     }
     //form fields passed by the user
     $form_fields = $this->helper_array2form_fields(ShortcodeHelper::shortcode2array($content));
     //fake username field that is not visible. if the field has a value a spam bot tried to send the form
     $elements['avia_username'] = array('type' => 'decoy', 'label' => '', 'check' => 'must_empty');
     //captcha field for the user to verify that he is real
     if ($captcha) {
         $elements['avia_age'] = array('type' => 'captcha', 'check' => 'captcha', 'label' => __('Please prove that you are human by solving the equation', 'avia_framework'));
     }
     //merge all fields
     $form_fields = apply_filters('avia_contact_form_elements', array_merge($form_fields, $elements));
     $form_args = apply_filters('avia_contact_form_args', $form_args);
     $contact_form = new avia_form($form_args);
     $contact_form->create_elements($form_fields);
     $output = $contact_form->display_form(true);
     return $output;
 }
Exemplo 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 = "")
 {
     extract(shortcode_atts(array('position' => 'left'), $atts));
     $icon_el = $this->elements[0]['subelements'][4];
     $chars = $icon_el['chars'];
     if (!is_array($chars)) {
         include $icon_el['chars'];
     }
     $bars = ShortcodeHelper::shortcode2array($content);
     $output = "";
     if (!empty($bars)) {
         $output .= "<div class='avia-progress-bar-container avia_animate_when_almost_visible " . $meta['el_class'] . "'>";
         $defaults = array('color' => 'theme-color', 'progress' => "100", 'title' => "", 'icon' => 1, "icon_select" => "no");
         foreach ($bars as $bar) {
             $bar['attr'] = array_merge($defaults, $bar['attr']);
             $display_char = isset($chars[$bar['attr']['icon'] - 1]) ? $chars[$bar['attr']['icon'] - 1] : $chars[0];
             $output .= "<div class='avia-progress-bar " . $bar['attr']['color'] . "-bar icon-bar-" . $bar['attr']['icon_select'] . "'>";
             if ($bar['attr']['icon_select'] == "yes" || $bar['attr']['title']) {
                 $output .= "<div class='progressbar-title-wrap'>";
                 $output .= "<div class='progressbar-icon avia-font-" . $icon_el['font'] . "'><span class='progressbar-char'>{$display_char}</span></div>";
                 $output .= "<div class='progressbar-title'>" . $bar['attr']['title'] . "</div>";
                 $output .= "</div>";
             }
             $output .= "<div class='progress'><div class='bar-outer'><div class='bar' style='width: " . $bar['attr']['progress'] . "%' data-progress='" . $bar['attr']['progress'] . "'></div></div></div>";
             $output .= "</div>";
         }
         $output .= "</div>";
     }
     return $output;
 }
Exemplo 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 = "")
 {
     extract(shortcode_atts(array('position' => 'left', 'bar_styling' => 'av-striped-bar', 'bar_animation' => 'av-animated-bar'), $atts, $this->config['shortcode']));
     $bars = ShortcodeHelper::shortcode2array($content);
     $extraClass = $bar_styling . " " . $bar_animation;
     $output = "";
     if (!empty($bars)) {
         $output .= "<div class='avia-progress-bar-container avia_animate_when_almost_visible " . $meta['el_class'] . " {$extraClass}'>";
         $defaults = array('color' => 'theme-color', 'progress' => "100", 'title' => "", 'icon' => '', 'font' => '', "icon_select" => "no");
         foreach ($bars as $bar) {
             $bar['attr'] = array_merge($defaults, $bar['attr']);
             $display_char = av_icon($bar['attr']['icon'], $bar['attr']['font']);
             $output .= "<div class='avia-progress-bar " . $bar['attr']['color'] . "-bar icon-bar-" . $bar['attr']['icon_select'] . "'>";
             if ($bar['attr']['icon_select'] == "yes" || $bar['attr']['title']) {
                 $output .= "<div class='progressbar-title-wrap'>";
                 $output .= "<div class='progressbar-icon'><span class='progressbar-char' {$display_char}></span></div>";
                 $output .= "<div class='progressbar-title'>" . $bar['attr']['title'] . "</div>";
                 $output .= "</div>";
             }
             $output .= "<div class='progress'><div class='bar-outer'><div class='bar' style='width: " . $bar['attr']['progress'] . "%' data-progress='" . $bar['attr']['progress'] . "'></div></div></div>";
             $output .= "</div>";
         }
         $output .= "</div>";
     }
     return $output;
 }
Exemplo 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 = "")
 {
     extract(shortcode_atts(array('title' => ''), $atts, $this->config['shortcode']));
     $output = "";
     $output .= "<div class='av-catalogue-container " . $meta['el_class'] . "'>";
     $output .= "<ul class='av-catalogue-list'>";
     $output .= ShortcodeHelper::avia_remove_autop($content, true);
     $output .= "</ul>";
     $output .= "</div>";
     return $output;
 }
Exemplo 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 = "")
 {
     $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;
 }
Exemplo 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 = "")
 {
     $atts = shortcode_atts(array('size' => 'featured', 'animation' => 'slide', 'ids' => '', 'autoplay' => 'false', 'interval' => 5, 'handle' => $shortcodename, 'src' => '', 'position' => 'top left', 'repeat' => 'no-repeat', 'attach' => 'scroll', 'stretch' => '', 'content' => ShortcodeHelper::shortcode2array($content)), $atts);
     extract($atts);
     $output = "";
     $background = "";
     $class = "";
     if ($src != "") {
         if ($repeat == 'stretch') {
             $background .= "background-repeat: no-repeat; ";
             $class .= " avia-full-stretch";
         } else {
             $background .= "background-repeat: {$repeat}; ";
         }
         $background .= "background-image: url({$src}); ";
         $background .= "background-attachment: {$attach}; ";
         $background .= "background-position: {$position}; ";
     }
     if ($background) {
         $params['bg'] = "style = '{$background}'";
     }
     $skipSecond = false;
     avia_sc_slider_full::$slide_count++;
     $params['class'] = "avia-fullwidth-slider main_color avia-shadow " . $meta['el_class'] . $class;
     $params['open_structure'] = false;
     if ($meta['index'] == 0) {
         $params['close'] = false;
     }
     if ($meta['index'] != 0) {
         $params['class'] .= " slider-not-first";
     }
     if ($meta['index'] == 0 && get_post_meta(get_the_ID(), 'header', true) != "no") {
         $params['class'] .= " slider-not-first";
     }
     $params['id'] = "full_slider_" . avia_sc_slider_full::$slide_count;
     $output .= avia_new_section($params);
     $slider = new avia_slideshow($atts);
     $slider->set_extra_class($stretch);
     $output .= $slider->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'], array('av_layerslider', 'av_section', 'av_slideshow_full', 'av_fullscreen'))) {
         $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;
 }
Exemplo 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 = "")
 {
     $output = "";
     if (!isset($atts['widget_area'])) {
         return $output;
     }
     if (is_dynamic_sidebar($atts['widget_area'])) {
         ob_start();
         dynamic_sidebar($atts['widget_area']);
         $output = ShortcodeHelper::avia_remove_autop(ob_get_clean(), true);
         if ($output) {
             $output = "<div class='avia-builder-widget-area clearfix " . $meta['el_class'] . "'>" . $output . "</div>";
         }
     }
     return $output;
 }
Exemplo n.º 8
0
 /**
  *creates the shortcode pattern that only matches Avia Builder Shortcodes
  **/
 static function build_pattern($predefined_tags = false)
 {
     global $shortcode_tags;
     //save the "real" shortcode array
     $old_sc = $shortcode_tags;
     //if we got allowed shortcodes build the pattern. nested shortcodes are also considered but within a separate array
     if (!empty(ShortcodeHelper::$allowed_shortcodes)) {
         $shortcode_tags = array_flip(array_merge(ShortcodeHelper::$allowed_shortcodes, ShortcodeHelper::$nested_shortcodes));
     }
     //filter out all elements that are not in the predefined tags array. this is necessary for nested shortcode modal to work properly
     if (is_array($predefined_tags)) {
         $predefined_tags = array_flip($predefined_tags);
         $shortcode_tags = shortcode_atts($predefined_tags, $shortcode_tags);
     }
     //create the pattern and store it
     ShortcodeHelper::$pattern = get_shortcode_regex();
     //restore original shortcode tags
     $shortcode_tags = $old_sc;
     return ShortcodeHelper::$pattern;
 }
Exemplo n.º 9
0
 function pre_compile($content)
 {
     global $shortcode_tags;
     //in case we got none/more than one postcontent elements make sure that replacement doesnt get executed/onle gets executed once
     if (strpos($content, 'av_postcontent') === false) {
         return $content;
     }
     //save the "real" shortcode array
     $old_sc = $shortcode_tags;
     //execute only this single shortcode and return the result
     $shortcode_tags = array($this->config['shortcode'] => array($this, 'shortcode_handler'));
     $content = do_shortcode($content);
     //re create the old shortcode pattern
     $shortcode_tags = $old_sc;
     //$content = preg_replace("!\[av_postcontent.*?\]!","",$content);
     //now we need to re calculate the shortcode tree so that all elements that are pulled from different posts also get the correct location
     $pattern = str_replace('av_postcontent', 'av_psprocessed', ShortcodeHelper::get_fake_pattern());
     preg_match_all("/" . $pattern . "/s", $content, $matches);
     ShortcodeHelper::$tree = ShortcodeHelper::build_shortcode_tree($matches);
     return $content;
 }
Exemplo n.º 10
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('size' => 'featured', 'animation' => 'slide', 'ids' => '', 'autoplay' => 'false', 'interval' => 5, 'handle' => $shortcodename, 'stretch' => '', 'bg_slider' => 'true', 'slide_height' => "100", 'content' => ShortcodeHelper::shortcode2array($content)), $atts);
     extract($atts);
     $output = "";
     $class = "";
     $skipSecond = false;
     avia_sc_slider_full::$slide_count++;
     $params['class'] = "avia-fullscreen-slider main_color " . $meta['el_class'] . $class;
     $params['open_structure'] = false;
     if ($meta['index'] == 0) {
         $params['close'] = false;
     }
     if ($meta['index'] != 0) {
         $params['class'] .= " slider-not-first";
     }
     if ($meta['index'] == 0 && get_post_meta(get_the_ID(), 'header', true) != "no") {
         $params['class'] .= " slider-not-first";
     }
     $params['id'] = "fullscreen_slider_" . avia_sc_slider_fullscreen::$slide_count;
     $output .= avia_new_section($params);
     $slider = new avia_slideshow($atts);
     $slider->set_extra_class($stretch);
     $output .= $slider->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'], array('av_layerslider', 'av_section', 'av_slideshow_full', 'av_fullscreen'))) {
         $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_fullscreen::$slide_count));
     }
     return $output;
 }
Exemplo n.º 11
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 = "")
 {
     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;
 }
Exemplo n.º 12
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_grid_row::$count++;
     $atts = shortcode_atts(array('color' => 'main_color', 'border' => '', 'min_height' => '0', 'mobile' => 'av-flex-cells', 'id' => ''), $atts, $this->config['shortcode']);
     extract($atts);
     $output = "";
     $params['class'] = "av-layout-grid-container {$color} {$mobile} {$border}" . $meta['el_class'];
     $params['open_structure'] = false;
     $params['id'] = !empty($id) ? $id : "av-layout-grid-" . avia_sc_grid_row::$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 (isset($meta['index']) && $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 (isset($meta['index']) && $meta['index'] != 0) {
         $params['class'] .= " submenu-not-first";
     }
     avia_sc_cell::$attr = $atts;
     $output .= avia_new_section($params);
     $output .= ShortcodeHelper::avia_remove_autop($content, true);
     $output .= avia_section_after_element_content($meta, 'after_submenu', false);
     return $output;
 }
Exemplo n.º 13
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('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;
 }
Exemplo n.º 14
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('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;
 }
Exemplo n.º 15
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;
 }
Exemplo n.º 16
0
 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;
 }
Exemplo n.º 17
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 = "")
 {
     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;
 }
Exemplo n.º 18
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_section::$section_count++;
     $atts = shortcode_atts(array('src' => '', 'position' => 'top left', 'repeat' => 'no-repeat', 'attach' => 'scroll', 'color' => 'main_color', 'custom_bg' => '', 'padding' => 'default', 'shadow' => 'shadow', 'id' => '', 'min_height' => '', 'video' => '', 'video_ratio' => '16:9', 'video_mobile_disabled' => '', 'custom_markup' => '', 'attachment' => '', 'attachment_size' => ''), $atts, $this->config['shortcode']);
     extract($atts);
     $output = "";
     $class = "avia-section " . $color . " avia-section-" . $padding . " avia-" . $shadow . " avia-bg-style-" . $attach;
     $background = "";
     $params['id'] = !empty($id) ? AviaHelper::save_string($id, '-') : "av_section_" . avia_sc_section::$section_count;
     $params['custom_markup'] = $meta['custom_markup'];
     if (!empty($attachment) && !empty($attachment_size)) {
         $attachment_entry = get_post($attachment);
         if (!empty($attachment_entry)) {
             if (!empty($attachment_size)) {
                 $src = wp_get_attachment_image_src($attachment_entry->ID, $attachment_size);
                 $src = !empty($src[0]) ? $src[0] : "";
             }
         }
     } else {
         $attachment = false;
     }
     if ($src != "") {
         if ($repeat == 'stretch') {
             $background .= "background-repeat: no-repeat; ";
             $class .= " avia-full-stretch";
         } else {
             $background .= "background-repeat: {$repeat}; ";
         }
         $background .= "background-image: url({$src}); ";
         $background .= $attach == 'parallax' ? "background-attachment: scroll; " : "background-attachment: {$attach}; ";
         $background .= "background-position: {$position}; ";
         if ($attach == 'parallax') {
             $attachment_class = "";
             if ($repeat == 'stretch' || $repeat == 'no-repeat') {
                 $attachment_class .= " avia-full-stretch";
             }
             $class .= " av-parallax-section";
             $speed = apply_filters('avf_parallax_speed', "0.3", $params['id']);
             $params['attach'] = "<div class='av-parallax {$attachment_class}' data-avia-parallax-ratio='{$speed}' style = '{$background}' ></div>";
             $background = "";
         }
         $params['data'] = "data-section-bg-repeat='{$repeat}'";
     }
     if ($custom_bg != "") {
         $background .= "background-color: {$custom_bg}; ";
     }
     if ($background) {
         $background = "style = '{$background}'";
     }
     $params['class'] = $class . " " . $meta['el_class'];
     $params['bg'] = $background;
     $params['min_height'] = $min_height;
     $params['video'] = $video;
     $params['video_ratio'] = $video_ratio;
     $params['video_mobile_disabled'] = $video_mobile_disabled;
     if (isset($meta['index'])) {
         if ($meta['index'] == 0) {
             $params['main_container'] = true;
         }
         if ($meta['index'] == 0 || isset($meta['siblings']['prev']['tag']) && in_array($meta['siblings']['prev']['tag'], AviaBuilder::$full_el_no_section)) {
             $params['close'] = false;
         }
     }
     global $avia_config;
     $avia_config['layout_container'] = "section";
     $output .= avia_new_section($params);
     $output .= ShortcodeHelper::avia_remove_autop($content, true);
     //if the next tag is a section dont create a new section from this shortcode
     if (!empty($meta['siblings']['next']['tag']) && in_array($meta['siblings']['next']['tag'], AviaBuilder::$full_el)) {
         $skipSecond = true;
     }
     //if there is no next element dont create a new section. if we got a sidebar always create a next section at the bottom
     if (empty($meta['siblings']['next']['tag']) && !avia_has_sidebar()) {
         $skipSecond = true;
     }
     if (empty($skipSecond)) {
         $new_params['id'] = "after_section_" . avia_sc_section::$section_count;
         $output .= avia_new_section($new_params);
     }
     unset($avia_config['layout_container']);
     return $output;
 }
Exemplo n.º 19
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;
     $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;
 }
Exemplo n.º 20
0
 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;
 }
Exemplo n.º 21
0
 public function text_to_interface($text = NULL)
 {
     global $shortcode_tags;
     $allowed = false;
     if (isset($_POST['text'])) {
         $text = $_POST['text'];
     }
     //isset when avia_ajax_text_to_interface is executed (avia_builder.js)
     if (isset($_POST['params']) && isset($_POST['params']['allowed'])) {
         $allowed = explode(',', $_POST['params']['allowed']);
     }
     //only build pattern with a subset of shortcodes
     //build the shortcode pattern to check if the text that we want to check uses any of the builder shortcodes
     ShortcodeHelper::build_pattern($allowed);
     $text_nodes = preg_split("/" . ShortcodeHelper::$pattern . "/s", $text);
     foreach ($text_nodes as $node) {
         if (strlen(trim($node)) == 0 || strlen(trim(strip_tags($node))) == 0) {
             //$text = preg_replace("/(".preg_quote($node, '/')."(?!\[\/))/", '', $text);
         } else {
             $text = preg_replace("/(" . preg_quote($node, '/') . "(?!\\[\\/))/", '[av_textblock]$1[/av_textblock]', $text);
         }
     }
     $text = $this->do_shortcode_backend($text);
     if (isset($_POST['text'])) {
         echo $text;
         exit;
     } else {
         return $text;
     }
 }
Exemplo n.º 22
0
 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;
 }
Exemplo n.º 23
0
 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;
 }
Exemplo n.º 24
0
 function modal_group_sub($element, $parent_class, $i = false)
 {
     $output = "";
     $args = array();
     $content = NULL;
     //iterate over the subelements and set the default values
     foreach ($element['subelements'] as $key => $subelement) {
         if (isset($element['std']) && is_array($element['std']) && isset($element['std'][$i][$subelement['id']])) {
             $subelement['std'] = $element['std'][$i][$subelement['id']];
         }
         //if $i is not set, meaning we need a totaly empty template reset the std values
         if ($i === false) {
             $subelement['std'] = "";
         }
         if ($subelement['id'] == 'content') {
             $content = $subelement['std'];
         } else {
             $args[$subelement['id']] = $subelement['std'];
         }
     }
     $params['args'] = $args;
     $params['content'] = $content;
     $defaults = array('class' => '', 'innerHtml' => '');
     $params = array_merge($defaults, $params);
     $params = $parent_class->editor_sub_element($params);
     extract($params);
     $data['modal_title'] = $element['modal_title'];
     $data['shortcodehandler'] = $parent_class->config['shortcode_nested'][0];
     $data['modal_ajax_hook'] = $parent_class->config['shortcode_nested'][0];
     $data['modal_on_load'] = array();
     if (!empty($element['modal_on_load'])) {
         $data['modal_on_load'] = array_merge($data['modal_on_load'], $element['modal_on_load']);
     }
     if (!empty($parent_class->config['modal_on_load'])) {
         $data['modal_on_load'] = array_merge($data['modal_on_load'], $parent_class->config['modal_on_load']);
     }
     $dataString = AviaHelper::create_data_string($data);
     $output .= "<div class='avia-modal-group-element ' {$dataString}>";
     $output .= "<a class='avia-attach-modal-element-move avia-move-handle'>" . __('Move', 'avia_framework') . "</a>";
     $output .= "<a class='avia-attach-modal-element-delete avia-delete'>" . __('Delete', 'avia_framework') . "</a>";
     $output .= "<div class='avia-modal-group-element-inner'>";
     $output .= $params['innerHtml'];
     $output .= "</div>";
     $output .= "<textarea data-name='text-shortcode' cols='20' rows='4' name='{$element['id']}'>" . ShortcodeHelper::create_shortcode_by_array($parent_class->config['shortcode_nested'][0], $content, $args) . "</textarea>";
     $output .= "</div>";
     return $output;
 }
Exemplo n.º 25
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('type' => 'grid', 'size' => 'featured', 'ids' => '', 'autoplay' => 'false', 'navigation' => 'arrows', 'animation' => 'slide', 'interval' => 5, 'heading' => '', 'hover' => '', 'columns' => 3, 'border' => '', 'handle' => $shortcodename, 'content' => ShortcodeHelper::shortcode2array($content), 'class' => $meta['el_class'], 'custom_markup' => $meta['custom_markup']), $atts, $this->config['shortcode']);
     $logo = new avia_partner_logo($atts);
     return $logo->html();
 }
Exemplo n.º 26
0
 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;
 }
Exemplo n.º 27
0
 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;
 }
Exemplo n.º 28
0
 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;
 }
Exemplo n.º 29
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;
     $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;
 }
Exemplo n.º 30
0
 /**
  * helper function that gets the default value of the content element
  *
  * @param array $elements
  * @return array $args
  */
 public function get_default_content($content = "")
 {
     if (!empty($this->elements)) {
         //if we didnt iterate over the arguments array yet do it now
         if (empty($this->default_args)) {
             $this->get_default_args();
         }
         //if there is a content element already thats the value. if not try to fetch the std value
         if (!isset($this->default_args['content'])) {
             foreach ($this->elements as $element) {
                 if (isset($element['std']) && isset($element['id']) && $element['id'] == "content") {
                     $content = $element['std'];
                 }
             }
         } else {
             $content = $this->default_args['content'];
         }
     }
     //if the content is an array we got a nested shortcode
     if (is_array($content)) {
         $string_content = "";
         foreach ($content as $c) {
             $string_content .= trim(ShortcodeHelper::create_shortcode_by_array($this->config['shortcode_nested'][0], NULL, $c)) . "\n";
         }
         $content = $string_content;
     }
     return $content;
 }