This commit is contained in:
KhaiNguyen
2020-02-13 10:39:37 +07:00
commit 59401cb805
12867 changed files with 4646216 additions and 0 deletions

View File

@@ -0,0 +1,2 @@
<?php
// Silence is golden.

View File

@@ -0,0 +1,120 @@
<?php
/*
* Template: Sticky navbar sections - Side Gallery
*/
if(!function_exists('kd_section_set_side_gallery')) {
function kd_section_set_side_gallery($atts,$content = null){
// Declare empty vars
$output = $image = $images = $img = $thumbnail = $gal_images = $featured_gallery_id = $default_src = $dimensions = $hwstring = $animation_delay = $wrapper_class = '';
extract(shortcode_atts(array(
'gallery_image_source' => '',
'fss_photo_gallery' => '',
'gallery_ext_image' => '',
'gallery_ext_image_size' => '',
'fss_gallery_shadow' => '',
'fss_loop' => '',
'fss_autoplay' => '',
'fss_autoplay_speed' => '',
'fss_stoponhover' => '',
'css_animation_image' => '',
),$atts));
if ($gallery_image_source == 'external_link') {
$images = vc_value_from_safe( $gallery_ext_image );
$images = explode( ',', $images );
} else {
$images = explode( ',', $fss_photo_gallery );
}
if ( '' === $images ) {
$images = '-1,-2,-3';
}
$default_src = vc_asset_url( 'vc/no_image.png' );
foreach ( $images as $i => $image ) {
if ($gallery_image_source == 'external_link') {
if ($gallery_ext_image != '') {
$image = esc_attr( $image );
$dimensions = vc_extract_dimensions( $gallery_ext_image_size );
$hwstring = $dimensions ? image_hwstring( $dimensions[0], $dimensions[1] ) : '';
$thumbnail = '<img ' . $hwstring . ' src="' . $image . '" />';
} else {
$thumbnail = '<img src="'.$default_src.'" class="vc_img-placeholder" />';
}
} else {
if ( $image > 0 ) {
$img = wpb_getImageBySize( $params = array(
'post_id' => NULL,
'attach_id' => $image,
'thumb_size' => 'full',
'class' = > 'ffs-gallery-img'
));
$thumbnail = $img['thumbnail'];
} else {
$thumbnail = '<img src="'.$default_src.'" class="vc_img-placeholder" />';
}
}
$gal_images .= $thumbnail;
}
$featured_gallery_id = "kd-featured-gallery-".uniqid();
$output .= '<script type="text/javascript">
jQuery(document).ready(function($){
if ($(".'.$featured_gallery_id.' .featured-gallery").length) {
$(".'.$featured_gallery_id.' .featured-gallery").owlCarousel({
stageClass: "owl-wrapper",
stageOuterClass: "owl-wrapper-outer",
loadedClass: "owl-carousel",
items: 1,
rewind: true,
dots: true,
nav: false,
dotsSpeed: 500,';
if($fss_loop == "loop_on") {
$output .= 'loop: true,';
}
if($fss_autoplay == "auto_on") {
$output .= 'autoplay: true,';
}
if($fss_autoplay_speed !== "") {
$output .= 'autoplayTimeout: '.$fss_autoplay_speed.',';
}
if($fss_autoplay == "auto_on" && $fss_stoponhover == "hover_on") {
$output .= 'autoplayHoverPause: true,';
}
$output .='
addClassActive: true,
});
}
});
</script>';
/* Animation delay */
if ('' !== $css_animation_image) {
$animation_delay = 'data-animation-delay="200"';
} else {
$animation_delay = '';
}
$wrapper_class = implode(' ', array('side-featured-wrapper', $featured_gallery_id, $css_animation_image, $css_animation_image, $fss_gallery_shadow));
$output .= '<div class="' . trim($wrapper_class) . '" ' . $animation_delay . '>
<div class="featured-gallery">'.$gal_images.'</div>
</div>';
return $output;
}
}

View File

