File: /home/dh_5jabqq/bermudashipwreckarchive.com/wp-content/themes/loquet/includes/fancybox.php
<?php
/*======
*
* Fancybox
*
======*/
if( !function_exists( 'loquet_fancybox' ) ) {
function loquet_fancybox() {
/*====== Customizer Settings ======*/
$fancybox = get_theme_mod( 'loquet_fancybox', '1' );
/*====== HTML Output ======*/
if( $fancybox == "1" ) {
wp_enqueue_script( 'fancybox', get_template_directory_uri() . '/includes/assets/js/fancybox.min.js', array(), false, true );
wp_enqueue_style( 'fancybox', get_template_directory_uri() . '/includes/assets/css/fancybox.min.css' );
$local_code = substr( get_locale(), 0, 2 );
$fancybox_loop = get_theme_mod( 'loquet_fancybox_loop', 'true' );
$fancybox_keyboard = get_theme_mod( 'loquet_fancybox_keyboard', 'true' );
$fancybox_infobar = get_theme_mod( 'loquet_fancybox_infobar', 'true' );
$fancybox_animation_effect = get_theme_mod( 'loquet_fancybox_animation_effect', 'fade' );
$fancybox_animation_duration = get_theme_mod( 'loquet_fancybox_animation_duration', '366' );
$fancybox_transition_effect = get_theme_mod( 'loquet_fancybox_transition_effect', 'fade' );
$fancybox_transition_duration = get_theme_mod( 'loquet_fancybox_transition_duration', '366' );
$fancybox_zoom_button = get_theme_mod( 'loquet_fancybox_zoom_button', '1' );
$fancybox_share_button = get_theme_mod( 'loquet_fancybox_social_sharing_button', '1' );
$fancybox_slideshow_button = get_theme_mod( 'loquet_fancybox_slideshow_button', '1' );
$fancybox_slideshow_auto_start = get_theme_mod( 'loquet_fancybox_slideshow_auto_start', 'true' );
$fancybox_slideshow_speed = get_theme_mod( 'loquet_fancybox_slideshow_speed', '3000' );
$fancybox_fullscreen_button = get_theme_mod( 'loquet_fancybox_fullscreen_button', '1' );
$fancybox_download_button = get_theme_mod( 'loquet_fancybox_download_button', '1' );
$fancybox_thumbs_button = get_theme_mod( 'loquet_fancybox_thumbs_button', '1' );
$fancybox_thumbs_button_auto_start = get_theme_mod( 'loquet_fancybox_thumbs_button_auto_start', 'true' );
$fancybox_close_button = get_theme_mod( 'loquet_fancybox_close_button', '1' );
$fancybox_buttons = '';
if( $fancybox_zoom_button == "1" ) {
$fancybox_buttons .= '"zoom",';
}
if( $fancybox_share_button == "1" ) {
$fancybox_buttons .= '"share",';
}
if( $fancybox_slideshow_button == "1" ) {
$fancybox_buttons .= '"slideShow",';
}
if( $fancybox_fullscreen_button == "1" ) {
$fancybox_buttons .= '"fullScreen",';
}
if( $fancybox_download_button == "1" ) {
$fancybox_buttons .= '"download",';
}
if( $fancybox_thumbs_button == "1" ) {
$fancybox_buttons .= '"thumbs",';
}
if( $fancybox_close_button == "1" ) {
$fancybox_buttons .= '"close",';
}
if( function_exists( 'loquet_social_sharing' ) ) {
$fancybox_custom = "$('[data-fancybox]').fancybox({
loop: " . esc_attr( $fancybox_loop ) . ",
keyboard: " . esc_attr( $fancybox_keyboard ) . ",
infobar: " . esc_attr( $fancybox_infobar ) . ",
animationEffect: '" . esc_attr( $fancybox_animation_effect ) . "',
animationDuration: " . esc_attr( $fancybox_animation_duration ) . ",
transitionEffect: '" . esc_attr( $fancybox_transition_effect ) . "',
transitionDuration: " . esc_attr( $fancybox_transition_duration ) . ",
buttons: [
" . $fancybox_buttons . "
],
slideShow: {
autoStart: " . esc_attr( $fancybox_slideshow_auto_start ) . ",
speed: " . esc_attr( $fancybox_slideshow_speed ) . "
},
thumbs: {
autoStart: " . esc_attr( $fancybox_thumbs_button_auto_start ) . ",
hideOnClose: true,
parentEl: '.fancybox-container',
axis: 'y',
},
buttons: [
" . $fancybox_buttons . "
],
share: {
url: function(instance, item) {
return ((!instance.currentHash && !(item.type === 'inline' || item.type === 'html') ? item.origSrc || item.src : false) || window.location);
},
tpl: '" . loquet_social_sharing( $class = "", $style = "style-4", $skin = "light", $size = "size-m", $custom_title = esc_html__( 'Share This Photo', 'loquet' ), $align = "center" ) . "',
},
lang: '" . esc_attr( $local_code ) . "',
i18n: {
' . esc_attr( $local_code ) . ': {
CLOSE: '" . esc_html__( 'Close', 'loquet' ) . "',
NEXT: '" . esc_html__( 'Next', 'loquet' ) . "',
PREV: '" . esc_html__( 'Previous', 'loquet' ) . "',
ERROR: '" . esc_html__( 'The requested content cannot be loaded. Please try again later.', 'loquet' ) . "',
PLAY_START: '" . esc_html__( 'Start slideshow', 'loquet' ) . "',
PLAY_STOP: '" . esc_html__( 'Pause slideshow', 'loquet' ) . "',
FULL_SCREEN: '" . esc_html__( 'Fullscreen', 'loquet' ) . "',
THUMBS: '" . esc_html__( 'Thumbnails', 'loquet' ) . "',
DOWNLOAD: '" . esc_html__( 'Download', 'loquet' ) . "',
SHARE: '" . esc_html__( 'Share', 'loquet' ) . "',
ZOOM: '" . esc_html__( 'Zoom', 'loquet' ) . "',
},
},
});";
wp_add_inline_script( 'fancybox', 'jQuery(document).ready(function($){' . $fancybox_custom . '});' );
}
}
}
add_action( 'wp_enqueue_scripts', 'loquet_fancybox' );
}