/admin/settings/gallery-style-settings.php

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