@@ -0,0 +1,95 @@
<?php
/*
* Template: Sticky navbar sections - Side Photo
*/
if(!function_exists('kd_section_set_side_photo')) {
// Declare empty vars
$image = $content_image = $default_src = $dimensions = $hwstring = $animation_delay = $wrapper_class = '';
function kd_section_set_side_photo($atts,$content = null){
extract(shortcode_atts(array(
'featured_image_source' => '',
'fss_featured_image' => '',
'featured_ext_image' => '',
'fss_image_style' => '',
'fss_image_shadow' => '',
'fss_click_action' => '',
'fss_image_link' => '',
'fss_link_target' => '',
'css_animation_image' => '',
),$atts));
$default_src = vc_asset_url( 'vc/no_image.png' );
$image = wpb_getImageBySize($params = array(
'post_id' => NULL,
'attach_id' => $fss_featured_image,
'thumb_size' => 'full',
'class' => ""
));
if ($featured_image_source == 'external_link') {
$src = $featured_ext_image;
} elseif ($featured_image_source == 'media_library' && !$image) {
$src = $default_src;
} else {
$link = wp_get_attachment_image_src( $fss_featured_image, 'large' );
$link = $link[0];
$src = $link;
}
if ($featured_image_source == 'external_link' && $featured_ext_image != '') {
list($width, $height) = getimagesize($src);
} else {
list($width, $height) = getimagesize($link);
}
$a_attrs['href'] = $fss_image_link;
$a_attrs['target'] = $fss_link_target;
if ($featured_image_source == 'external_link') {
if (!$featured_ext_image) {
$content_image ='<img src="'.$default_src.'" class="vc_img-placeholder" />';
} else {
if ($fss_click_action == 'open_photoswipe') {
$content_image = '<a data-size="' . $width. 'x' .$height .'" href='. $featured_ext_image . '><img src="'.$featured_ext_image.'" width="' . $width. '" height="' .$height .'" /></a>';
} elseif ($fss_click_action == 'custom_link') {
$content_image = '<a ' . vc_stringify_attributes( $a_attrs ) . '><img src="'.$featured_ext_image.'" width="' . $width. '" height="' .$height .'" /></a>';
} else {
$content_image ='<img src="'.$featured_ext_image.'" width="' . $width. '" height="' .$height .'" />';
}
}
} else {
if (!$fss_featured_image) {
$content_image ='<img src="'.$default_src.'" class="vc_img-placeholder" />';
} else {
if ($fss_click_action == 'open_photoswipe') {
$content_image = '<a data-size="' . $width. 'x' .$height .'" href='. $src . '>' . $image['thumbnail'] . '</a>';
} elseif ($fss_click_action == 'custom_link') {
$content_image = '<a ' . vc_stringify_attributes( $a_attrs ) . '>' . $image['thumbnail'] . '</a>';
} else {
$content_image = $image['thumbnail'];
}
}
}
/* Animation delay */
if ('' !== $css_animation_image) {
$animation_delay = 'data-animation-delay="200"';
} else {
$animation_delay = '';
}
$wrapper_class = implode(' ', array('side-featured-wrapper', $fss_image_style, $css_animation_image, $fss_image_shadow));
$output = '<div class="' . trim($wrapper_class) . '" ' . $animation_delay . '>
<div class="featured-image">'.$content_image.'</div>
</div>';
return $output;
}
}

View File

@@ -0,0 +1,70 @@
<?php
/*
* Template: Sticky navbar sections - Side Video
*/
if(!function_exists('kd_section_set_side_video')) {
// Declare empty vars
$video_w = $video_h = $embed = $cover_image = $content_image = $dimensions = $hwstring = $default_src = $animation_delay = '';
function kd_section_set_side_video($atts,$content = null){
extract(shortcode_atts(array(
'fss_video_url' => '',
'video_image_source' => '',
'fss_video_cover' => '',
'video_ext_image' => '',
'video_ext_image_size' => '',
'fss_video_shadow' => '',
'fss_play_button' => '',
'css_animation_image' => '',
),$atts));
$default_src = vc_asset_url( 'vc/no_image.png' );
$dimensions = vc_extract_dimensions( $video_ext_image_size );
$hwstring = $dimensions ? image_hwstring( $dimensions[0], $dimensions[1] ) : '';
if ($video_image_source == 'external_link') {
if (!$video_ext_image) {
$content_image ='<img src="'.$default_src.'" class="vc_img-placeholder" />';
} else {
$content_image ='<img src="'.$video_ext_image.'" '.$hwstring.' />';
}
} else {
if (!$fss_video_cover) {
$content_image ='<img src="'.$default_src.'" class="vc_img-placeholder" />';
} else {
$cover_image = wpb_getImageBySize ( $params = array( 'post_id' => NULL, 'attach_id' => $fss_video_cover, 'thumb_size' => 'full', 'class' => "" ) );
$content_image = $cover_image['thumbnail'];
}
}
$video_w = 500;
$video_h = $video_w / 1.61; //1.61 golden ratio
global $wp_embed;
if ( is_object( $wp_embed ) ) {
$embed = $wp_embed->run_shortcode( '[embed width="' . $video_w . '"' . $video_h . ']' . $fss_video_url . '[/embed]' );
}
/* Animation delay */
if ('' !== $css_animation_image) {
$animation_delay = 'data-animation-delay="200"';
} else {
$animation_delay = '';
}
$wrapper_class = implode(' ', array('side-featured-wrapper', $fss_video_shadow, $css_animation_image, ));
$output = '<div class="' . trim($wrapper_class) . '" ' . $animation_delay . '>
<div class="entry-video">
<div class="video-cover">
<div class="background-video-image">'.$content_image.'</div>
<div class="play-video kd-animate '.$fss_play_button.'"><span class="fa fa-play"></span></div>
'.$embed.'
</div>
</div>
</div>';
return $output;
}
}