WC_Gallery_Preview_Display

WooCommerce Gallery Preview Display Class.

Defined (1)

The class is defined in the following location(s).

/classes/class-wc-dynamic-gallery-preview.php  
  1. class WC_Gallery_Preview_Display 
  2.  
  3. public static function wc_dynamic_gallery_preview($request = '') { 
  4. if ( ! is_user_logged_in() || ! current_user_can( 'manage_options' ) ) die(); 
  5.  
  6. global $wc_dgallery_admin_interface, $wc_dgallery_fonts_face; 
  7. $request = $_REQUEST; 
  8. /** 
  9. * Single Product Image 
  10. */ 
  11. $post = new stdClass(); 
  12. $current_db_version = get_option( 'woocommerce_db_version', null ); 
  13. $woo_a3_gallery_settings = $request; 
  14. $lightbox_class = 'lightbox'; 
  15. $thumbs_list_class = ''; 
  16. $display_back_and_forward = 'true'; 
  17.  
  18. $post->ID = rand(10, 10000); 
  19.  
  20. if ( isset( $woo_a3_gallery_settings[WOO_DYNAMIC_GALLERY_PREFIX.'width_type'] ) ) { 
  21. $woo_dg_width_type = $woo_a3_gallery_settings[WOO_DYNAMIC_GALLERY_PREFIX.'width_type']; 
  22. } else { 
  23. $woo_dg_width_type = 'px'; 
  24. if ( isset( $woo_a3_gallery_settings[WOO_DYNAMIC_GALLERY_PREFIX.'gallery_height_type'] ) ) { 
  25. $gallery_height_type = $woo_a3_gallery_settings[WOO_DYNAMIC_GALLERY_PREFIX.'gallery_height_type']; 
  26. } else { 
  27. $gallery_height_type = 'dynamic'; 
  28. if ( $woo_dg_width_type == 'px' ) { 
  29. $g_width = $woo_a3_gallery_settings[WOO_DYNAMIC_GALLERY_PREFIX.'product_gallery_width_fixed'].'px'; 
  30. $g_height = $woo_a3_gallery_settings[WOO_DYNAMIC_GALLERY_PREFIX.'product_gallery_height']; 
  31. } else { 
  32. $g_width = $woo_a3_gallery_settings[WOO_DYNAMIC_GALLERY_PREFIX.'product_gallery_width_responsive'].'%'; 
  33.  
  34. $max_height = 533; 
  35. $width_of_max_height = 400; 
  36. // Set height for when gallery is responsive wide or dynamic height 
  37. if ( 'px' != $woo_dg_width_type || 'dynamic' == $gallery_height_type ) { 
  38. if ( $max_height > 0 ) { 
  39. $g_height = false; 
  40. ?> 
  41. <script type="text/javascript"> 
  42. (function($) { 
  43. $(function() { 
  44. a3revWCDynamicGallery_<?php echo $post->ID; ?> = { 
  45.  
  46. setHeightProportional: function () { 
  47. var image_wrapper_width = $( '#gallery_<?php echo $post->ID; ?>' ).find('.a3dg-image-wrapper').outerWidth(); 
  48. var width_of_max_height = parseInt(<?php echo $width_of_max_height; ?>); 
  49. var image_wrapper_height = parseInt(<?php echo $max_height; ?>); 
  50. if( width_of_max_height > image_wrapper_width ) { 
  51. var ratio = width_of_max_height / image_wrapper_width; 
  52. image_wrapper_height = parseInt(<?php echo $max_height; ?>) / ratio; 
  53. $( '#gallery_<?php echo $post->ID; ?>' ).find('.a3dg-image-wrapper').css({ height: image_wrapper_height }); 
  54.  
  55. a3revWCDynamicGallery_<?php echo $post->ID; ?>.setHeightProportional(); 
  56.  
  57. $( window ).resize(function() { 
  58. a3revWCDynamicGallery_<?php echo $post->ID; ?>.setHeightProportional(); 
  59. }); 
  60. }); 
  61. })(jQuery); 
  62. </script> 
  63. <?php 
  64. } else { 
  65. $g_height = 138; 
  66.  
  67. $caption_font = $woo_a3_gallery_settings[WOO_DYNAMIC_GALLERY_PREFIX.'caption_font']; 
  68. $navbar_font = $woo_a3_gallery_settings[WOO_DYNAMIC_GALLERY_PREFIX.'navbar_font']; 
  69. $google_fonts = array( $caption_font['face'], $navbar_font['face'] ); 
  70. $wc_dgallery_fonts_face->generate_google_webfonts( $google_fonts ); 
  71.  
  72. ?> 
  73. <div class="images" style="100%; margin:30px auto;"> 
  74. <div class="product_gallery"> 
  75. <?php 
  76. $shop_thumbnail = wc_get_image_size( 'shop_thumbnail' ); 
  77. $g_thumb_width = $shop_thumbnail['width']; 
  78. $g_thumb_height = $shop_thumbnail['height']; 
  79. $g_thumb_spacing = $woo_a3_gallery_settings[WOO_DYNAMIC_GALLERY_PREFIX.'thumb_spacing']; 
  80. if ( isset( $woo_a3_gallery_settings[WOO_DYNAMIC_GALLERY_PREFIX.'thumb_show_type'] ) ) { 
  81. $thumb_show_type = 'slider'; 
  82. } else { 
  83. $thumb_show_type = 'static'; 
  84.  
  85. $thumb_columns = $woo_a3_gallery_settings[WOO_DYNAMIC_GALLERY_PREFIX . 'thumb_columns']; 
  86. if ( 'static' == $thumb_show_type ) { 
  87. $thumbs_list_class = 'a3dg-thumbs-static'; 
  88. $display_back_and_forward = 'false'; 
  89.  
  90. if ( isset( $woo_a3_gallery_settings[WOO_DYNAMIC_GALLERY_PREFIX.'product_gallery_auto_start'] ) ) { 
  91. $g_auto = $woo_a3_gallery_settings[WOO_DYNAMIC_GALLERY_PREFIX.'product_gallery_auto_start']; 
  92. } else { 
  93. $g_auto = 'false'; 
  94.  
  95. $g_speed = $woo_a3_gallery_settings[WOO_DYNAMIC_GALLERY_PREFIX.'product_gallery_speed']; 
  96. $g_effect = $woo_a3_gallery_settings[WOO_DYNAMIC_GALLERY_PREFIX.'product_gallery_effect']; 
  97. $g_animation_speed = $woo_a3_gallery_settings[WOO_DYNAMIC_GALLERY_PREFIX.'product_gallery_animation_speed']; 
  98.  
  99. $main_bg_color = $woo_a3_gallery_settings[WOO_DYNAMIC_GALLERY_PREFIX.'main_bg_color']; 
  100. if ( ! isset( $main_bg_color['enable'] ) ) { 
  101. $main_bg_color['enable'] = 0; 
  102. $main_border = $woo_a3_gallery_settings[WOO_DYNAMIC_GALLERY_PREFIX.'main_border']; 
  103. if ( ! isset( $main_border['corner'] ) ) { 
  104. $main_border['corner'] = 'square'; 
  105. $main_shadow = $woo_a3_gallery_settings[WOO_DYNAMIC_GALLERY_PREFIX.'main_shadow']; 
  106. if ( ! isset( $main_shadow['enable'] ) ) { 
  107. $main_shadow['enable'] = 0; 
  108. $main_margin_top = $woo_a3_gallery_settings[WOO_DYNAMIC_GALLERY_PREFIX.'main_margin_top']; 
  109. $main_margin_bottom = $woo_a3_gallery_settings[WOO_DYNAMIC_GALLERY_PREFIX.'main_margin_bottom']; 
  110. $main_margin_left = $woo_a3_gallery_settings[WOO_DYNAMIC_GALLERY_PREFIX.'main_margin_left']; 
  111. $main_margin_right = $woo_a3_gallery_settings[WOO_DYNAMIC_GALLERY_PREFIX.'main_margin_right']; 
  112. $main_padding_top = $woo_a3_gallery_settings[WOO_DYNAMIC_GALLERY_PREFIX.'main_padding_top']; 
  113. $main_padding_bottom = $woo_a3_gallery_settings[WOO_DYNAMIC_GALLERY_PREFIX.'main_padding_bottom']; 
  114. $main_padding_left = $woo_a3_gallery_settings[WOO_DYNAMIC_GALLERY_PREFIX.'main_padding_left']; 
  115. $main_padding_right = $woo_a3_gallery_settings[WOO_DYNAMIC_GALLERY_PREFIX.'main_padding_right']; 
  116.  
  117. if ( isset( $woo_a3_gallery_settings[WOO_DYNAMIC_GALLERY_PREFIX.'product_gallery_nav'] ) ) { 
  118. $product_gallery_nav = $woo_a3_gallery_settings[WOO_DYNAMIC_GALLERY_PREFIX.'product_gallery_nav']; 
  119. } else { 
  120. $product_gallery_nav = 'no'; 
  121. $navbar_bg_color = $woo_a3_gallery_settings[WOO_DYNAMIC_GALLERY_PREFIX.'navbar_bg_color']; 
  122. if ( ! isset( $navbar_bg_color['enable'] ) ) { 
  123. $navbar_bg_color['enable'] = 0; 
  124. $navbar_border = $woo_a3_gallery_settings[WOO_DYNAMIC_GALLERY_PREFIX.'navbar_border']; 
  125. if ( ! isset( $navbar_border['corner'] ) ) { 
  126. $navbar_border['corner'] = 'square'; 
  127. $navbar_shadow = $woo_a3_gallery_settings[WOO_DYNAMIC_GALLERY_PREFIX.'navbar_shadow']; 
  128. if ( ! isset( $navbar_shadow['enable'] ) ) { 
  129. $navbar_shadow['enable'] = 0; 
  130. $navbar_margin_top = $woo_a3_gallery_settings[WOO_DYNAMIC_GALLERY_PREFIX.'navbar_margin_top']; 
  131. $navbar_margin_bottom = $woo_a3_gallery_settings[WOO_DYNAMIC_GALLERY_PREFIX.'navbar_margin_bottom']; 
  132. $navbar_margin_left = $woo_a3_gallery_settings[WOO_DYNAMIC_GALLERY_PREFIX.'navbar_margin_left']; 
  133. $navbar_margin_right = $woo_a3_gallery_settings[WOO_DYNAMIC_GALLERY_PREFIX.'navbar_margin_right']; 
  134. $navbar_padding_top = $woo_a3_gallery_settings[WOO_DYNAMIC_GALLERY_PREFIX.'navbar_padding_top']; 
  135. $navbar_padding_bottom = $woo_a3_gallery_settings[WOO_DYNAMIC_GALLERY_PREFIX.'navbar_padding_bottom']; 
  136. $navbar_padding_left = $woo_a3_gallery_settings[WOO_DYNAMIC_GALLERY_PREFIX.'navbar_padding_left']; 
  137. $navbar_padding_right = $woo_a3_gallery_settings[WOO_DYNAMIC_GALLERY_PREFIX.'navbar_padding_right']; 
  138.  
  139. $navbar_separator = $woo_a3_gallery_settings[WOO_DYNAMIC_GALLERY_PREFIX.'navbar_separator']; 
  140.  
  141. $caption_bg_color = $woo_a3_gallery_settings[WOO_DYNAMIC_GALLERY_PREFIX.'caption_bg_color']; 
  142. if ( ! isset( $caption_bg_color['enable'] ) ) { 
  143. $caption_bg_color['enable'] = 0; 
  144. $caption_bg_transparent = $woo_a3_gallery_settings[WOO_DYNAMIC_GALLERY_PREFIX.'caption_bg_transparent']; 
  145.  
  146. $transition_scroll_bar = $woo_a3_gallery_settings[WOO_DYNAMIC_GALLERY_PREFIX.'transition_scroll_bar']; 
  147.  
  148. if ( isset( $woo_a3_gallery_settings[WOO_DYNAMIC_GALLERY_PREFIX.'lazy_load_scroll'] ) ) { 
  149. $lazy_load_scroll = $woo_a3_gallery_settings[WOO_DYNAMIC_GALLERY_PREFIX.'lazy_load_scroll']; 
  150. } else { 
  151. $lazy_load_scroll = 'no'; 
  152.  
  153. $display_ctrl = ''; 
  154. if ( 'no' == $product_gallery_nav ) { 
  155. $display_ctrl = 'display:none !important;'; 
  156.  
  157. $popup_gallery = get_option( WOO_DYNAMIC_GALLERY_PREFIX.'popup_gallery' ); 
  158. $zoom_label = __('ZOOM +', 'woo_dgallery'); 
  159. if ($popup_gallery == 'deactivate') { 
  160. $lightbox_class = ''; 
  161. $zoom_label = ''; 
  162.  
  163. if ( isset( $woo_a3_gallery_settings[WOO_DYNAMIC_GALLERY_PREFIX.'enable_gallery_thumb'] ) ) { 
  164. $enable_gallery_thumb = $woo_a3_gallery_settings[WOO_DYNAMIC_GALLERY_PREFIX.'enable_gallery_thumb']; 
  165. } else { 
  166. $enable_gallery_thumb = 'no'; 
  167.  
  168. $thumb_border_color = $woo_a3_gallery_settings[WOO_DYNAMIC_GALLERY_PREFIX.'thumb_border_color']; 
  169. $thumb_current_border_color = $woo_a3_gallery_settings[WOO_DYNAMIC_GALLERY_PREFIX.'thumb_current_border_color']; 
  170.  
  171. echo '<style> 
  172. #TB_window{width:auto !important;} 
  173. .product_gallery .a3-dgallery { 
  174. margin-left: auto; 
  175. margin-right: auto; 
  176. .a3-dgallery .a3dg-image-wrapper { 
  177. '.$wc_dgallery_admin_interface->generate_background_color_css( $main_bg_color ).' 
  178. '.$wc_dgallery_admin_interface->generate_border_css( $main_border ).' 
  179. '.$wc_dgallery_admin_interface->generate_shadow_css( $main_shadow ).' 
  180. margin: '.$main_margin_top.'px '.$main_margin_right.'px '.$main_margin_bottom.'px '.$main_margin_left.'px !important; 
  181. padding: '.$main_padding_top.'px '.$main_padding_right.'px '.$main_padding_bottom.'px '.$main_padding_left.'px !important; 
  182. .a3-dgallery .a3dg-image-wrapper .a3dg-image{ 
  183. margin-top:'.$main_padding_top.'px !important; 
  184. .a3-dgallery .a3dg-thumbs li{ 
  185. margin-right: '.$g_thumb_spacing.'px !important; 
  186. }'; 
  187.  
  188. if ( 'static' == $thumb_show_type ) { 
  189. echo '.a3-dgallery .a3dg-thumbs li{ 
  190. margin-bottom: '.$g_thumb_spacing.'px !important; 
  191. }'; 
  192.  
  193. echo ' 
  194. /* Caption Text */ 
  195. .a3-dgallery .a3dg-image-wrapper .a3dg-image-description { 
  196. '.$wc_dgallery_fonts_face->generate_font_css( $caption_font ).' 
  197. '.$wc_dgallery_admin_interface->generate_background_color_css( $caption_bg_color, $caption_bg_transparent ).' 
  198. }'; 
  199.  
  200. if ( 'no' == $lazy_load_scroll ) { 
  201. echo '.a3-dgallery .lazy-load { 
  202. display: none !important; 
  203. }'; 
  204.  
  205. echo ' 
  206. /* Navbar Separator */ 
  207. .product_gallery .a3dg-navbar-separator { 
  208. '.str_replace( 'border', 'border-left', $wc_dgallery_admin_interface->generate_border_style_css( $navbar_separator ) ).' 
  209. margin-left: -'. ( (int)$navbar_separator['width'] / 2 ).'px; 
  210.  
  211. /* Navbar Control */ 
  212. .product_gallery .a3dg-navbar-control { 
  213. '.$display_ctrl.'; 
  214. '.$wc_dgallery_fonts_face->generate_font_css( $navbar_font ).' 
  215. '.$wc_dgallery_admin_interface->generate_background_color_css( $navbar_bg_color ).' 
  216. '.$wc_dgallery_admin_interface->generate_border_css( $navbar_border ).' 
  217. '.$wc_dgallery_admin_interface->generate_shadow_css( $navbar_shadow ).' 
  218. margin: '.$navbar_margin_top.'px '.$navbar_margin_right.'px '.$navbar_margin_bottom.'px '.$navbar_margin_left.'px !important; 
  219. width: calc( 100% - '.( $navbar_margin_left + $navbar_margin_right ).'px ); 
  220. .product_gallery .a3dg-navbar-control .slide-ctrl,  
  221. .product_gallery .a3dg-navbar-control .icon_zoom { 
  222. padding: '.$navbar_padding_top.'px '.$navbar_padding_right.'px '.$navbar_padding_bottom.'px '.$navbar_padding_left.'px !important; 
  223. }'; 
  224.  
  225. echo ' 
  226. /* Lazy Load Scroll */ 
  227. .a3-dgallery .lazy-load { 
  228. background-color: '.$transition_scroll_bar.' !important; 
  229.  
  230. .product_gallery .a3-dgallery .a3dg-thumbs li a { 
  231. border:1px solid '.$thumb_border_color.' !important; 
  232. .a3-dgallery .a3dg-thumbs li a.a3dg-active { 
  233. border: 1px solid '.$thumb_current_border_color.' !important; 
  234. }'; 
  235.  
  236. if ( 'deactivate' == $popup_gallery ) { 
  237. echo '.a3-dgallery .a3dg-image-wrapper .a3dg-image img { 
  238. cursor: default; 
  239. .a3-dgallery .a3dg-navbar-control { 
  240. width: calc( 50% - '.( ( $navbar_margin_left + $navbar_margin_right ) / 2 ).'px ) !important; 
  241. float: right; 
  242. .a3-dgallery .a3dg-navbar-control .slide-ctrl { 
  243. width: 100%; 
  244. .a3-dgallery .a3dg-navbar-separator,  
  245. .a3-dgallery .icon_zoom { 
  246. display: none; 
  247. }'; 
  248.  
  249. if ( 'no' == $enable_gallery_thumb ) { 
  250. echo '.a3dg-nav { 
  251. display:none; 
  252. height:1px; 
  253. .woocommerce .images { 
  254. margin-bottom: 15px; 
  255. }'; 
  256.  
  257. $icons_display_type = $woo_a3_gallery_settings[WOO_DYNAMIC_GALLERY_PREFIX . 'icons_display_type']; 
  258.  
  259. $nextpre_icons_size = get_option(WOO_DYNAMIC_GALLERY_PREFIX . 'nextpre_icons_size', 30 ); 
  260. $nextpre_icons_color = get_option(WOO_DYNAMIC_GALLERY_PREFIX . 'nextpre_icons_color', '#000'); 
  261. $nextpre_icons_background = get_option(WOO_DYNAMIC_GALLERY_PREFIX . 'nextpre_icons_background', array( 'enable' => 1, 'color' => '#FFF' ) ); 
  262. $nextpre_icons_opacity = get_option(WOO_DYNAMIC_GALLERY_PREFIX . 'nextpre_icons_opacity', 70 ); 
  263. $nextpre_icons_border = get_option(WOO_DYNAMIC_GALLERY_PREFIX . 'nextpre_icons_border', array( 'width' => '0px', 'style' => 'solid', 'color' => '#666', 'corner' => 'square' , 'top_left_corner' => 3 , 'top_right_corner' => 3 , 'bottom_left_corner' => 3 , 'bottom_right_corner' => 3 ) ); 
  264. $nextpre_icons_shadow = get_option(WOO_DYNAMIC_GALLERY_PREFIX . 'nextpre_icons_shadow', array( 'enable' => 0, 'h_shadow' => '0px' , 'v_shadow' => '1px', 'blur' => '0px' , 'spread' => '0px', 'color' => '#555555', 'inset' => 'inset' ) ); 
  265. $nextpre_icons_padding_top = get_option(WOO_DYNAMIC_GALLERY_PREFIX . 'nextpre_icons_padding_top', 5 ); 
  266. $nextpre_icons_padding_bottom = get_option(WOO_DYNAMIC_GALLERY_PREFIX . 'nextpre_icons_padding_bottom', 5 ); 
  267. $nextpre_icons_padding_left = get_option(WOO_DYNAMIC_GALLERY_PREFIX . 'nextpre_icons_padding_left', 5 ); 
  268. $nextpre_icons_padding_right = get_option(WOO_DYNAMIC_GALLERY_PREFIX . 'nextpre_icons_padding_right', 5 ); 
  269. $nextpre_icons_margin_left = get_option(WOO_DYNAMIC_GALLERY_PREFIX . 'nextpre_icons_margin_left', 10 ); 
  270. $nextpre_icons_margin_right = get_option(WOO_DYNAMIC_GALLERY_PREFIX . 'nextpre_icons_margin_right', 10 ); 
  271.  
  272. $pauseplay_icon_size = get_option(WOO_DYNAMIC_GALLERY_PREFIX . 'pauseplay_icon_size', 25 ); 
  273. $pauseplay_icon_color = get_option(WOO_DYNAMIC_GALLERY_PREFIX . 'pauseplay_icon_color', '#000'); 
  274. $pauseplay_icon_background = get_option(WOO_DYNAMIC_GALLERY_PREFIX . 'pauseplay_icon_background', array( 'enable' => 1, 'color' => '#FFF' ) ); 
  275. $pauseplay_icon_opacity = get_option(WOO_DYNAMIC_GALLERY_PREFIX . 'pauseplay_icon_opacity', 70 ); 
  276. $pauseplay_icon_border = get_option(WOO_DYNAMIC_GALLERY_PREFIX . 'pauseplay_icon_border', array( 'width' => '0px', 'style' => 'solid', 'color' => '#666', 'corner' => 'square' , 'top_left_corner' => 3 , 'top_right_corner' => 3 , 'bottom_left_corner' => 3 , 'bottom_right_corner' => 3 ) ); 
  277. $pauseplay_icon_shadow = get_option(WOO_DYNAMIC_GALLERY_PREFIX . 'pauseplay_icon_shadow', array( 'enable' => 0, 'h_shadow' => '0px' , 'v_shadow' => '1px', 'blur' => '0px' , 'spread' => '0px', 'color' => '#555555', 'inset' => 'inset' ) ); 
  278. $pauseplay_icon_padding_top = get_option(WOO_DYNAMIC_GALLERY_PREFIX . 'pauseplay_icon_padding_top', 10 ); 
  279. $pauseplay_icon_padding_bottom = get_option(WOO_DYNAMIC_GALLERY_PREFIX . 'pauseplay_icon_padding_bottom', 10 ); 
  280. $pauseplay_icon_padding_left = get_option(WOO_DYNAMIC_GALLERY_PREFIX . 'pauseplay_icon_padding_left', 10 ); 
  281. $pauseplay_icon_padding_right = get_option(WOO_DYNAMIC_GALLERY_PREFIX . 'pauseplay_icon_padding_right', 10 ); 
  282. $pauseplay_icon_margin_top = get_option(WOO_DYNAMIC_GALLERY_PREFIX . 'pauseplay_icon_margin_top', 10 ); 
  283. $pauseplay_icon_margin_bottom = get_option(WOO_DYNAMIC_GALLERY_PREFIX . 'pauseplay_icon_margin_bottom', 10 ); 
  284. $pauseplay_icon_margin_left = get_option(WOO_DYNAMIC_GALLERY_PREFIX . 'pauseplay_icon_margin_left', 10 ); 
  285. $pauseplay_icon_margin_right = get_option(WOO_DYNAMIC_GALLERY_PREFIX . 'pauseplay_icon_margin_right', 10 ); 
  286. $pauseplay_icon_vertical_position = get_option(WOO_DYNAMIC_GALLERY_PREFIX . 'pauseplay_icon_vertical_position', 'center' ); 
  287. $pauseplay_icon_horizontal_position = get_option(WOO_DYNAMIC_GALLERY_PREFIX . 'pauseplay_icon_horizontal_position', 'center' ); 
  288.  
  289. $thumb_nextpre_icons_size = get_option(WOO_DYNAMIC_GALLERY_PREFIX . 'thumb_nextpre_icons_size', 20 ); 
  290. $thumb_nextpre_icons_color = get_option(WOO_DYNAMIC_GALLERY_PREFIX . 'thumb_nextpre_icons_color', '#000'); 
  291. $thumb_nextpre_icons_background = get_option(WOO_DYNAMIC_GALLERY_PREFIX . 'thumb_nextpre_icons_background', array( 'enable' => 1, 'color' => '#FFF' ) ); 
  292. $thumb_nextpre_icons_border = get_option(WOO_DYNAMIC_GALLERY_PREFIX . 'thumb_nextpre_icons_border', array( 'width' => '1px', 'style' => 'solid', 'color' => '#666', 'corner' => 'square' , 'top_left_corner' => 3 , 'top_right_corner' => 3 , 'bottom_left_corner' => 3 , 'bottom_right_corner' => 3 ) ); 
  293. $thumb_nextpre_icons_shadow = get_option(WOO_DYNAMIC_GALLERY_PREFIX . 'thumb_nextpre_icons_shadow', array( 'enable' => 0, 'h_shadow' => '0px' , 'v_shadow' => '1px', 'blur' => '0px' , 'spread' => '0px', 'color' => '#555555', 'inset' => 'inset' ) ); 
  294. $thumb_nextpre_icons_padding_left = get_option(WOO_DYNAMIC_GALLERY_PREFIX . 'thumb_nextpre_icons_padding_left', 5 ); 
  295. $thumb_nextpre_icons_padding_right = get_option(WOO_DYNAMIC_GALLERY_PREFIX . 'thumb_nextpre_icons_padding_right', 5 ); 
  296.  
  297. $thumb_slider_background = $woo_a3_gallery_settings[WOO_DYNAMIC_GALLERY_PREFIX . 'thumb_slider_background']; 
  298. $thumb_slider_border = $woo_a3_gallery_settings[WOO_DYNAMIC_GALLERY_PREFIX . 'thumb_slider_border']; 
  299. $thumb_slider_shadow = $woo_a3_gallery_settings[WOO_DYNAMIC_GALLERY_PREFIX . 'thumb_slider_shadow']; 
  300.  
  301. if ( 'show' == $icons_display_type ) { 
  302. echo ' 
  303. .a3dg-image-wrapper .slide-ctrl,  
  304. .a3-dgallery .a3dg-image-wrapper .a3dg-next,  
  305. .a3-dgallery .a3dg-image-wrapper .a3dg-prev { 
  306. display: block !important; 
  307. }'; 
  308.  
  309. echo ' 
  310. /* Next / Previous Icons */ 
  311. .a3-dgallery .fa-caret-left:before,  
  312. .a3-dgallery .fa-caret-right:before { 
  313. font-size: ' . $nextpre_icons_size . 'px !important; 
  314. color: ' . $nextpre_icons_color . ' !important; 
  315. .a3-dgallery .a3dg-image-wrapper .a3dg-next,  
  316. .a3-dgallery .a3dg-image-wrapper .a3dg-prev { 
  317. ' . $wc_dgallery_admin_interface->generate_background_color_css( $nextpre_icons_background ) . ' 
  318. ' . $wc_dgallery_admin_interface->generate_border_css( $nextpre_icons_border ) . ' 
  319. ' . $wc_dgallery_admin_interface->generate_shadow_css( $nextpre_icons_shadow ) . ' 
  320. padding: ' . $nextpre_icons_padding_top . 'px ' . $nextpre_icons_padding_right . 'px ' . $nextpre_icons_padding_bottom . 'px ' . $nextpre_icons_padding_left . 'px !important; 
  321. }'; 
  322.  
  323. if ( isset( $nextpre_icons_background['enable'] ) && 0 == $nextpre_icons_background['enable'] ) { 
  324. echo ' 
  325. .a3-dgallery .a3dg-image-wrapper .a3dg-next,  
  326. .a3-dgallery .a3dg-image-wrapper .a3dg-prev { 
  327. opacity: 1 !important; 
  328. }'; 
  329. } else { 
  330. echo ' 
  331. .a3-dgallery .a3dg-image-wrapper .a3dg-next,  
  332. .a3-dgallery .a3dg-image-wrapper .a3dg-prev { 
  333. opacity: ' . ( $nextpre_icons_opacity / 100 ) . ' !important; 
  334. }'; 
  335.  
  336. echo ' 
  337. .a3-dgallery .a3dg-image-wrapper .a3dg-prev { 
  338. left: ' . $nextpre_icons_margin_left . 'px !important; 
  339. .a3-dgallery .a3dg-image-wrapper .a3dg-next { 
  340. right: ' . $nextpre_icons_margin_right . 'px !important; 
  341. '; 
  342.  
  343. echo ' 
  344. /* Pause | Play icon */ 
  345. .a3-dgallery .fa-pause:before,  
  346. .a3-dgallery .fa-play:before { 
  347. font-size: ' . $pauseplay_icon_size . 'px !important; 
  348. color: ' . $pauseplay_icon_color . ' !important; 
  349.  
  350. .a3dg-image-wrapper .slide-ctrl .a3dg-slideshow-start-slide,  
  351. .a3dg-image-wrapper .slide-ctrl .a3dg-slideshow-stop-slide { 
  352. ' . $wc_dgallery_admin_interface->generate_background_color_css( $pauseplay_icon_background ) . ' 
  353. ' . $wc_dgallery_admin_interface->generate_border_css( $pauseplay_icon_border ) . ' 
  354. ' . $wc_dgallery_admin_interface->generate_shadow_css( $pauseplay_icon_shadow ) . ' 
  355. padding: ' . $pauseplay_icon_padding_top . 'px ' . $pauseplay_icon_padding_right . 'px ' . $pauseplay_icon_padding_bottom . 'px ' . $pauseplay_icon_padding_left . 'px !important; 
  356. }'; 
  357.  
  358. if ( isset( $pauseplay_icon_background['enable'] ) && 0 == $pauseplay_icon_background['enable'] ) { 
  359. echo ' 
  360. .a3dg-image-wrapper .slide-ctrl .a3dg-slideshow-start-slide,  
  361. .a3dg-image-wrapper .slide-ctrl .a3dg-slideshow-stop-slide { 
  362. opacity: 1 !important; 
  363. }'; 
  364. } else { 
  365. echo ' 
  366. .a3dg-image-wrapper .slide-ctrl .a3dg-slideshow-start-slide,  
  367. .a3dg-image-wrapper .slide-ctrl .a3dg-slideshow-stop-slide { 
  368. opacity: ' . ( $pauseplay_icon_opacity / 100 ) . ' !important; 
  369. }'; 
  370.  
  371. echo ' 
  372. .a3dg-image-wrapper .slide-ctrl {'; 
  373.  
  374. if ( 'top' == $pauseplay_icon_vertical_position ) { 
  375. echo ' 
  376. top: 0 !important; 
  377. margin-top: ' . $pauseplay_icon_margin_top . 'px !important;'; 
  378. } elseif ( 'bottom' == $pauseplay_icon_vertical_position ) { 
  379. echo ' 
  380. top: auto !important; 
  381. bottom: 0 !important; 
  382. margin-bottom: ' . $pauseplay_icon_margin_bottom . 'px !important;'; 
  383.  
  384. if ( 'left' == $pauseplay_icon_horizontal_position ) { 
  385. echo ' 
  386. left: 0 !important; 
  387. margin-left: ' . $pauseplay_icon_margin_left . 'px !important;'; 
  388. } elseif ( 'right' == $pauseplay_icon_horizontal_position ) { 
  389. echo ' 
  390. left: auto !important; 
  391. right: 0 !important; 
  392. margin-right: ' . $pauseplay_icon_margin_right . 'px !important;'; 
  393.  
  394. echo '}'; 
  395.  
  396. echo ' 
  397. /* Thumbnail Slider Next / Previous icons */ 
  398. .a3-dgallery .fa-angle-left:before,  
  399. .a3-dgallery .fa-angle-right:before { 
  400. font-size: ' . $thumb_nextpre_icons_size . 'px !important; 
  401. color: ' . $thumb_nextpre_icons_color . ' !important; 
  402.  
  403. .a3-dgallery .a3dg-forward,  
  404. .a3-dgallery .a3dg-back { 
  405. ' . $wc_dgallery_admin_interface->generate_background_color_css( $thumb_nextpre_icons_background ) . ' 
  406. ' . $wc_dgallery_admin_interface->generate_border_css( $thumb_nextpre_icons_border ) . ' 
  407. ' . $wc_dgallery_admin_interface->generate_shadow_css( $thumb_nextpre_icons_shadow ) . ' 
  408. padding-left: ' . $thumb_nextpre_icons_padding_left . 'px !important; 
  409. padding-right: ' . $thumb_nextpre_icons_padding_right . 'px !important; 
  410. }'; 
  411.  
  412. if ( 'slider' == $thumb_show_type ) { 
  413. echo ' 
  414. /* Thumbnail Slider Container */ 
  415. .a3-dgallery .a3dg-nav { 
  416. ' . $wc_dgallery_admin_interface->generate_background_color_css( $thumb_slider_background ) . ' 
  417. ' . $wc_dgallery_admin_interface->generate_border_css( $thumb_slider_border ) . ' 
  418. ' . $wc_dgallery_admin_interface->generate_shadow_css( $thumb_slider_shadow ) . ' 
  419. }'; 
  420.  
  421. echo ' 
  422. </style>'; 
  423.  
  424. echo '<script type="text/javascript"> 
  425. jQuery(function() { 
  426. var settings_defaults_'.$post->ID.' = { loader_image: "'.WOO_DYNAMIC_GALLERY_JS_URL.'/mygallery/loader.gif",  
  427. start_at_index: 0,  
  428. gallery_ID: "'.$post->ID.'",  
  429. lightbox_class: "'.$lightbox_class.'",  
  430. description_wrapper: false,  
  431. thumb_opacity: 0.5,  
  432. animate_first_image: false,  
  433. animation_speed: '.$g_animation_speed.'000,  
  434. width: false,  
  435. height: false,  
  436. display_next_and_prev: true,  
  437. display_back_and_forward: '.$display_back_and_forward.',  
  438. scroll_jump: 0,  
  439. slideshow: { 
  440. enable: true,  
  441. autostart: '.$g_auto.',  
  442. speed: '.$g_speed.'000,  
  443. start_label: "'.__('START SLIDESHOW', 'woo_dgallery').'",  
  444. stop_label: "'.__('STOP SLIDESHOW', 'woo_dgallery').'",  
  445. zoom_label: "'.$zoom_label.'",  
  446. stop_on_scroll: true,  
  447. countdown_prefix: "(",  
  448. countdown_sufix: ")",  
  449. onStart: false,  
  450. onStop: false 
  451. },  
  452. effect: "'.$g_effect.'",  
  453. enable_keyboard_move: true,  
  454. cycle: true,  
  455. callbacks: { 
  456. init: false,  
  457. afterImageVisible: false,  
  458. beforeImageVisible: false 
  459. }; 
  460. jQuery("#gallery_'.$post->ID.'").adGallery(settings_defaults_'.$post->ID.'); 
  461. }); 
  462. </script>'; 
  463. echo '<div id="gallery_'.$post->ID.'" 
  464. class="a3-dgallery" 
  465. data-height_type="'. esc_attr( $gallery_height_type ).'" 
  466. data-show_navbar_control="'. esc_attr( $product_gallery_nav ) .'" 
  467. data-show_thumb="'. esc_attr( $enable_gallery_thumb ) .'" 
  468. data-hide_one_thumb="yes" 
  469. data-thumb_show_type="'. esc_attr( $thumb_show_type ) .'" 
  470. data-thumb_visible="'. esc_attr( $thumb_columns ) .'" 
  471. data-thumb_spacing="'. esc_attr( $g_thumb_spacing ) .'" 
  472. style="width: 100%; 
  473. max-width: '.$g_width.';" 
  474. <div class="a3dg-image-wrapper" style="width: calc(100% - '.( (int) $main_margin_left + (int) $main_margin_right ).'px);' . ( ( $g_height != false ) ? 'height: '.$g_height.'px;' : '' ) . '"></div> 
  475. <div class="lazy-load"></div> 
  476. <div style="clear: both"></div> 
  477. <div class="a3dg-navbar-control"><div class="a3dg-navbar-separator"></div></div> 
  478. <div style="clear: both"></div> 
  479. <div class="a3dg-nav"> 
  480. <div class="fa fa-angle-left a3dg-back"></div> 
  481. <div class="fa fa-angle-right a3dg-forward"></div> 
  482. <div class="a3dg-thumbs '.$thumbs_list_class.'"> 
  483. <ul class="a3dg-thumb-list">'; 
  484.  
  485. $url_demo_img = '/assets/js/mygallery/images/'; 
  486. $imgs = array($url_demo_img.'image_1.jpg', $url_demo_img.'image_2.jpg', $url_demo_img.'image_3.jpg', $url_demo_img.'image_4.jpg'); 
  487.  
  488. $script_colorbox = ''; 
  489. $script_fancybox = ''; 
  490. if ( !empty( $imgs ) ) {  
  491. $i = 0; 
  492. $display = ''; 
  493.  
  494. if(is_array($imgs) && count($imgs)>0) { 
  495. $script_colorbox .= '<script type="text/javascript">'; 
  496. $script_fancybox .= '<script type="text/javascript">'; 
  497. $script_colorbox .= '(function($) {';  
  498. $script_fancybox .= '(function($) {'; 
  499. $script_colorbox .= '$(function() {'; 
  500. $script_fancybox .= '$(function() {'; 
  501. $script_colorbox .= '$(document).on("click", ".a3-dgallery .lightbox", function(ev) { if( $(this).attr("rel") == "gallery_'.$post->ID.'") { 
  502. var idx = $(".a3dg-image img").attr("idx");'; 
  503. $script_fancybox .= '$(document).on("click", ".a3-dgallery .lightbox", function(ev) { if( $(this).attr("rel") == "gallery_'.$post->ID.'") { 
  504. var idx = $(".a3dg-image img").attr("idx");'; 
  505.  
  506. if(count($imgs) <= 1 ) { 
  507. $script_colorbox .= '$(".gallery_product_'.$post->ID.'").colorbox({open:true, maxWidth:"100%" });'; 
  508. $script_fancybox .= '$.fancybox('; 
  509. }else{ 
  510. $script_colorbox .= '$(".gallery_product_'.$post->ID.'").colorbox({rel:"gallery_product_'.$post->ID.'", maxWidth:"100%" }); $(".gallery_product_'.$post->ID.'_"+idx).colorbox({open:true, maxWidth:"100%" });'; 
  511. $script_fancybox .= '$.fancybox(['; 
  512.  
  513. $common = ''; 
  514. $idx = 0; 
  515. foreach($imgs as $item_thumb) { 
  516. $li_class = ''; 
  517. if ( 'static' == $thumb_show_type ) { 
  518. if ( $idx % $thumb_columns == 0 ) { 
  519. $li_class = 'first_item'; 
  520. } elseif ( ( $idx % $thumb_columns + 1 ) == $thumb_columns ) { 
  521. $li_class = 'last_item'; 
  522. } else { 
  523. if ( $idx == 0) { 
  524. $li_class = 'first_item'; 
  525. } elseif ( $idx == count( $imgs ) - 1 ) { 
  526. $li_class = 'last_item'; 
  527. $image_attribute = getimagesize( WOO_DYNAMIC_GALLERY_DIR.$item_thumb); 
  528. $image_lager_default_url = WOO_DYNAMIC_GALLERY_URL.$item_thumb; 
  529.  
  530.  
  531. $thumb_height = $g_thumb_height; 
  532. $thumb_width = $g_thumb_width; 
  533. $width_old = $image_attribute[0]; 
  534. $height_old = $image_attribute[1]; 
  535. if($width_old > $g_thumb_width || $height_old > $g_thumb_height) { 
  536. if($height_old > $g_thumb_height && $g_thumb_height > 0) { 
  537. $factor = ($height_old / $g_thumb_height); 
  538. $thumb_height = $g_thumb_height; 
  539. $thumb_width = $width_old / $factor; 
  540. if($thumb_width > $g_thumb_width && $g_thumb_width > 0) { 
  541. $factor = ($width_old / $g_thumb_width); 
  542. $thumb_height = $height_old / $factor; 
  543. $thumb_width = $g_thumb_width; 
  544. }elseif($thumb_width == $g_thumb_width && $width_old > $g_thumb_width && $g_thumb_width > 0) { 
  545. $factor = ($width_old / $g_thumb_width); 
  546. $thumb_height = $height_old / $factor; 
  547. $thumb_width = $g_thumb_width; 
  548. }  
  549. }else{ 
  550. $thumb_height = $height_old; 
  551. $thumb_width = $width_old; 
  552.  
  553.  
  554.  
  555. $img_description = 'Lorem Ipsum is simply dummy text of the printing and typesetting industry.'; 
  556.  
  557. echo '<li class="'.$li_class.'">'; 
  558. echo '<a class="gallery_product_'.$post->ID.' gallery_product_'.$post->ID.'_'.$idx.'" title="'. esc_attr( $img_description ) .'" rel="gallery_product_'.$post->ID.'" href="'.$image_lager_default_url.'">'; 
  559. echo '<img 
  560. org-sizes="" 
  561. org-srcset="" 
  562. sizes="" 
  563. srcset="" 
  564. idx="'.$idx.'" 
  565. src="'.$image_lager_default_url.'" 
  566. alt="'. esc_attr( $img_description ) .'" 
  567. class="image'.$i.'" 
  568. width="'.$thumb_width.'" 
  569. height="'.$thumb_height.'">'; 
  570. echo '</a>'; 
  571. echo '</li>'; 
  572. $img_description = esc_js( $img_description ); 
  573. if($img_description != '') { 
  574. $script_fancybox .= $common.'{href:"'.$image_lager_default_url.'", title:"'.$img_description.'"}'; 
  575. }else{ 
  576. $script_fancybox .= $common.'{href:"'.$image_lager_default_url.'", title:""}'; 
  577. $common = ', '; 
  578. $i++; 
  579. $idx++; 
  580.  
  581. //$.fancybox([ {href : 'img1.jpg', title : 'Title'}, {href : 'img2.jpg', title : 'Title'} ]) 
  582. if(count($imgs) <= 1 ) { 
  583. $script_fancybox .= ');'; 
  584. }else{ 
  585. $script_fancybox .= '], { 
  586. \'index\': idx 
  587. });'; 
  588. $script_colorbox .= 'ev.preventDefault();'; 
  589. $script_colorbox .= '} });'; 
  590. $script_fancybox .= '} });'; 
  591. $script_colorbox .= '});'; 
  592. $script_fancybox .= '});'; 
  593. $script_colorbox .= '})(jQuery);'; 
  594. $script_fancybox .= '})(jQuery);'; 
  595. $script_colorbox .= '</script>'; 
  596. $script_fancybox .= '</script>'; 
  597. } else { 
  598. $no_image_uri = WC_Dynamic_Gallery_Functions::get_no_image_uri(); 
  599. echo '<li> <a class="lightbox" rel="gallery_product_'.$post->ID.'" href="'.$no_image_uri.'"> <img src="'.$no_image_uri.'" class="image" alt=""> </a> </li>'; 
  600.  
  601. if ($popup_gallery == 'deactivate') { 
  602. $script_colorbox = ''; 
  603. $script_fancybox = ''; 
  604. } else if($popup_gallery == 'colorbox') { 
  605. echo $script_colorbox; 
  606. } else { 
  607. echo $script_fancybox; 
  608. echo '</ul> 
  609. </div> 
  610. </div> 
  611. </div>'; 
  612. ?> 
  613. </div> 
  614. </div> 
  615. <?php 
  616. die();