WC_Dynamic_Gallery_Style_Settings

The WooCommerce Dynamic Gallery LITE WC Dynamic Gallery Style Settings class.

Defined (1)

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

/admin/settings/gallery-style-settings.php  
  1. class WC_Dynamic_Gallery_Style_Settings extends WC_Dynamic_Gallery_Admin_UI 
  2.  
  3. /** 
  4. * @var string 
  5. */ 
  6. private $parent_tab = 'gallery-style'; 
  7.  
  8. /** 
  9. * @var array 
  10. */ 
  11. private $subtab_data; 
  12.  
  13. /** 
  14. * @var string 
  15. * You must change to correct option name that you are working 
  16. */ 
  17. public $option_name = ''; 
  18.  
  19. /** 
  20. * @var string 
  21. * You must change to correct form key that you are working 
  22. */ 
  23. public $form_key = 'wc_dgallery_style_settings'; 
  24.  
  25. /** 
  26. * @var string 
  27. * You can change the order show of this sub tab in list sub tabs 
  28. */ 
  29. private $position = 1; 
  30.  
  31. /** 
  32. * @var array 
  33. */ 
  34. public $form_fields = array(); 
  35.  
  36. /** 
  37. * @var array 
  38. */ 
  39. public $form_messages = array(); 
  40.  
  41. /**-----------------------------------------------------------------------------------*/ 
  42. /** __construct() */ 
  43. /** Settings Constructor */ 
  44. /**-----------------------------------------------------------------------------------*/ 
  45. public function __construct() { 
  46. $this->init_form_fields(); 
  47. $this->subtab_init(); 
  48.  
  49. $this->form_messages = array( 
  50. 'success_message' => __( 'Dynamic Gallery Style successfully saved.', 'woo_dgallery' ),  
  51. 'error_message' => __( 'Error: Dynamic Gallery Style can not save.', 'woo_dgallery' ),  
  52. 'reset_message' => __( 'Dynamic Gallery Style successfully reseted.', 'woo_dgallery' ),  
  53. ); 
  54.  
  55. add_action( $this->plugin_name . '-' . $this->form_key . '_settings_end', array( $this, 'include_script' ) ); 
  56.  
  57. add_action( $this->plugin_name . '_set_default_settings' , array( $this, 'set_default_settings' ) ); 
  58.  
  59. add_action( $this->plugin_name . '-' . $this->form_key . '_after_settings_save' , array( $this, 'reset_default_settings' ) ); 
  60.  
  61. add_action( $this->plugin_name . '-' . $this->form_key . '_settings_init' , array( $this, 'after_save_settings' ) ); 
  62. //add_action( $this->plugin_name . '_get_all_settings' , array( $this, 'get_settings' ) ); 
  63.  
  64. add_action('wp_ajax_woo_dynamic_gallery', array('WC_Gallery_Preview_Display', 'wc_dynamic_gallery_preview')); 
  65. add_action('wp_ajax_nopriv_woo_dynamic_gallery', array('WC_Gallery_Preview_Display', 'wc_dynamic_gallery_preview')); 
  66.  
  67. /**-----------------------------------------------------------------------------------*/ 
  68. /** subtab_init() */ 
  69. /** Sub Tab Init */ 
  70. /**-----------------------------------------------------------------------------------*/ 
  71. public function subtab_init() { 
  72.  
  73. add_filter( $this->plugin_name . '-' . $this->parent_tab . '_settings_subtabs_array', array( $this, 'add_subtab' ), $this->position ); 
  74.  
  75.  
  76. /**-----------------------------------------------------------------------------------*/ 
  77. /** set_default_settings() 
  78. /** Set default settings with function called from Admin Interface */ 
  79. /**-----------------------------------------------------------------------------------*/ 
  80. public function set_default_settings() { 
  81. global $wc_dgallery_admin_interface; 
  82.  
  83. $wc_dgallery_admin_interface->reset_settings( $this->form_fields, $this->option_name, false ); 
  84.  
  85. /**-----------------------------------------------------------------------------------*/ 
  86. /** after_save_settings() 
  87. /** Process when clean on deletion option is un selected */ 
  88. /**-----------------------------------------------------------------------------------*/ 
  89. public function after_save_settings() { 
  90. if ( isset( $_POST['bt_save_settings'] ) && isset( $_POST[WOO_DYNAMIC_GALLERY_PREFIX.'reset_thumbnails_activate'] ) ) { 
  91. delete_option( WOO_DYNAMIC_GALLERY_PREFIX.'reset_thumbnails_activate' ); 
  92. WC_Dynamic_Gallery_Functions::reset_thumbnails_activate();  
  93.  
  94. /**-----------------------------------------------------------------------------------*/ 
  95. /** reset_default_settings() 
  96. /** Reset default settings with function called from Admin Interface */ 
  97. /**-----------------------------------------------------------------------------------*/ 
  98. public function reset_default_settings() { 
  99. global $wc_dgallery_admin_interface; 
  100.  
  101. $wc_dgallery_admin_interface->reset_settings( $this->form_fields, $this->option_name, true, true ); 
  102.  
  103. /**-----------------------------------------------------------------------------------*/ 
  104. /** get_settings() 
  105. /** Get settings with function called from Admin Interface */ 
  106. /**-----------------------------------------------------------------------------------*/ 
  107. public function get_settings() { 
  108. global $wc_dgallery_admin_interface; 
  109.  
  110. $wc_dgallery_admin_interface->get_settings( $this->form_fields, $this->option_name ); 
  111.  
  112. /** 
  113. * subtab_data() 
  114. * Get SubTab Data 
  115. * ============================================= 
  116. * array (  
  117. * 'name' => 'my_subtab_name' : (required) Enter your subtab name that you want to set for this subtab 
  118. * 'label' => 'My SubTab Name' : (required) Enter the subtab label 
  119. * 'callback_function' => 'my_callback_function' : (required) The callback function is called to show content of this subtab 
  120. * ) 
  121. */ 
  122. public function subtab_data() { 
  123.  
  124. $subtab_data = array(  
  125. 'name' => 'gallery-style',  
  126. 'label' => __( 'Gallery Style', 'woo_dgallery' ),  
  127. 'callback_function' => 'wc_dgallery_style_settings_form',  
  128. ); 
  129.  
  130. if ( $this->subtab_data ) return $this->subtab_data; 
  131. return $this->subtab_data = $subtab_data; 
  132.  
  133.  
  134. /**-----------------------------------------------------------------------------------*/ 
  135. /** add_subtab() */ 
  136. /** Add Subtab to Admin Init 
  137. /**-----------------------------------------------------------------------------------*/ 
  138. public function add_subtab( $subtabs_array ) { 
  139.  
  140. if ( ! is_array( $subtabs_array ) ) $subtabs_array = array(); 
  141. $subtabs_array[] = $this->subtab_data(); 
  142.  
  143. return $subtabs_array; 
  144.  
  145. /**-----------------------------------------------------------------------------------*/ 
  146. /** settings_form() */ 
  147. /** Call the form from Admin Interface 
  148. /**-----------------------------------------------------------------------------------*/ 
  149. public function settings_form() { 
  150. global $wc_dgallery_admin_interface; 
  151.  
  152. $output = ''; 
  153. $output .= $wc_dgallery_admin_interface->admin_forms( $this->form_fields, $this->form_key, $this->option_name, $this->form_messages ); 
  154.  
  155. return $output; 
  156.  
  157. // fix conflict with mandrill plugin 
  158. public function remove_mandrill_notice() { 
  159. remove_action( 'admin_notices', array( 'wpMandrill', 'adminNotices' ) ); 
  160.  
  161. /**-----------------------------------------------------------------------------------*/ 
  162. /** init_form_fields() */ 
  163. /** Init all fields of this form */ 
  164. /**-----------------------------------------------------------------------------------*/ 
  165. public function init_form_fields() { 
  166. add_action( 'admin_enqueue_scripts', array( 'WC_Gallery_Display_Class', 'backend_register_scripts' ) ); 
  167.  
  168. // Define settings  
  169. $this->form_fields = array( 
  170.  
  171. array( 
  172. 'name' => '',  
  173. 'desc' => '<a href="'. admin_url( 'admin-ajax.php', 'relative') .'?act=preview-dgallery" class="preview_gallery">' . __( 'Click here to preview gallery', 'woo_dgallery' ) . '</a>',  
  174. 'type' => 'heading',  
  175. ),  
  176.  
  177. array( 
  178. 'name' => __('Gallery Dimensions', 'woo_dgallery'),  
  179. 'type' => 'heading',  
  180. 'id' => 'wc_dgallery_dimensions_box',  
  181. 'is_box' => true,  
  182. ),  
  183.  
  184. array(  
  185. 'name' => __( 'Gallery Type', 'woo_dgallery' ),  
  186. 'id' => WOO_DYNAMIC_GALLERY_PREFIX . 'width_type',  
  187. 'class' => 'gallery_width_type',  
  188. 'type' => 'switcher_checkbox',  
  189. 'default' => '%',  
  190. 'free_version' => true,  
  191. 'checked_value' => '%',  
  192. 'unchecked_value' => 'px',  
  193. 'checked_label' => __( 'Responsive', 'woo_dgallery' ),  
  194. 'unchecked_label' => __( 'Fixed Wide', 'woo_dgallery' ),  
  195. ),  
  196.  
  197. array( 
  198. 'class' => 'gallery_width_type_percent',  
  199. 'type' => 'heading',  
  200. ),  
  201. array(  
  202. 'name' => __( 'Gallery Width', 'woo_dgallery' ),  
  203. 'id' => WOO_DYNAMIC_GALLERY_PREFIX . 'product_gallery_width_responsive',  
  204. 'desc' => '%' . '</span></div><div style="clear:both;"></div><div><span>' . __( 'of the width of your themes Product Page Product Gallery container', 'woo_dgallery' ),  
  205. 'type' => 'slider',  
  206. 'default' => 100,  
  207. 'min' => 20,  
  208. 'max' => 100,  
  209. 'increment' => 1,  
  210. 'free_version' => true,  
  211. ),  
  212.  
  213. array( 
  214. 'class' => 'gallery_width_type_fixed',  
  215. 'type' => 'heading',  
  216. ),  
  217. array(  
  218. 'name' => __( 'Gallery Width', 'woo_dgallery' ),  
  219. 'id' => WOO_DYNAMIC_GALLERY_PREFIX . 'product_gallery_width_fixed',  
  220. 'desc' => 'px. ' . __( 'Fixed maximum width in large screens. Width will scale to screen size in mobile browsers', 'woo_dgallery' ),  
  221. 'type' => 'text',  
  222. 'default' => 320,  
  223. 'free_version' => true,  
  224. 'css' => 'width:40px;',  
  225. ),  
  226.  
  227. array( 
  228. 'type' => 'heading',  
  229. ),  
  230. array( 
  231. 'name' => __( 'Gallery Container Height', 'woo_dgallery' ),  
  232. 'id' => WOO_DYNAMIC_GALLERY_PREFIX . 'gallery_height_type',  
  233. 'desc' => __( 'Dynamic and Gallery Container height will auto adjust to the scaled height of each image.', 'woo_dgallery' ),  
  234. 'class' => 'gallery_height_type',  
  235. 'type' => 'switcher_checkbox',  
  236. 'default' => 'fixed',  
  237. 'checked_value' => 'fixed',  
  238. 'unchecked_value' => 'dynamic',  
  239. 'checked_label' => __( 'FIXED', 'woo_dgallery' ),  
  240. 'unchecked_label' => __( 'DYNAMIC', 'woo_dgallery' ),  
  241. 'free_version' => true,  
  242. ),  
  243.  
  244. array( 
  245. 'class' => 'gallery_height_type_fixed',  
  246. 'type' => 'heading',  
  247. ),  
  248. array(  
  249. 'name' => __( 'Gallery Height', 'woo_dgallery' ),  
  250. 'desc' => 'px',  
  251. 'id' => WOO_DYNAMIC_GALLERY_PREFIX.'product_gallery_height',  
  252. 'type' => 'text',  
  253. 'default' => 215,  
  254. 'free_version' => true,  
  255. 'css' => 'width:40px;',  
  256. ),  
  257.  
  258. array(  
  259. 'name' => __('Gallery Image Transition Effects', 'woo_dgallery'),  
  260. 'desc' => __( 'Note! These settings DO NOT apply to mobile and tablet when the + Mobile and Tablet Touch Swipe feature is switched on.', 'woo_dgallery' ),  
  261. 'type' => 'heading',  
  262. 'id' => 'wc_dgallery_effects_box',  
  263. 'is_box' => true,  
  264. ),  
  265. array(  
  266. 'name' => __( 'Auto Start', 'woo_dgallery' ),  
  267. 'desc' => '',  
  268. 'id' => WOO_DYNAMIC_GALLERY_PREFIX.'product_gallery_auto_start',  
  269. 'default' => 'true',  
  270. 'type' => 'onoff_checkbox',  
  271. 'checked_value' => 'true',  
  272. 'unchecked_value' => 'false',  
  273. 'checked_label' => __( 'ON', 'woo_dgallery' ),  
  274. 'unchecked_label' => __( 'OFF', 'woo_dgallery' ),  
  275. 'free_version' => true,  
  276. ),  
  277. array(  
  278. 'name' => __( 'Slide Transition Effect', 'woo_dgallery' ),  
  279. 'desc' => '',  
  280. 'id' => WOO_DYNAMIC_GALLERY_PREFIX.'product_gallery_effect',  
  281. 'css' => 'width:120px;',  
  282. 'default' => 'slide-vert',  
  283. 'type' => 'select',  
  284. 'options' => array(  
  285. 'none' => __( 'None', 'woo_dgallery' ),  
  286. 'fade' => __( 'Fade', 'woo_dgallery' ),  
  287. 'slide-hori' => __( 'Slide Hori', 'woo_dgallery' ),  
  288. 'slide-vert' => __( 'Slide Vert', 'woo_dgallery' ),  
  289. 'resize' => __( 'Resize', 'woo_dgallery' ),  
  290. ),  
  291. 'free_version' => true,  
  292. ),  
  293. array(  
  294. 'name' => __( 'Time Between Transitions', 'woo_dgallery' ),  
  295. 'desc' => 'seconds',  
  296. 'id' => WOO_DYNAMIC_GALLERY_PREFIX.'product_gallery_speed',  
  297. 'type' => 'slider',  
  298. 'default' => 4,  
  299. 'min' => 1,  
  300. 'max' => 10,  
  301. 'increment' => 1,  
  302. 'free_version' => true,  
  303. ),  
  304. array(  
  305. 'name' => __( 'Transition Effect Speed', 'woo_dgallery' ),  
  306. 'desc' => 'seconds',  
  307. 'id' => WOO_DYNAMIC_GALLERY_PREFIX.'product_gallery_animation_speed',  
  308. 'type' => 'slider',  
  309. 'default' => 2,  
  310. 'min' => 1,  
  311. 'max' => 10,  
  312. 'increment' => 1,  
  313. 'free_version' => true,  
  314. ),  
  315.  
  316. array(  
  317. 'name' => __( 'Single Image Transition', 'woo_dgallery' ),  
  318. 'desc' => __( 'ON to auto deactivate image transition effect when only 1 image is loaded to gallery.', 'woo_dgallery' ),  
  319. 'id' => WOO_DYNAMIC_GALLERY_PREFIX.'stop_scroll_1image',  
  320. 'default' => 'no',  
  321. 'type' => 'onoff_checkbox',  
  322. 'checked_value' => 'yes',  
  323. 'unchecked_value' => 'no',  
  324. 'checked_label' => __( 'ON', 'woo_dgallery' ),  
  325. 'unchecked_label' => __( 'OFF', 'woo_dgallery' ),  
  326. 'free_version' => true,  
  327. ),  
  328.  
  329. array( 
  330. 'name' => __('Gallery Container', 'woo_dgallery'),  
  331. 'type' => 'heading',  
  332. 'id' => 'wc_dgallery_container_box',  
  333. 'is_box' => true,  
  334. ),  
  335. array( 
  336. 'name' => __( 'Background Colour', 'woo_dgallery' ),  
  337. 'id' => WOO_DYNAMIC_GALLERY_PREFIX.'main_bg_color',  
  338. 'type' => 'bg_color',  
  339. 'free_version' => true,  
  340. 'default' => array( 'enable' => 1, 'color' => '#FFFFFF' ) 
  341. ),  
  342. array( 
  343. 'name' => __( 'Border', 'woo_dgallery' ),  
  344. 'id' => WOO_DYNAMIC_GALLERY_PREFIX.'main_border',  
  345. 'type' => 'border',  
  346. 'free_version' => true,  
  347. 'default' => 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 ),  
  348. ),  
  349. array( 
  350. 'name' => __( 'Border Shadow', 'woo_dgallery' ),  
  351. 'id' => WOO_DYNAMIC_GALLERY_PREFIX.'main_shadow',  
  352. 'type' => 'box_shadow',  
  353. 'free_version' => true,  
  354. 'default' => array( 'enable' => 0, 'h_shadow' => '0px' , 'v_shadow' => '0px', 'blur' => '0px' , 'spread' => '0px', 'color' => '#DBDBDB', 'inset' => '' ) 
  355. ),  
  356. array( 
  357. 'name' => __( 'Border Margin', 'woo_dgallery' ),  
  358. 'desc' => __( 'Margin around the Container border.', 'woo_dgallery' ),  
  359. 'id' => WOO_DYNAMIC_GALLERY_PREFIX.'main_margin',  
  360. 'type' => 'array_textfields',  
  361. 'free_version' => true,  
  362. 'ids' => array( 
  363. array( 'id' => WOO_DYNAMIC_GALLERY_PREFIX.'main_margin_top',  
  364. 'name' => __( 'Top', 'woo_dgallery' ),  
  365. 'class' => '',  
  366. 'css' => 'width:40px;',  
  367. 'free_version' => true,  
  368. 'default' => '0' ),  
  369.  
  370. array( 'id' => WOO_DYNAMIC_GALLERY_PREFIX.'main_margin_bottom',  
  371. 'name' => __( 'Bottom', 'woo_dgallery' ),  
  372. 'class' => '',  
  373. 'css' => 'width:40px;',  
  374. 'free_version' => true,  
  375. 'default' => '0' ),  
  376.  
  377. array( 'id' => WOO_DYNAMIC_GALLERY_PREFIX.'main_margin_left',  
  378. 'name' => __( 'Left', 'woo_dgallery' ),  
  379. 'class' => '',  
  380. 'css' => 'width:40px;',  
  381. 'free_version' => true,  
  382. 'default' => '0' ),  
  383.  
  384. array( 'id' => WOO_DYNAMIC_GALLERY_PREFIX.'main_margin_right',  
  385. 'name' => __( 'Right', 'woo_dgallery' ),  
  386. 'class' => '',  
  387. 'css' => 'width:40px;',  
  388. 'free_version' => true,  
  389. 'default' => '0' ),  
  390. ),  
  391. array( 
  392. 'name' => __( 'Border Padding', 'woo_dgallery' ),  
  393. 'desc' => __( 'Padding between the main image and Container border.', 'woo_dgallery' ),  
  394. 'id' => WOO_DYNAMIC_GALLERY_PREFIX.'main_padding',  
  395. 'type' => 'array_textfields',  
  396. 'free_version' => true,  
  397. 'ids' => array( 
  398. array( 'id' => WOO_DYNAMIC_GALLERY_PREFIX.'main_padding_top',  
  399. 'name' => __( 'Top', 'woo_dgallery' ),  
  400. 'class' => '',  
  401. 'css' => 'width:40px;',  
  402. 'free_version' => true,  
  403. 'default' => '0' ),  
  404.  
  405. array( 'id' => WOO_DYNAMIC_GALLERY_PREFIX.'main_padding_bottom',  
  406. 'name' => __( 'Bottom', 'woo_dgallery' ),  
  407. 'class' => '',  
  408. 'css' => 'width:40px;',  
  409. 'free_version' => true,  
  410. 'default' => '0' ),  
  411.  
  412. array( 'id' => WOO_DYNAMIC_GALLERY_PREFIX.'main_padding_left',  
  413. 'name' => __( 'Left', 'woo_dgallery' ),  
  414. 'class' => '',  
  415. 'css' => 'width:40px;',  
  416. 'free_version' => true,  
  417. 'default' => '0' ),  
  418.  
  419. array( 'id' => WOO_DYNAMIC_GALLERY_PREFIX.'main_padding_right',  
  420. 'name' => __( 'Right', 'woo_dgallery' ),  
  421. 'class' => '',  
  422. 'css' => 'width:40px;',  
  423. 'free_version' => true,  
  424. 'default' => '0' ),  
  425. ),  
  426. array(  
  427. 'name' => __( 'Gallery Icon Display Type', 'woo_dgallery' ),  
  428. 'id' => WOO_DYNAMIC_GALLERY_PREFIX.'icons_display_type',  
  429. 'default' => 'hover',  
  430. 'type' => 'switcher_checkbox',  
  431. 'free_version' => true,  
  432. 'checked_value' => 'show',  
  433. 'unchecked_value' => 'hover',  
  434. 'checked_label' => __( 'SHOW', 'woo_dgallery' ),  
  435. 'unchecked_label' => __( 'ON HOVER', 'woo_dgallery' ),  
  436. ),  
  437.  
  438. array( 
  439. 'name' => __('Nav Bar Control Container', 'woo_dgallery'),  
  440. 'type' => 'heading',  
  441. 'class' => 'pro_feature_fields pro_feature_hidden',  
  442. 'id' => 'wc_dgallery_navbar_control_box',  
  443. 'is_box' => true,  
  444. ),  
  445. array( 
  446. 'name' => __( 'Control Nav Bar', 'woo_dgallery' ),  
  447. 'desc' => __( "ON to show 'Zoom', Stop Slideshow, Start Slideshow", 'woo_dgallery' ),  
  448. 'class' => 'gallery_nav_control',  
  449. 'id' => WOO_DYNAMIC_GALLERY_PREFIX.'product_gallery_nav',  
  450. 'default' => 'yes',  
  451. 'type' => 'onoff_checkbox',  
  452. 'checked_value' => 'yes',  
  453. 'unchecked_value' => 'no',  
  454. 'checked_label' => __( 'ON', 'woo_dgallery' ),  
  455. 'unchecked_label' => __( 'OFF', 'woo_dgallery' ),  
  456. ),  
  457.  
  458. array( 
  459. 'type' => 'heading',  
  460. 'class' => 'nav_bar_container',  
  461. ),  
  462. array( 
  463. 'name' => __( 'Font', 'woo_dgallery' ),  
  464. 'id' => WOO_DYNAMIC_GALLERY_PREFIX.'navbar_font',  
  465. 'type' => 'typography',  
  466. 'default' => array( 'size' => '12px', 'line_height' => '1.4em', 'face' => 'Arial, sans-serif', 'style' => 'normal', 'color' => '#000000' ) 
  467. ),  
  468. array( 
  469. 'name' => __( 'Background Colour', 'woo_dgallery' ),  
  470. 'id' => WOO_DYNAMIC_GALLERY_PREFIX.'navbar_bg_color',  
  471. 'type' => 'bg_color',  
  472. 'default' => array( 'enable' => 1, 'color' => '#FFFFFF' ) 
  473. ),  
  474. array( 
  475. 'name' => __( 'Border', 'woo_dgallery' ),  
  476. 'id' => WOO_DYNAMIC_GALLERY_PREFIX.'navbar_border',  
  477. 'type' => 'border',  
  478. 'default' => 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 ),  
  479. ),  
  480. array( 
  481. 'name' => __( 'Border Shadow', 'woo_dgallery' ),  
  482. 'id' => WOO_DYNAMIC_GALLERY_PREFIX.'navbar_shadow',  
  483. 'type' => 'box_shadow',  
  484. 'default' => array( 'enable' => 0, 'h_shadow' => '0px' , 'v_shadow' => '0px', 'blur' => '0px' , 'spread' => '0px', 'color' => '#DBDBDB', 'inset' => '' ) 
  485. ),  
  486. array( 
  487. 'name' => __( 'Border Margin', 'woo_dgallery' ),  
  488. 'desc' => __( 'Margin around the Nav Bar border.', 'woo_dgallery' ),  
  489. 'id' => WOO_DYNAMIC_GALLERY_PREFIX.'navbar_margin',  
  490. 'type' => 'array_textfields',  
  491. 'ids' => array( 
  492. array( 'id' => WOO_DYNAMIC_GALLERY_PREFIX.'navbar_margin_top',  
  493. 'name' => __( 'Top', 'woo_dgallery' ),  
  494. 'class' => '',  
  495. 'css' => 'width:40px;',  
  496. 'default' => '0' ),  
  497.  
  498. array( 'id' => WOO_DYNAMIC_GALLERY_PREFIX.'navbar_margin_bottom',  
  499. 'name' => __( 'Bottom', 'woo_dgallery' ),  
  500. 'class' => '',  
  501. 'css' => 'width:40px;',  
  502. 'default' => '0' ),  
  503.  
  504. array( 'id' => WOO_DYNAMIC_GALLERY_PREFIX.'navbar_margin_left',  
  505. 'name' => __( 'Left', 'woo_dgallery' ),  
  506. 'class' => '',  
  507. 'css' => 'width:40px;',  
  508. 'default' => '0' ),  
  509.  
  510. array( 'id' => WOO_DYNAMIC_GALLERY_PREFIX.'navbar_margin_right',  
  511. 'name' => __( 'Right', 'woo_dgallery' ),  
  512. 'class' => '',  
  513. 'css' => 'width:40px;',  
  514. 'default' => '0' ),  
  515. ),  
  516. array( 
  517. 'name' => __( 'Border Padding', 'woo_dgallery' ),  
  518. 'desc' => __( 'Padding between the the Text and Nav Bar border.', 'woo_dgallery' ),  
  519. 'id' => WOO_DYNAMIC_GALLERY_PREFIX.'navbar_padding',  
  520. 'type' => 'array_textfields',  
  521. 'ids' => array( 
  522. array( 'id' => WOO_DYNAMIC_GALLERY_PREFIX.'navbar_padding_top',  
  523. 'name' => __( 'Top', 'woo_dgallery' ),  
  524. 'class' => '',  
  525. 'css' => 'width:40px;',  
  526. 'default' => '5' ),  
  527.  
  528. array( 'id' => WOO_DYNAMIC_GALLERY_PREFIX.'navbar_padding_bottom',  
  529. 'name' => __( 'Bottom', 'woo_dgallery' ),  
  530. 'class' => '',  
  531. 'css' => 'width:40px;',  
  532. 'default' => '5' ),  
  533.  
  534. array( 'id' => WOO_DYNAMIC_GALLERY_PREFIX.'navbar_padding_left',  
  535. 'name' => __( 'Left', 'woo_dgallery' ),  
  536. 'class' => '',  
  537. 'css' => 'width:40px;',  
  538. 'default' => '5' ),  
  539.  
  540. array( 'id' => WOO_DYNAMIC_GALLERY_PREFIX.'navbar_padding_right',  
  541. 'name' => __( 'Right', 'woo_dgallery' ),  
  542. 'class' => '',  
  543. 'css' => 'width:40px;',  
  544. 'default' => '5' ),  
  545. ),  
  546. array( 
  547. 'name' => __( 'Vertical Separator', 'woo_dgallery' ),  
  548. 'id' => WOO_DYNAMIC_GALLERY_PREFIX.'navbar_separator',  
  549. 'type' => 'border_styles',  
  550. 'default' => array( 'width' => '1px', 'style' => 'solid', 'color' => '#666' ),  
  551. ),  
  552.  
  553. array( 
  554. 'name' => __('Caption Text Container', 'woo_dgallery'),  
  555. 'type' => 'heading',  
  556. 'class' => 'pro_feature_fields pro_feature_hidden',  
  557. 'id' => 'wc_dgallery_caption_text_box',  
  558. 'is_box' => true,  
  559. ),  
  560. array( 
  561. 'name' => __( 'Font', 'woo_dgallery' ),  
  562. 'id' => WOO_DYNAMIC_GALLERY_PREFIX.'caption_font',  
  563. 'type' => 'typography',  
  564. 'default' => array( 'size' => '12px', 'line_height' => '1.4em', 'face' => 'Arial, sans-serif', 'style' => 'normal', 'color' => '#FFFFFF' ) 
  565. ),  
  566. array( 
  567. 'name' => __( 'Background Colour', 'woo_dgallery' ),  
  568. 'desc' => __( 'Caption text background colour.', 'woo_dgallery' ),  
  569. 'class' => 'wc_dgallery_caption_bg_color',  
  570. 'id' => WOO_DYNAMIC_GALLERY_PREFIX.'caption_bg_color',  
  571. 'type' => 'bg_color',  
  572. 'default' => array( 'enable' => 1, 'color' => '#000000' ) 
  573. ),  
  574.  
  575. array( 
  576. 'type' => 'heading',  
  577. 'class' => 'wc_dgallery_caption_bg_color_container',  
  578. ),  
  579. array( 
  580. 'name' => __( 'Background Transparency', 'woo_dgallery' ),  
  581. 'desc' => '%. ' . __( 'Scale - 0 = 100% transparent - 100 = 100% Solid Colour.', 'woo_dgallery' ),  
  582. 'id' => WOO_DYNAMIC_GALLERY_PREFIX.'caption_bg_transparent',  
  583. 'type' => 'slider',  
  584. 'default' => 50,  
  585. 'min' => 0,  
  586. 'max' => 100,  
  587. 'increment' => 10,  
  588. ),  
  589.  
  590. array( 
  591. 'name' => __('Lazy Load Scroll Bar Container', 'woo_dgallery'),  
  592. 'type' => 'heading',  
  593. 'class' => 'pro_feature_fields pro_feature_hidden',  
  594. 'id' => 'wc_dgallery_lazyload_scroll_bar_box',  
  595. 'is_box' => true,  
  596. ),  
  597. array( 
  598. 'name' => __( 'Scroll Bar', 'woo_dgallery' ),  
  599. 'class' => 'lazy_load_control',  
  600. 'id' => WOO_DYNAMIC_GALLERY_PREFIX.'lazy_load_scroll',  
  601. 'default' => 'yes',  
  602. 'type' => 'onoff_checkbox',  
  603. 'checked_value' => 'yes',  
  604. 'unchecked_value' => 'no',  
  605. 'checked_label' => __( 'ON', 'woo_dgallery' ),  
  606. 'unchecked_label' => __( 'OFF', 'woo_dgallery' ),  
  607. ),  
  608.  
  609. array( 
  610. 'type' => 'heading',  
  611. 'class' => 'lazy_load_container',  
  612. ),  
  613. array( 
  614. 'name' => __( 'Scroll Bar Colour', 'woo_dgallery' ),  
  615. 'id' => WOO_DYNAMIC_GALLERY_PREFIX.'transition_scroll_bar',  
  616. 'type' => 'color',  
  617. 'default' => '#000000' 
  618. ),  
  619.  
  620. array( 
  621. 'name' => __('Product Variations Galleries', 'woo_dgallery'),  
  622. 'type' => 'heading',  
  623. 'class' => 'pro_feature_fields pro_feature_hidden',  
  624. 'id' => 'wc_dgallery_variations_box',  
  625. 'is_box' => true,  
  626. ),  
  627. array(  
  628. 'name' => __( 'Gallery Load Effect', 'woo_dgallery' ),  
  629. 'desc' => '',  
  630. 'class' => 'variation_gallery_effect',  
  631. 'id' => WOO_DYNAMIC_GALLERY_PREFIX.'variation_gallery_effect',  
  632. 'default' => 'fade',  
  633. 'type' => 'switcher_checkbox',  
  634. 'checked_value' => 'fade',  
  635. 'unchecked_value' => 'none',  
  636. 'checked_label' => __( 'FADE', 'woo_dgallery' ),  
  637. 'unchecked_label' => __( 'DEFAULT', 'woo_dgallery' ),  
  638. ),  
  639. array(  
  640. 'type' => 'heading',  
  641. 'class' => 'variation_load_effect_timing',  
  642. ),  
  643. array(  
  644. 'name' => __( 'Load Effect Timing', 'woo_dgallery' ),  
  645. 'desc' => 'seconds',  
  646. 'id' => WOO_DYNAMIC_GALLERY_PREFIX.'variation_gallery_effect_speed',  
  647. 'type' => 'slider',  
  648. 'default' => 2,  
  649. 'min' => 1,  
  650. 'max' => 10,  
  651. 'increment' => 1,  
  652. ),  
  653.  
  654. ); 
  655.  
  656. include_once( $this->admin_plugin_dir() . '/settings/thumbnails-settings.php' ); 
  657. global $wc_dgallery_thumbnails_settings; 
  658. $this->form_fields = array_merge( $this->form_fields, $wc_dgallery_thumbnails_settings->form_fields ); 
  659.  
  660. $this->form_fields = array_merge( $this->form_fields, array( 
  661. array( 
  662. 'name' => __( "GALLERY STYLES SUPER POWERS", 'woo_dgallery' ),  
  663. 'type' => 'heading',  
  664. 'desc' => '<img class="rwd_image_maps" src="'.WOO_DYNAMIC_GALLERY_IMAGES_URL.'/gallery_styles_tab.png" usemap="#productCardsMap" style="width: auto; max-width: 100%;" border="0" /> 
  665. <map name="productCardsMap" id="productCardsMap"> 
  666. <area shape="rect" coords="325, 270, 925, 205" href="'.$this->pro_plugin_page_url.'" target="_blank" /> 
  667. </map>',  
  668. 'alway_open'=> true,  
  669. 'id' => 'dgallery_styles_premium_box',  
  670. 'is_box' => true,  
  671. ),  
  672. ) ); 
  673.  
  674. $this->form_fields = apply_filters( $this->form_key . '_settings_fields', $this->form_fields ); 
  675.  
  676.  
  677. public function include_script() { 
  678. wp_enqueue_script( 'jquery-rwd-image-maps' ); 
  679. add_action( 'admin_footer', array($this, 'wc_dynamic_gallery_add_script'), 10 ); 
  680. ?> 
  681. <script> 
  682. (function($) { 
  683. $(document).ready(function() { 
  684. if ( $("input.gallery_width_type:checked").val() == '%') { 
  685. $(".gallery_width_type_percent").show(); 
  686. $(".gallery_width_type_fixed").hide(); 
  687. } else { 
  688. $(".gallery_width_type_percent").hide(); 
  689. $(".gallery_width_type_fixed").show(); 
  690. if ( $("input.gallery_nav_control:checked").val() != 'yes') { 
  691. $('.nav_bar_container').css( {'visibility': 'hidden', 'height' : '0px', 'overflow' : 'hidden', 'margin-bottom' : '0px' } ); 
  692. if ( $("input.lazy_load_control:checked").val() != 'yes') { 
  693. $(".lazy_load_container").hide(); 
  694. if ( $("input.variation_gallery_effect:checked").val() != 'fade') { 
  695. $(".variation_load_effect_timing").hide(); 
  696.  
  697. if ( $("input.wc_dgallery_thumb_show_type:checked").val() != 'slider') { 
  698. $('.wc_dgallery_thumbnail_slider_container').css( {'visibility': 'hidden', 'height' : '0px', 'overflow' : 'hidden', 'margin-bottom' : '0px' } ); 
  699.  
  700.  
  701. $(document).on( "a3rev-ui-onoff_checkbox-switch", '.gallery_width_type', function( event, value, status ) { 
  702. if ( status == 'true' ) { 
  703. $(".gallery_width_type_percent").slideDown(); 
  704. $(".gallery_width_type_fixed").slideUp(); 
  705. $(".gallery_height_type_fixed").slideUp(); 
  706. } else { 
  707. $(".gallery_width_type_percent").slideUp(); 
  708. $(".gallery_width_type_fixed").slideDown(); 
  709. if ( $("input.gallery_height_type:checked").val() == 'fixed') { 
  710. $(".gallery_height_type_fixed").slideDown(); 
  711. }); 
  712.  
  713. $(document).on( "a3rev-ui-onoff_checkbox-switch", '.gallery_nav_control', function( event, value, status ) { 
  714. $('.nav_bar_container').attr('style', 'display:none;'); 
  715. if ( status == 'true' ) { 
  716. $(".nav_bar_container").slideDown(); 
  717. } else { 
  718. $(".nav_bar_container").slideUp(); 
  719. }); 
  720.  
  721. $(document).on( "a3rev-ui-onoff_checkbox-switch", '.lazy_load_control', function( event, value, status ) { 
  722. if ( status == 'true' ) { 
  723. $(".lazy_load_container").slideDown(); 
  724. } else { 
  725. $(".lazy_load_container").slideUp(); 
  726. }); 
  727.  
  728. $(document).on( "a3rev-ui-onoff_checkbox-switch", '.variation_gallery_effect', function( event, value, status ) { 
  729. if ( status == 'true' ) { 
  730. $(".variation_load_effect_timing").slideDown(); 
  731. } else { 
  732. $(".variation_load_effect_timing").slideUp(); 
  733. }); 
  734.  
  735. if ( $("input.enable_gallery_thumb:checked").val() != 'yes') { 
  736. $(".gallery_thumb_container").css( {'visibility': 'hidden', 'height' : '0px', 'overflow' : 'hidden', 'margin-bottom' : '0px' } ); 
  737.  
  738. $(document).on( "a3rev-ui-onoff_checkbox-switch", '.enable_gallery_thumb', function( event, value, status ) { 
  739. $('.gallery_thumb_container').attr('style', 'display:none;'); 
  740. if ( status == 'true' ) { 
  741. $(".gallery_thumb_container").slideDown(); 
  742. } else { 
  743. $(".gallery_thumb_container").slideUp(); 
  744. }); 
  745.  
  746. if ( $("input.gallery_height_type:checked").val() == 'fixed') { 
  747. if ( $("input.gallery_width_type:checked").val() != '%') { 
  748. $(".gallery_height_type_fixed").show(); 
  749. } else { 
  750. $(".gallery_height_type_fixed").hide(); 
  751. } else { 
  752. $(".gallery_height_type_fixed").hide(); 
  753.  
  754. $(document).on( "a3rev-ui-onoff_checkbox-switch", '.gallery_height_type', function( event, value, status ) { 
  755. if ( status == 'true' ) { 
  756. if ( $("input.gallery_width_type:checked").val() != '%') { 
  757. $(".gallery_height_type_fixed").slideDown(); 
  758. } else { 
  759. $(".gallery_height_type_fixed").slideUp(); 
  760. } else { 
  761. $(".gallery_height_type_fixed").slideUp(); 
  762. }); 
  763.  
  764.  
  765. $(document).on( "a3rev-ui-onoff_checkbox-switch", '.wc_dgallery_thumb_show_type', function( event, value, status ) { 
  766. $('.wc_dgallery_thumbnail_slider_container').attr('style', 'display:none;'); 
  767. if ( status == 'true' ) { 
  768. $(".wc_dgallery_thumbnail_slider_container").slideDown(); 
  769. } else { 
  770. $(".wc_dgallery_thumbnail_slider_container").slideUp(); 
  771. }); 
  772.  
  773. }); 
  774. })(jQuery); 
  775. </script> 
  776. <?php  
  777.  
  778. public function wc_dynamic_gallery_add_script() { 
  779. wp_enqueue_style( 'a3-dgallery-style' ); 
  780.  
  781. $popup_gallery = get_option( WOO_DYNAMIC_GALLERY_PREFIX.'popup_gallery' ); 
  782. if ( 'fb' == $popup_gallery ) { 
  783. wp_enqueue_style( 'woocommerce_fancybox_styles' ); 
  784. wp_enqueue_script( 'fancybox' ); 
  785. } elseif ( 'colorbox' == $popup_gallery ) { 
  786. wp_enqueue_style( 'a3_colorbox_style' ); 
  787. wp_enqueue_script( 'colorbox_script' ); 
  788.  
  789. wp_enqueue_script( 'preview-gallery-script' ); 
  790.  
  791. wp_enqueue_script( 'a3-dgallery-script' );