Пример #1
0
 function get_content($array)
 {
     $cols = $this->opt('cols') ? $this->opt('cols') : 2;
     $hpad = $this->opt('hpad') ? 'hpad-' . $this->opt('hpad') : '';
     $vpad = $this->opt('vpad') ? 'vpad-' . $this->opt('vpad') : '';
     $animation = 'pl-animation pla-from-bottom';
     $disable_animation = $this->opt('quickc_animation_disable', array('default' => false));
     if ($disable_animation) {
         $animation = 'pl-animation pla-none';
     }
     $out = '';
     if (is_array($array)) {
         foreach ($array as $key => $item) {
             $image = pl_array_get('image', $item);
             $image_id = pl_get_image_id_from_src($image);
             $link = pl_array_get('link', $item);
             if ($image) {
                 $image_meta = wp_get_attachment_image_src($image_id, 'aspect-thumb');
                 $image_url = isset($image_meta[0]) ? $image_meta[0] : $image;
                 $image_alt = get_post_meta($image_id, '_wp_attachment_image_alt', true);
                 $image_out = $link ? sprintf('<a href="%s"><img src="%s" alt="%s" /></a>', $link, $image_url, $image_alt) : sprintf('<img src="%s" alt="%s" />', $image_url, $image_alt);
                 $out .= sprintf('<div class="%s carousel-item span%s" style=""><div class="carousel-item-pad %s %s">%s</div></div>', $animation, $cols, $hpad, $vpad, $image_out);
             }
         }
     }
     return $out;
 }
Пример #2
0
 function process_slides($array)
 {
     $output = '';
     if (is_array($array)) {
         foreach ($array as $slide) {
             $the_bg = pl_array_get('background', $slide);
             $the_bg_id = pl_get_image_id_from_src($the_bg);
             $extra = pl_array_get('extra', $slide);
             $video_embed = false;
             // pl_array_get( 'video_embed', $slide );
             if ($the_bg || $extra || $video_embed) {
                 $video = pl_array_get('video', $slide);
                 $the_title = pl_array_get('title', $slide);
                 $the_text = pl_array_get('text', $slide);
                 $element_color = pl_array_get('element_color', $slide);
                 $link = pl_array_get('link', $slide);
                 $link_text = pl_array_get('link_text', $slide, __('More', 'pagelines'));
                 $link_style = pl_array_get('link_style', $slide, 'btn-ol-white');
                 $link_2 = pl_array_get('link_2', $slide);
                 $link_2_text = pl_array_get('link_2_text', $slide, __('Check it out', 'pagelines'));
                 $link_2_style = pl_array_get('link_2_style', $slide, 'btn-info');
                 $the_location = pl_array_get('location', $slide);
                 $transition = pl_array_get('transition', $slide, 'fade');
                 if ($the_location == 'centered') {
                     $the_x = 'center';
                     $caption_class = 'centered sfb stb';
                 } elseif ($the_location == 'right-side') {
                     $the_x = '560';
                     $caption_class = 'right-side sfr str';
                 } else {
                     $the_x = '0';
                     $caption_class = 'left-side sfl stl';
                 }
                 $the_bg = $the_bg ? $the_bg : $this->base_url . '/black-default-bg.png';
                 $bg_alt = get_post_meta($the_bg_id, '_wp_attachment_image_alt', true);
                 $bg = sprintf('<img src="%s" alt="%s" data-bgposition="center center" data-bgfit="cover" data-bgrepeat="no-repeat">', $the_bg, $bg_alt);
                 $the_text = $the_text != '' ? sprintf('<small>%s</small>', $the_text) : '';
                 $content = sprintf('<h2 class="slider-text"><span class="slide-title">%s</span> %s</h2>', $the_title, $the_text);
                 $link = $link ? sprintf('<a href="%s" class="btn btn-large slider-btn %s">%s</a>', $link, $link_style, $link_text) : false;
                 $link_2 = $link_2 ? sprintf('<a href="%s" class="btn btn-large slider-btn %s">%s</a>', $link_2, $link_2_style, $link_2_text) : false;
                 $buttons = $link || $link_2 ? sprintf('<div class="slider-buttons">%s %s</div>', $link, $link_2) : '';
                 if (!$extra) {
                     $caption = sprintf('<div class="caption slider-content %s" data-x="%s" data-y="center" data-speed="300" data-start="500" data-easing="easeOutExpo">%s %s</div>', $caption_class, $the_x, $content, $buttons);
                 } else {
                     $caption = '';
                 }
                 if (!empty($video)) {
                     $video_caption = $this->get_video_caption($video, pl_array_get('video_2', $slide));
                 } else {
                     $video_caption = '';
                 }
                 $output .= sprintf('<li data-transition="%s" data-slotamount=	"10" class="%s bg-video-canvas">%s %s %s %s</li>', $transition, $element_color, $bg, $video_caption, $caption, $extra);
             }
         }
     }
     return $output;
 }