WC_Predictive_Search_Admin_Interface

The WooCommerce Predictive Search LITE WC Predictive Search Admin Interface class.

Defined (1)

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

/admin/admin-interface.php  
  1. class WC_Predictive_Search_Admin_Interface extends WC_Predictive_Search_Admin_UI 
  2.  
  3. /**-----------------------------------------------------------------------------------*/ 
  4. /** Admin Interface Constructor */ 
  5. /**-----------------------------------------------------------------------------------*/ 
  6. public function __construct() { 
  7.  
  8. $this->admin_includes(); 
  9.  
  10. add_action( 'init', array( $this, 'init_scripts' ) ); 
  11. add_action( 'init', array( $this, 'init_styles' ) ); 
  12.  
  13. // AJAX hide yellow message dontshow 
  14. add_action( 'wp_ajax_'.$this->plugin_name.'_a3_admin_ui_event', array( $this, 'a3_admin_ui_event' ) ); 
  15. add_action( 'wp_ajax_nopriv_'.$this->plugin_name.'_a3_admin_ui_event', array( $this, 'a3_admin_ui_event' ) ); 
  16.  
  17.  
  18. /**-----------------------------------------------------------------------------------*/ 
  19. /** Init scripts */ 
  20. /**-----------------------------------------------------------------------------------*/ 
  21. public function init_scripts() { 
  22. $admin_pages = $this->admin_pages(); 
  23.  
  24. if ( is_admin() && isset( $_REQUEST['page'] ) && in_array( $_REQUEST['page'], $admin_pages ) ) { 
  25. add_action( 'admin_enqueue_scripts', array( $this, 'admin_script_load' ) ); 
  26. do_action( $this->plugin_name . '_init_scripts' ); 
  27.  
  28. add_action( 'admin_print_scripts', array( $this, 'admin_localize_printed_scripts' ), 5 ); 
  29. add_action( 'admin_print_footer_scripts', array( $this, 'admin_localize_printed_scripts' ), 5 ); 
  30.  
  31. /**-----------------------------------------------------------------------------------*/ 
  32. /** Init styles */ 
  33. /**-----------------------------------------------------------------------------------*/ 
  34. public function init_styles() { 
  35. $admin_pages = $this->admin_pages(); 
  36.  
  37. if ( is_admin() && isset( $_REQUEST['page'] ) && in_array( $_REQUEST['page'], $admin_pages ) ) { 
  38. add_action( 'admin_enqueue_scripts', array( $this, 'register_fontawesome_style' ), 0 ); 
  39. add_action( 'admin_enqueue_scripts', array( $this, 'admin_css_load' ) ); 
  40. do_action( $this->plugin_name . '_init_styles' ); 
  41.  
  42. public function register_fontawesome_style() { 
  43. $suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min'; 
  44. wp_register_style( 'font-awesome-styles', $this->admin_plugin_url() . '/assets/css/font-awesome' . $suffix . '.css', array(), '4.5.0', 'all' ); 
  45.  
  46. /**-----------------------------------------------------------------------------------*/ 
  47. /** admin_script_load */ 
  48. /**-----------------------------------------------------------------------------------*/ 
  49.  
  50. public function admin_script_load() { 
  51.  
  52. $suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min'; 
  53. $rtl = is_rtl() ? '.rtl' : ''; 
  54.  
  55. wp_register_script( 'chosen', $this->admin_plugin_url() . '/assets/js/chosen/chosen.jquery' . $suffix . '.js', array( 'jquery' ), true, false ); 
  56. wp_register_script( 'a3rev-chosen-new', $this->admin_plugin_url() . '/assets/js/chosen/chosen.jquery' . $suffix . '.js', array( 'jquery' ), true, false ); 
  57. wp_register_script( 'a3rev-style-checkboxes', $this->admin_plugin_url() . '/assets/js/iphone-style-checkboxes' . $rtl . '.js', array('jquery'), true, false ); 
  58. wp_register_script( 'jquery-ui-slider-rtl', $this->admin_plugin_url() . '/assets/js/ui-slider/jquery.ui.slider.rtl' . $suffix . '.js', array('jquery'), true, true ); 
  59.  
  60. wp_register_script( 'a3rev-admin-ui-script', $this->admin_plugin_url() . '/assets/js/admin-ui-script.js', array('jquery'), true, true ); 
  61. wp_register_script( 'a3rev-typography-preview', $this->admin_plugin_url() . '/assets/js/a3rev-typography-preview.js', array('jquery'), false, true ); 
  62. wp_register_script( 'a3rev-settings-preview', $this->admin_plugin_url() . '/assets/js/a3rev-settings-preview.js', array('jquery'), false, true ); 
  63. wp_register_script( 'jquery-tiptip', $this->admin_plugin_url() . '/assets/js/tipTip/jquery.tipTip' . $suffix . '.js', array( 'jquery' ), true, true ); 
  64. wp_register_script( 'a3rev-metabox-ui', $this->admin_plugin_url() . '/assets/js/data-meta-boxes.js', array( 'jquery' ), true, true ); 
  65. wp_register_script( 'jquery-rwd-image-maps', $this->admin_plugin_url() . '/assets/js/rwdImageMaps/jquery.rwdImageMaps.min.js', array( 'jquery' ), true, true ); 
  66.  
  67. wp_enqueue_script( 'jquery' ); 
  68. wp_enqueue_script( 'wp-color-picker' ); 
  69. if ( is_rtl() ) { 
  70. wp_enqueue_script( 'jquery-ui-slider-rtl' ); 
  71. } else { 
  72. wp_enqueue_script( 'jquery-ui-slider' ); 
  73. wp_enqueue_script( 'chosen' ); 
  74. wp_enqueue_script( 'a3rev-chosen-new' ); 
  75. wp_enqueue_script( 'a3rev-style-checkboxes' ); 
  76. wp_enqueue_script( 'a3rev-admin-ui-script' ); 
  77. wp_enqueue_script( 'a3rev-typography-preview' ); 
  78. wp_enqueue_script( 'a3rev-settings-preview' ); 
  79. wp_enqueue_script( 'jquery-tiptip' ); 
  80. wp_enqueue_script( 'a3rev-metabox-ui' ); 
  81.  
  82. } // End admin_script_load() 
  83.  
  84. /**-----------------------------------------------------------------------------------*/ 
  85. /** admin_localize_printed_scripts: Localize scripts only when enqueued */ 
  86. /**-----------------------------------------------------------------------------------*/ 
  87.  
  88. public function admin_localize_printed_scripts() { 
  89. $rtl = is_rtl() ? 1 : 0; 
  90.  
  91. if ( wp_script_is( 'a3rev-admin-ui-script' ) ) { 
  92. wp_localize_script( 'a3rev-admin-ui-script', 'a3_admin_ui_script_params', apply_filters( 'a3_admin_ui_script_params', array( 
  93. 'ajax_url' => admin_url( 'admin-ajax.php' ),  
  94. 'plugin' => $this->plugin_name,  
  95. 'security' => wp_create_nonce( $this->plugin_name . '_a3_admin_ui_event' ),  
  96. 'rtl' => $rtl,  
  97. ) ) ); 
  98.  
  99. } // End admin_localize_printed_scripts() 
  100.  
  101. public function a3_admin_ui_event() { 
  102. check_ajax_referer( $this->plugin_name. '_a3_admin_ui_event', 'security' ); 
  103. if ( isset( $_REQUEST['type'] ) ) { 
  104. switch ( trim( $_REQUEST['type'] ) ) { 
  105. case 'open_close_panel_box': 
  106. $form_key = $_REQUEST['form_key']; 
  107. $box_id = $_REQUEST['box_id']; 
  108. $is_open = $_REQUEST['is_open']; 
  109.  
  110. $user_id = get_current_user_id(); 
  111. $opened_box = get_user_meta( $user_id, $this->plugin_name . '-' . trim( $form_key ), true ); 
  112. if ( empty( $opened_box ) || ! is_array( $opened_box ) ) { 
  113. $opened_box = array(); 
  114. if ( 1 == $is_open && ! in_array( $box_id, $opened_box ) ) { 
  115. $opened_box[] = $box_id; 
  116. } elseif ( 0 == $is_open && in_array( $box_id, $opened_box ) ) { 
  117. $opened_box = array_diff( $opened_box, array( $box_id ) ); 
  118. update_user_meta( $user_id, $this->plugin_name . '-' . trim( $form_key ), $opened_box ); 
  119. break; 
  120.  
  121. case 'check_new_version': 
  122. $transient_name = $_REQUEST['transient_name']; 
  123. delete_transient( $transient_name ); 
  124.  
  125. $new_version = ''; 
  126. if ( class_exists( 'WC_Predictive_Search_Upgrade' ) ) { 
  127. $new_version = WC_Predictive_Search_Upgrade::get_version_info(); 
  128.  
  129. $version_message = $this->get_version_message(); 
  130. $has_new_version = 1; 
  131. if ( '' == trim( $version_message ) ) { 
  132. $version_message = __( 'Great! You have the latest version installed.', 'woocommerce-predictive-search' ); 
  133. $has_new_version = 0; 
  134. } else { 
  135. delete_option('woocommerce_search_lite_clean_on_deletion'); 
  136. if ( is_array( $new_version ) && 'valid' == $new_version['is_valid_key'] ) { 
  137. $current_update_plugins = get_site_transient( 'update_plugins' ); 
  138. if ( isset( $current_update_plugins->response ) ) { 
  139. $plugin_name = WOOPS_NAME; 
  140. if ( empty( $current_update_plugins->response[$plugin_name] ) ) { 
  141. $current_update_plugins->response[$plugin_name] = new stdClass(); 
  142. $current_update_plugins->response[$plugin_name]->url = "http://www.a3rev.com"; 
  143. $current_update_plugins->response[$plugin_name]->slug = get_option( $this->plugin_option_key ); 
  144. $current_update_plugins->response[$plugin_name]->package = $new_version["url"]; 
  145. $current_update_plugins->response[$plugin_name]->new_version = $new_version['version']; 
  146. $current_update_plugins->response[$plugin_name]->upgrade_notice = $new_version['upgrade_notice']; 
  147. $current_update_plugins->response[$plugin_name]->id = "0"; 
  148. set_site_transient( 'update_plugins', $current_update_plugins ); 
  149.  
  150. $response_data = array( 
  151. 'has_new_version' => $has_new_version,  
  152. 'version_message' => $version_message,  
  153. ); 
  154. echo json_encode( $response_data ); 
  155. break; 
  156.  
  157. die(); 
  158.  
  159.  
  160. /**-----------------------------------------------------------------------------------*/ 
  161. /** admin_css_load */ 
  162. /**-----------------------------------------------------------------------------------*/ 
  163.  
  164. public function admin_css_load () { 
  165. global $wp_version; 
  166.  
  167. $suffix = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min'; 
  168.  
  169. wp_enqueue_style( 'a3rev-admin-ui-style', $this->admin_plugin_url() . '/assets/css/admin-ui-style' . $suffix . '.css' ); 
  170.  
  171. if ( version_compare( $wp_version, '3.8', '>=' ) ) { 
  172. wp_enqueue_style( 'a3rev-admin-flat-ui-style', $this->admin_plugin_url() . '/assets/css/admin-flat-ui-style' . $suffix . '.css' ); 
  173. wp_enqueue_style( 'wp-color-picker' ); 
  174. wp_enqueue_style( 'a3rev-chosen-new-style', $this->admin_plugin_url() . '/assets/js/chosen/chosen' . $suffix . '.css' ); 
  175. wp_enqueue_style( 'a3rev-tiptip-style', $this->admin_plugin_url() . '/assets/js/tipTip/tipTip.css' ); 
  176. wp_enqueue_style( 'a3rev-metabox-ui-style', $this->admin_plugin_url() . '/assets/css/a3_admin_metabox.css' ); 
  177.  
  178. if ( is_rtl() ) { 
  179. wp_enqueue_style( 'a3rev-admin-ui-style-rtl', $this->admin_plugin_url() . '/assets/css/admin-ui-style.rtl' . $suffix . '.css' ); 
  180. wp_enqueue_style( 'a3rev-metabox-ui-style-rtl', $this->admin_plugin_url() . '/assets/css/a3_admin_metabox.rtl' . $suffix . '.css' ); 
  181.  
  182. } // End admin_css_load() 
  183.  
  184. /**-----------------------------------------------------------------------------------*/ 
  185. /** get_success_message */ 
  186. /**-----------------------------------------------------------------------------------*/ 
  187. public function get_success_message( $message = '' ) { 
  188. if ( trim( $message ) == '' ) $message = __( 'Settings successfully saved.' , 'woocommerce-predictive-search' );  
  189. return '<div class="updated" id=""><p>' . $message . '</p></div>'; 
  190.  
  191. /**-----------------------------------------------------------------------------------*/ 
  192. /** get_error_message */ 
  193. /**-----------------------------------------------------------------------------------*/ 
  194. public function get_error_message( $message = '' ) { 
  195. if ( trim( $message ) == '' ) $message = __( 'Error: Settings can not save.' , 'woocommerce-predictive-search' );  
  196. return '<div class="error" id=""><p>' . $message . '</p></div>'; 
  197.  
  198. /**-----------------------------------------------------------------------------------*/ 
  199. /** get_reset_message */ 
  200. /**-----------------------------------------------------------------------------------*/ 
  201. public function get_reset_message( $message = '' ) { 
  202. if ( trim( $message ) == '' ) $message = __( 'Settings successfully reseted.' , 'woocommerce-predictive-search' );  
  203. return '<div class="updated" id=""><p>' . $message . '</p></div>'; 
  204.  
  205. /**-----------------------------------------------------------------------------------*/ 
  206. /** admin_includes */ 
  207. /** Include required core files used in admin UI. 
  208. /**-----------------------------------------------------------------------------------*/ 
  209. public function admin_includes() { 
  210. // Includes Font Face Lib 
  211. include_once( 'includes/fonts_face.php' ); 
  212.  
  213. // Includes Uploader Lib 
  214. include_once( 'includes/uploader/class-uploader.php' ); 
  215.  
  216. /**-----------------------------------------------------------------------------------*/ 
  217. /** Get Font Weights */ 
  218. /**-----------------------------------------------------------------------------------*/ 
  219. public function get_font_weights() { 
  220. $font_weights = array ( 
  221. '300' => __( 'Thin', 'woocommerce-predictive-search' ),  
  222. '300 italic' => __( 'Thin/Italic', 'woocommerce-predictive-search' ),  
  223. 'normal' => __( 'Normal', 'woocommerce-predictive-search' ),  
  224. 'italic' => __( 'Italic', 'woocommerce-predictive-search' ),  
  225. 'bold' => __( 'Bold', 'woocommerce-predictive-search' ),  
  226. 'bold italic' => __( 'Bold/Italic', 'woocommerce-predictive-search' ),  
  227. ); 
  228. return apply_filters( $this->plugin_name . '_font_weights', $font_weights ); 
  229.  
  230. /**-----------------------------------------------------------------------------------*/ 
  231. /** Get Border Styles */ 
  232. /**-----------------------------------------------------------------------------------*/ 
  233. public function get_border_styles() { 
  234. $border_styles = array ( 
  235. 'solid' => __( 'Solid', 'woocommerce-predictive-search' ),  
  236. 'double' => __( 'Double', 'woocommerce-predictive-search' ),  
  237. 'dashed' => __( 'Dashed', 'woocommerce-predictive-search' ),  
  238. 'dotted' => __( 'Dotted', 'woocommerce-predictive-search' ),  
  239. 'groove' => __( 'Groove', 'woocommerce-predictive-search' ),  
  240. 'ridge' => __( 'Ridge', 'woocommerce-predictive-search' ),  
  241. 'inset' => __( 'Inset', 'woocommerce-predictive-search' ),  
  242. 'outset' => __( 'Outset', 'woocommerce-predictive-search' ),  
  243. ); 
  244. return apply_filters( $this->plugin_name . '_border_styles', $border_styles ); 
  245.  
  246. /**-----------------------------------------------------------------------------------*/ 
  247. /** Get Settings Default Function - get_settings_default */ 
  248. /** Just called for when option values is an array and it's in single option name for all settings 
  249. /**-----------------------------------------------------------------------------------*/ 
  250.  
  251. public function get_settings_default( $options, $option_name = '' ) { 
  252.  
  253. $default_settings = array(); 
  254.  
  255. if ( !is_array( $options ) || count( $options ) < 1 ) return $default_settings; 
  256.  
  257. foreach ( $options as $value ) { 
  258. if ( ! isset( $value['type'] ) ) continue; 
  259. if ( in_array( $value['type'], array( 'heading', 'ajax_submit', 'ajax_multi_submit' ) ) ) continue; 
  260. if ( ! isset( $value['id'] ) || trim( $value['id'] ) == '' ) continue; 
  261. if ( ! isset( $value['default'] ) ) $value['default'] = ''; 
  262.  
  263. switch ( $value['type'] ) { 
  264.  
  265. // Array textfields 
  266. case 'array_textfields' : 
  267. if ( !isset( $value['ids'] ) || !is_array( $value['ids'] ) || count( $value['ids'] ) < 1 ) break; 
  268.  
  269. foreach ( $value['ids'] as $text_field ) { 
  270. if ( ! isset( $text_field['id'] ) || trim( $text_field['id'] ) == '' ) continue; 
  271. if ( ! isset( $text_field['default'] ) ) $text_field['default'] = ''; 
  272.  
  273. // Do not include when it's separate option 
  274. if ( isset( $text_field['separate_option'] ) && $text_field['separate_option'] != false ) continue; 
  275.  
  276. // Remove [, ] characters from id argument 
  277. if ( strstr( $text_field['id'], '[' ) ) { 
  278. parse_str( esc_attr( $text_field['id'] ), $option_array ); 
  279.  
  280. // Option name is first key 
  281. $option_keys = array_keys( $option_array ); 
  282. $first_key = current( $option_keys ); 
  283.  
  284. $id_attribute = $first_key; 
  285. } else { 
  286. $id_attribute = esc_attr( $text_field['id'] ); 
  287.  
  288. $default_settings[$id_attribute] = $text_field['default']; 
  289.  
  290. break; 
  291.  
  292. default : 
  293. // Do not include when it's separate option 
  294. if ( isset( $value['separate_option'] ) && $value['separate_option'] != false ) continue; 
  295.  
  296. // Remove [, ] characters from id argument 
  297. if ( strstr( $value['id'], '[' ) ) { 
  298. parse_str( esc_attr( $value['id'] ), $option_array ); 
  299.  
  300. // Option name is first key 
  301. $option_keys = array_keys( $option_array ); 
  302. $first_key = current( $option_keys ); 
  303.  
  304. $id_attribute = $first_key; 
  305. } else { 
  306. $id_attribute = esc_attr( $value['id'] ); 
  307.  
  308. // Backward compatibility to old settings don't have line_height option for typography 
  309. if ( 'typography' == $value['type'] && ! isset( $value['default']['line_height'] ) ) { 
  310. $value['default']['line_height'] = '1.4em'; 
  311.  
  312. $default_settings[$id_attribute] = $value['default']; 
  313.  
  314. break; 
  315.  
  316. if ( trim( $option_name ) != '' ) $default_settings = apply_filters( $this->plugin_name . '_' . $option_name . '_default_settings' , $default_settings ); 
  317. if ( ! is_array( $default_settings ) ) $default_settings = array(); 
  318.  
  319. return $default_settings; 
  320.  
  321.  
  322. /**-----------------------------------------------------------------------------------*/ 
  323. /** Get Settings Function - get_settings */ 
  324. /**-----------------------------------------------------------------------------------*/ 
  325.  
  326. public function get_settings( $options, $option_name = '' ) { 
  327.  
  328. if ( !is_array( $options ) || count( $options ) < 1 ) return; 
  329.  
  330. $new_settings = array(); $new_single_setting = ''; // :) 
  331.  
  332. // Get settings for option values is an array and it's in single option name for all settings 
  333. if ( trim( $option_name ) != '' ) { 
  334. global ${$option_name}; 
  335.  
  336. $default_settings = $this->get_settings_default( $options, $option_name ); 
  337.  
  338. $current_settings = get_option( $option_name ); 
  339. if ( ! is_array( $current_settings ) ) $current_settings = array(); 
  340. $current_settings = array_merge( $default_settings, $current_settings ); 
  341.  
  342. $current_settings = array_map( array( $this, 'admin_stripslashes' ), $current_settings ); 
  343. $current_settings = apply_filters( $this->plugin_name . '_' . $option_name . '_get_settings' , $current_settings ); 
  344.  
  345. $$option_name = $current_settings; 
  346.  
  347.  
  348. // Get settings for option value is stored as a record or it's spearate option 
  349. foreach ( $options as $value ) { 
  350. if ( ! isset( $value['type'] ) ) continue; 
  351. if ( in_array( $value['type'], array( 'heading', 'ajax_submit', 'ajax_multi_submit' ) ) ) continue; 
  352. if ( ! isset( $value['id'] ) || trim( $value['id'] ) == '' ) continue; 
  353. if ( ! isset( $value['default'] ) ) $value['default'] = ''; 
  354.  
  355. // For way it has an option name 
  356. if ( ! isset( $value['separate_option'] ) ) $value['separate_option'] = false; 
  357.  
  358. // Remove [, ] characters from id argument 
  359. if ( strstr( $value['id'], '[' ) ) { 
  360. parse_str( esc_attr( $value['id'] ), $option_array ); 
  361.  
  362. // Option name is first key 
  363. $option_keys = array_keys( $option_array ); 
  364. $first_key = current( $option_keys ); 
  365.  
  366. $id_attribute = $first_key; 
  367. } else { 
  368. $id_attribute = esc_attr( $value['id'] ); 
  369.  
  370. if ( trim( $option_name ) == '' || $value['separate_option'] != false ) { 
  371. global ${$id_attribute}; 
  372.  
  373. $current_setting = get_option( $id_attribute, $value['default'] ); 
  374.  
  375. switch ( $value['type'] ) { 
  376.  
  377. // Array textfields 
  378. case 'wp_editor' : 
  379. if ( is_array( $current_setting ) ) 
  380. $current_setting = array_map( array( $this, 'stripslashes' ), $current_setting ); 
  381. elseif ( ! is_null( $current_setting ) ) 
  382. $current_setting = stripslashes( $current_setting ); 
  383. break; 
  384.  
  385. default: 
  386.  
  387. if ( is_array( $current_setting ) ) 
  388. $current_setting = array_map( array( $this, 'admin_stripslashes' ), $current_setting ); 
  389. elseif ( ! is_null( $current_setting ) ) 
  390. $current_setting = esc_attr( stripslashes( $current_setting ) ); 
  391.  
  392. // Backward compatibility to old settings don't have line_height option for typography 
  393. if ( 'typography' == $value['type'] && ! isset( $current_setting['line_height'] ) ) { 
  394. $current_setting['line_height'] = '1.4em'; 
  395.  
  396. break; 
  397.  
  398. $current_setting = apply_filters( $this->plugin_name . '_' . $id_attribute . '_get_setting' , $current_setting ); 
  399.  
  400. $$id_attribute = $current_setting; 
  401.  
  402. // :) 
  403. if ( ! isset( $this->is_free_plugin ) || ! $this->is_free_plugin ) { 
  404. $fs = array( 0 => 'c', 1 => 'p', 2 => 'h', 3 => 'i', 4 => 'e', 5 => 'n', 6 => 'k', 7 => '_' ); 
  405. $cs = array( 0 => 'U', 1 => 'g', 2 => 'p', 3 => 'r', 4 => 'd', 5 => 'a', 6 => 'e', 7 => '_' ); 
  406. $check_settings_save = true; 
  407. if ( isset( $this->class_name ) && ! class_exists( $this->class_name . $cs[7] . $cs[0] . $cs[2] . $cs[1] . $cs[3] . $cs[5] . $cs[4] . $cs[6] ) ) { 
  408. $check_settings_save = false; 
  409. if ( ! function_exists( $this->plugin_name . $fs[7] . $fs[0] . $fs[2] . $fs[4] . $fs[0] . $fs[6] . $fs[7] . $fs[1] . $fs[3] . $fs[5] ) ) { 
  410. $check_settings_save = false; 
  411. if ( ! $check_settings_save ) { 
  412.  
  413. if ( trim( $option_name ) != '' ) { 
  414. update_option( $option_name, $new_settings ); 
  415. $$option_name = $new_settings; 
  416.  
  417. foreach ( $options as $value ) { 
  418. if ( ! isset( $value['type'] ) ) continue; 
  419. if ( in_array( $value['type'], array( 'heading', 'ajax_submit', 'ajax_multi_submit' ) ) ) continue; 
  420. if ( ! isset( $value['id'] ) || trim( $value['id'] ) == '' ) continue; 
  421. if ( ! isset( $value['default'] ) ) $value['default'] = ''; 
  422. if ( ! isset( $value['free_version'] ) ) $value['free_version'] = false; 
  423.  
  424. // For way it has an option name 
  425. if ( ! isset( $value['separate_option'] ) ) $value['separate_option'] = false; 
  426.  
  427. // Remove [, ] characters from id argument 
  428. if ( strstr( $value['id'], '[' ) ) { 
  429. parse_str( esc_attr( $value['id'] ), $option_array ); 
  430.  
  431. // Option name is first key 
  432. $option_keys = array_keys( $option_array ); 
  433. $first_key = current( $option_keys ); 
  434.  
  435. $id_attribute = $first_key; 
  436. } else { 
  437. $id_attribute = esc_attr( $value['id'] ); 
  438.  
  439. if ( trim( $option_name ) == '' || $value['separate_option'] != false ) { 
  440. update_option( $id_attribute, $new_single_setting ); 
  441. $$id_attribute = $new_single_setting; 
  442.  
  443. return true; 
  444.  
  445.  
  446. /**-----------------------------------------------------------------------------------*/ 
  447. /** Save Settings Function - save_settings */ 
  448. /**-----------------------------------------------------------------------------------*/ 
  449.  
  450. public function save_settings( $options, $option_name = '' ) { 
  451.  
  452. if ( !is_array( $options ) || count( $options ) < 1 ) return; 
  453.  
  454. if ( empty( $_POST ) ) return false; 
  455.  
  456. $update_options = array(); 
  457. $update_separate_options = array(); 
  458. //var_dump($_POST); 
  459.  
  460. // Get settings for option value is stored as a record or it's spearate option 
  461. foreach ( $options as $value ) { 
  462. if ( ! isset( $value['type'] ) ) continue; 
  463. if ( in_array( $value['type'], array( 'heading', 'ajax_submit', 'ajax_multi_submit' ) ) ) continue; 
  464.  
  465. // Save for global settings of plugin framework 
  466. switch ( $value['type'] ) { 
  467.  
  468. // Toggle Box Open 
  469. case 'onoff_toggle_box' : 
  470.  
  471. if ( isset( $_POST[ $this->toggle_box_open_option ] ) ) { 
  472. $option_value = 1; 
  473. } else { 
  474. $option_value = 0; 
  475.  
  476. update_option( $this->toggle_box_open_option, $option_value ); 
  477.  
  478. break; 
  479.  
  480.  
  481. if ( ! isset( $value['id'] ) || trim( $value['id'] ) == '' ) continue; 
  482. if ( ! isset( $value['default'] ) ) $value['default'] = ''; 
  483.  
  484. // For way it has an option name 
  485. if ( ! isset( $value['separate_option'] ) ) $value['separate_option'] = false; 
  486.  
  487. // Remove [, ] characters from id argument 
  488. $key = false; 
  489. if ( strstr( $value['id'], '[' ) ) { 
  490. parse_str( esc_attr( $value['id'] ), $option_array ); 
  491.  
  492. // Option name is first key 
  493. $option_keys = array_keys( $option_array ); 
  494. $first_key = current( $option_keys ); 
  495.  
  496. $id_attribute = $first_key; 
  497.  
  498. $key = key( $option_array[ $id_attribute ] ); 
  499. } else { 
  500. $id_attribute = esc_attr( $value['id'] ); 
  501.  
  502. // Get the option name 
  503. $option_value = null; 
  504.  
  505. switch ( $value['type'] ) { 
  506.  
  507. // Checkbox type 
  508. case 'checkbox' : 
  509. case 'onoff_checkbox' : 
  510. case 'switcher_checkbox' : 
  511.  
  512. if ( ! isset( $value['checked_value'] ) ) $value['checked_value'] = 1; 
  513. if ( ! isset( $value['unchecked_value'] ) ) $value['unchecked_value'] = 0; 
  514.  
  515. if ( trim( $option_name ) == '' || $value['separate_option'] != false ) { 
  516. if ( $key != false ) { 
  517. if ( isset( $_POST[ $id_attribute ][ $key ] ) ) { 
  518. $option_value = $value['checked_value']; 
  519. } else { 
  520. $option_value = $value['unchecked_value']; 
  521. }  
  522. } else { 
  523. if ( isset( $_POST[ $id_attribute ] ) ) { 
  524. $option_value = $value['checked_value']; 
  525. } else { 
  526. $option_value = $value['unchecked_value']; 
  527.  
  528. } else { 
  529. if ( $key != false ) { 
  530. if ( isset( $_POST[ $option_name ][ $id_attribute ][ $key ] ) ) { 
  531. $option_value = $value['checked_value']; 
  532. } else { 
  533. $option_value = $value['unchecked_value']; 
  534. }  
  535. } else { 
  536. if ( isset( $_POST[ $option_name ][ $id_attribute ] ) ) { 
  537. $option_value = $value['checked_value']; 
  538. } else { 
  539. $option_value = $value['unchecked_value']; 
  540.  
  541. break; 
  542.  
  543. // Array textfields 
  544. case 'array_textfields' : 
  545. if ( !isset( $value['ids'] ) || !is_array( $value['ids'] ) || count( $value['ids'] ) < 1 ) break; 
  546.  
  547. foreach ( $value['ids'] as $text_field ) { 
  548. if ( ! isset( $text_field['id'] ) || trim( $text_field['id'] ) == '' ) continue; 
  549. if ( ! isset( $text_field['default'] ) ) $text_field['default'] = ''; 
  550.  
  551. // Remove [, ] characters from id argument 
  552. $key = false; 
  553. if ( strstr( $text_field['id'], '[' ) ) { 
  554. parse_str( esc_attr( $text_field['id'] ), $option_array ); 
  555.  
  556. // Option name is first key 
  557. $option_keys = array_keys( $option_array ); 
  558. $first_key = current( $option_keys ); 
  559.  
  560. $id_attribute = $first_key; 
  561.  
  562. $key = key( $option_array[ $id_attribute ] ); 
  563. } else { 
  564. $id_attribute = esc_attr( $text_field['id'] ); 
  565.  
  566. // Get the option name 
  567. $option_value = null; 
  568.  
  569. if ( trim( $option_name ) == '' || $value['separate_option'] != false ) { 
  570. if ( $key != false ) { 
  571. if ( isset( $_POST[ $id_attribute ][ $key ] ) ) { 
  572. $option_value = $_POST[ $id_attribute ][ $key ]; 
  573. } else { 
  574. $option_value = ''; 
  575. }  
  576. } else { 
  577. if ( isset( $_POST[ $id_attribute ] ) ) { 
  578. $option_value = $_POST[ $id_attribute ]; 
  579. } else { 
  580. $option_value = ''; 
  581.  
  582. } else { 
  583. if ( $key != false ) { 
  584. if ( isset( $_POST[ $option_name ][ $id_attribute ][ $key ] ) ) { 
  585. $option_value = $_POST[ $option_name ][ $id_attribute ][ $key ]; 
  586. } else { 
  587. $option_value = ''; 
  588. }  
  589. } else { 
  590. if ( isset( $_POST[ $option_name ][ $id_attribute ] ) ) { 
  591. $option_value = $_POST[ $option_name ][ $id_attribute ]; 
  592. } else { 
  593. $option_value = ''; 
  594.  
  595. if ( strstr( $text_field['id'], '[' ) ) { 
  596. // Set keys and value 
  597. $key = key( $option_array[ $id_attribute ] ); 
  598.  
  599. $update_options[ $id_attribute ][ $key ] = $option_value; 
  600.  
  601. if ( trim( $option_name ) != '' && $value['separate_option'] != false ) { 
  602. $update_separate_options[ $id_attribute ][ $key ] = $option_value; 
  603.  
  604. } else { 
  605. $update_options[ $id_attribute ] = $option_value; 
  606.  
  607. if ( trim( $option_name ) != '' && $value['separate_option'] != false ) { 
  608. $update_separate_options[ $id_attribute ] = $option_value; 
  609.  
  610. break; 
  611.  
  612. // Other types 
  613. default : 
  614. if ( trim( $option_name ) == '' || $value['separate_option'] != false ) { 
  615. if ( $key != false ) { 
  616. if ( isset( $_POST[ $id_attribute ][ $key ] ) ) { 
  617. $option_value = $_POST[ $id_attribute ][ $key ]; 
  618. } else { 
  619. $option_value = ''; 
  620. }  
  621. } else { 
  622. if ( isset( $_POST[ $id_attribute ] ) ) { 
  623. $option_value = $_POST[ $id_attribute ]; 
  624. } else { 
  625. $option_value = ''; 
  626.  
  627. } else { 
  628. if ( $key != false ) { 
  629. if ( isset( $_POST[ $option_name ][ $id_attribute ][ $key ] ) ) { 
  630. $option_value = $_POST[ $option_name ][ $id_attribute ][ $key ]; 
  631. } else { 
  632. $option_value = ''; 
  633. }  
  634. } else { 
  635. if ( isset( $_POST[ $option_name ][ $id_attribute ] ) ) { 
  636. $option_value = $_POST[ $option_name ][ $id_attribute ]; 
  637. } else { 
  638. $option_value = ''; 
  639.  
  640. // Just for Color type 
  641. if ( 'color' == $value['type'] && '' == trim( $option_value ) ) { 
  642. $option_value = 'transparent'; 
  643. // Just for Background Color type 
  644. elseif ( 'bg_color' == $value['type'] && '' == trim( $option_value['color'] ) ) { 
  645. $option_value['color'] = 'transparent'; 
  646. } elseif ( 'upload' == $value['type'] ) { 
  647. // Uploader: Set key and value for attachment id of upload type 
  648. if ( strstr( $value['id'], '[' ) ) { 
  649. $key = key( $option_array[ $id_attribute ] ); 
  650.  
  651. if ( trim( $option_name ) != '' && $value['separate_option'] != false ) { 
  652. if ( isset( $_POST[ $id_attribute ][ $key . '_attachment_id' ] ) ) { 
  653. $attachment_id = $_POST[ $id_attribute ][ $key . '_attachment_id' ]; 
  654. } else { 
  655. $attachment_id = 0; 
  656.  
  657. $update_separate_options[ $id_attribute ][ $key . '_attachment_id' ] = $attachment_id; 
  658. } else { 
  659. if ( isset( $_POST[ $option_name ][ $id_attribute ][ $key . '_attachment_id' ] ) ) { 
  660. $attachment_id = $_POST[ $option_name ][ $id_attribute ][ $key . '_attachment_id' ]; 
  661. } else { 
  662. $attachment_id = 0; 
  663.  
  664. $update_options[ $id_attribute ][ $key . '_attachment_id' ] = $attachment_id; 
  665. } else { 
  666. if ( trim( $option_name ) != '' && $value['separate_option'] != false ) { 
  667. if ( isset( $_POST[ $id_attribute . '_attachment_id' ] ) ) { 
  668. $attachment_id = $_POST[ $id_attribute . '_attachment_id' ]; 
  669. } else { 
  670. $attachment_id = 0; 
  671. $update_separate_options[ $id_attribute . '_attachment_id' ] = $attachment_id; 
  672. } else { 
  673. if ( isset( $_POST[ $option_name ][ $id_attribute . '_attachment_id' ] ) ) { 
  674. $attachment_id = $_POST[ $option_name ][ $id_attribute . '_attachment_id' ]; 
  675. } else { 
  676. $attachment_id = 0; 
  677. $update_options[ $id_attribute . '_attachment_id' ] = $attachment_id; 
  678.  
  679. break; 
  680.  
  681.  
  682. if ( !in_array( $value['type'], array( 'array_textfields' ) ) ) { 
  683. if ( strstr( $value['id'], '[' ) ) { 
  684. // Set keys and value 
  685. $key = key( $option_array[ $id_attribute ] ); 
  686.  
  687. if ( trim( $option_name ) != '' && $value['separate_option'] != false ) { 
  688. $update_separate_options[ $id_attribute ][ $key ] = $option_value; 
  689. } else { 
  690. $update_options[ $id_attribute ][ $key ] = $option_value; 
  691.  
  692. } else { 
  693.  
  694. if ( trim( $option_name ) != '' && $value['separate_option'] != false ) { 
  695. $update_separate_options[ $id_attribute ] = $option_value; 
  696. } else { 
  697. $update_options[ $id_attribute ] = $option_value; 
  698.  
  699.  
  700. // Save settings for option values is an array and it's in single option name for all settings 
  701. if ( trim( $option_name ) != '' ) { 
  702. update_option( $option_name, $update_options ); 
  703.  
  704. // Save options if each option save in a row 
  705. if ( count( $update_options ) > 0 && trim( $option_name ) == '' ) { 
  706. foreach ( $update_options as $name => $value ) { 
  707. update_option( $name, $value ); 
  708.  
  709. // Save separate options 
  710. if ( count( $update_separate_options ) > 0 ) { 
  711. foreach ( $update_separate_options as $name => $value ) { 
  712. update_option( $name, $value ); 
  713.  
  714. return true; 
  715.  
  716.  
  717. /**-----------------------------------------------------------------------------------*/ 
  718. /** Reset Function - reset_settings */ 
  719. /**-----------------------------------------------------------------------------------*/ 
  720.  
  721. public function reset_settings( $options, $option_name = '', $reset = false, $free_version = false ) { 
  722.  
  723. if ( !is_array( $options ) || count( $options ) < 1 ) return; 
  724.  
  725. // Update settings default for option values is an array and it's in single option name for all settings 
  726. if ( trim( $option_name ) != '' ) { 
  727.  
  728. $default_settings = $this->get_settings_default( $options, $option_name ); 
  729.  
  730. $current_settings = get_option( $option_name ); 
  731. if ( ! is_array( $current_settings ) ) $current_settings = array(); 
  732. $current_settings = array_merge( $default_settings, $current_settings ); 
  733.  
  734. if ( $reset && !$free_version ) { 
  735. update_option( $option_name, $default_settings ); 
  736. } else { 
  737. if ( $free_version ) { 
  738. foreach ( $options as $value ) { 
  739. if ( ! isset( $value['type'] ) ) continue; 
  740. if ( in_array( $value['type'], array( 'heading', 'ajax_submit', 'ajax_multi_submit' ) ) ) continue; 
  741. if ( ! isset( $value['id'] ) || trim( $value['id'] ) == '' ) continue; 
  742.  
  743. switch ( $value['type'] ) { 
  744.  
  745. // Array textfields 
  746. case 'array_textfields' : 
  747. if ( !isset( $value['ids'] ) || !is_array( $value['ids'] ) || count( $value['ids'] ) < 1 ) break; 
  748.  
  749. foreach ( $value['ids'] as $text_field ) { 
  750. if ( ! isset( $text_field['id'] ) || trim( $text_field['id'] ) == '' ) continue; 
  751. if ( ! isset( $text_field['default'] ) ) $text_field['default'] = ''; 
  752. if ( ! isset( $text_field['free_version'] ) ) { 
  753. if ( ! isset( $value['free_version'] ) )  
  754. $text_field['free_version'] = false; 
  755. else 
  756. $text_field['free_version'] = $value['free_version']; 
  757. if ( $text_field['free_version'] ) unset( $default_settings[ $text_field['id']] ); 
  758.  
  759. break; 
  760.  
  761. default : 
  762. if ( ! isset( $value['default'] ) ) $value['default'] = ''; 
  763. if ( ! isset( $value['free_version'] ) ) $value['free_version'] = false; 
  764. if ( $value['free_version'] ) unset( $default_settings[ $value['id']] ); 
  765.  
  766. break; 
  767.  
  768. $current_settings = array_merge( $current_settings, $default_settings ); 
  769. update_option( $option_name, $current_settings ); 
  770. } else { 
  771. update_option( $option_name, $current_settings ); 
  772.  
  773.  
  774. // Update settings default for option value is stored as a record or it's spearate option 
  775. foreach ( $options as $value ) { 
  776. if ( ! isset( $value['type'] ) ) continue; 
  777. if ( in_array( $value['type'], array( 'heading', 'ajax_submit', 'ajax_multi_submit' ) ) ) continue; 
  778. if ( ! isset( $value['id'] ) || trim( $value['id'] ) == '' ) continue; 
  779. if ( ! isset( $value['default'] ) ) $value['default'] = ''; 
  780. if ( ! isset( $value['free_version'] ) ) $value['free_version'] = false; 
  781.  
  782. // For way it has an option name 
  783. if ( ! isset( $value['separate_option'] ) ) $value['separate_option'] = false; 
  784.  
  785. switch ( $value['type'] ) { 
  786.  
  787. // Array textfields 
  788. case 'array_textfields' : 
  789. if ( !isset( $value['ids'] ) || !is_array( $value['ids'] ) || count( $value['ids'] ) < 1 ) break; 
  790.  
  791. foreach ( $value['ids'] as $text_field ) { 
  792. if ( ! isset( $text_field['id'] ) || trim( $text_field['id'] ) == '' ) continue; 
  793. if ( ! isset( $text_field['default'] ) ) $text_field['default'] = ''; 
  794. if ( ! isset( $text_field['free_version'] ) ) { 
  795. if ( ! isset( $value['free_version'] ) )  
  796. $text_field['free_version'] = false; 
  797. else 
  798. $text_field['free_version'] = $value['free_version']; 
  799.  
  800. // Remove [, ] characters from id argument 
  801. $key = false; 
  802. if ( strstr( $text_field['id'], '[' ) ) { 
  803. parse_str( esc_attr( $text_field['id'] ), $option_array ); 
  804.  
  805. // Option name is first key 
  806. $option_keys = array_keys( $option_array ); 
  807. $first_key = current( $option_keys ); 
  808.  
  809. $id_attribute = $first_key; 
  810.  
  811. $key = key( $option_array[ $id_attribute ] ); 
  812. } else { 
  813. $id_attribute = esc_attr( $text_field['id'] ); 
  814.  
  815. if ( trim( $option_name ) == '' || $value['separate_option'] != false ) { 
  816. if ( $reset && $text_field['free_version'] && !$free_version ) { 
  817. if ( $key != false ) { 
  818. $current_settings = get_option( $id_attribute, array() ); 
  819. if ( ! is_array( $current_settings) ) { 
  820. $current_settings = array(); 
  821. $current_settings[$key] = $text_field['default']; 
  822. update_option( $id_attribute, $current_settings ); 
  823. } else { 
  824. update_option( $id_attribute, $text_field['default'] ); 
  825. } elseif ( $reset && !$text_field['free_version'] ) { 
  826. if ( $key != false ) { 
  827. $current_settings = get_option( $id_attribute, array() ); 
  828. if ( ! is_array( $current_settings) ) { 
  829. $current_settings = array(); 
  830. $current_settings[$key] = $text_field['default']; 
  831. update_option( $id_attribute, $current_settings ); 
  832. } else { 
  833. update_option( $id_attribute, $text_field['default'] ); 
  834. } else { 
  835. if ( $key != false ) { 
  836. $current_settings = get_option( $id_attribute, array() ); 
  837. if ( ! is_array( $current_settings) ) { 
  838. $current_settings = array(); 
  839. if ( ! isset( $current_settings[$key] ) ) { 
  840. $current_settings[$key] = $text_field['default']; 
  841. update_option( $id_attribute, $current_settings ); 
  842. } else { 
  843. add_option( $id_attribute, $text_field['default'] ); 
  844.  
  845. break; 
  846.  
  847. default : 
  848. // Remove [, ] characters from id argument 
  849. $key = false; 
  850. if ( strstr( $value['id'], '[' ) ) { 
  851. parse_str( esc_attr( $value['id'] ), $option_array ); 
  852.  
  853. // Option name is first key 
  854. $option_keys = array_keys( $option_array ); 
  855. $first_key = current( $option_keys ); 
  856.  
  857. $id_attribute = $first_key; 
  858.  
  859. $key = key( $option_array[ $id_attribute ] ); 
  860. } else { 
  861. $id_attribute = esc_attr( $value['id'] ); 
  862.  
  863. if ( trim( $option_name ) == '' || $value['separate_option'] != false ) { 
  864. if ( $reset && $value['free_version'] && !$free_version ) { 
  865. if ( $key != false ) { 
  866. $current_settings = get_option( $id_attribute, array() ); 
  867. if ( ! is_array( $current_settings) ) { 
  868. $current_settings = array(); 
  869. $current_settings[$key] = $value['default']; 
  870. update_option( $id_attribute, $current_settings ); 
  871. } else { 
  872. update_option( $id_attribute, $value['default'] ); 
  873. } elseif ( $reset && !$value['free_version'] ) { 
  874. if ( $key != false ) { 
  875. $current_settings = get_option( $id_attribute, array() ); 
  876. if ( ! is_array( $current_settings) ) { 
  877. $current_settings = array(); 
  878. $current_settings[$key] = $value['default']; 
  879. update_option( $id_attribute, $current_settings ); 
  880. } else { 
  881. update_option( $id_attribute, $value['default'] ); 
  882. } else { 
  883. if ( $key != false ) { 
  884. $current_settings = get_option( $id_attribute, array() ); 
  885. if ( ! is_array( $current_settings) ) { 
  886. $current_settings = array(); 
  887. if ( ! isset( $current_settings[$key] ) ) { 
  888. $current_settings[$key] = $value['default']; 
  889. update_option( $id_attribute, $current_settings ); 
  890. } else { 
  891. add_option( $id_attribute, $value['default'] ); 
  892.  
  893. break; 
  894.  
  895.  
  896.  
  897. /**-----------------------------------------------------------------------------------*/ 
  898. /** Get Option Value Function - settings_get_option */ 
  899. /** Just called for when each option has an option value for settings 
  900. /**-----------------------------------------------------------------------------------*/ 
  901.  
  902. public function settings_get_option( $option_name, $default = '' ) { 
  903. // Array value 
  904. if ( strstr( $option_name, '[' ) ) { 
  905.  
  906. parse_str( $option_name, $option_array ); 
  907.  
  908. // Option name is first key 
  909. $option_keys = array_keys( $option_array ); 
  910. $option_name = current( $option_keys ); 
  911.  
  912. // Get value 
  913. $option_values = get_option( $option_name, '' ); 
  914.  
  915. $key = key( $option_array[ $option_name ] ); 
  916.  
  917. if ( isset( $option_values[ $key ] ) ) 
  918. $option_value = $option_values[ $key ]; 
  919. else 
  920. $option_value = null; 
  921.  
  922. // Single value 
  923. } else { 
  924. $option_value = get_option( $option_name, null ); 
  925.  
  926. if ( is_array( $option_value ) ) 
  927. $option_value = array_map( 'stripslashes', $option_value ); 
  928. elseif ( ! is_null( $option_value ) ) 
  929. $option_value = stripslashes( $option_value ); 
  930.  
  931. return $option_value === null ? $default : $option_value; 
  932.  
  933. /** 
  934. * Output admin fields. 
  935. * @access public 
  936. * @param array $options : Opens array to output 
  937. * @param text $form_key : It's unique key for form to get correct save and reset action for this form 
  938. * @param text $option_name : Save all settings as array into database for a single option name 
  939. * @param array $form_messages : { 'success_message' => '', 'error_message' => '', 'reset_message' => '' } 
  940. * @return void 
  941. * ======================================================================== 
  942. * Option Array Structure : 
  943. * type => heading | ajax_submit | ajax_multi_submit | google_api_key | onoff_toggle_box | text | email | number | password | color | bg_color | textarea | select | multiselect | radio | onoff_radio | checkbox | onoff_checkbox  
  944. * | switcher_checkbox | image_size | single_select_page | typography | border | border_styles | border_corner | box_shadow  
  945. * | slider | upload | wp_editor | array_textfields |  
  946. * id => text 
  947. * name => text 
  948. * free_version => true | false : if Yes then when save settings with $free_version = true, it does reset this option 
  949. * class => text 
  950. * css => text 
  951. * default => text : apply for other types 
  952. * array( 'enable' => 1, 'color' => '#515151' ) : apply bg_color only 
  953. * array( 'width' => '125', 'height' => '125', 'crop' => 1 ) : apply image_size only 
  954. * array( 'size' => '9px', line_height => '1.4em', 'face' => 'Arial', 'style' => 'normal', 'color' => '#515151' ) : apply for typography only  
  955. * array( 'width' => '1px', 'style' => 'normal', 'color' => '#515151', 'corner' => 'rounded' | 'square' , 'top_left_corner' => 3,  
  956. * 'top_right_corner' => 3, 'bottom_left_corner' => 3, 'bottom_right_corner' => 3 ) : apply for border only 
  957. * array( 'width' => '1px', 'style' => 'normal', 'color' => '#515151' ) : apply for border_styles only 
  958. * array( 'corner' => 'rounded' | 'square' , 'top_left_corner' => 3, 'top_right_corner' => 3, 'bottom_left_corner' => 3,  
  959. * 'bottom_right_corner' => 3 ) : apply for border_corner only 
  960. * array( 'enable' => 1|0, 'h_shadow' => '5px' , 'v_shadow' => '5px', 'blur' => '2px' , 'spread' => '2px', 'color' => '#515151',  
  961. * 'inset' => '' | 'insert' ) : apply for box_shadow only 
  962. * desc => text 
  963. * desc_tip => text 
  964. * separate_option => true | false 
  965. * custom_attributes => array 
  966. * view_doc => allowed html code : apply for heading only 
  967. * placeholder => text : apply for input, email, number, password, textarea, select, multiselect and single_select_page 
  968. * hide_if_checked => true | false : apply for checkbox only 
  969. * show_if_checked => true | false : apply for checkbox only 
  970. * checkboxgroup => start | end : apply for checkbox only 
  971. * checked_value => text : apply for checkbox, onoff_checkbox, switcher_checkbox only ( it's value set to database when checkbox is checked ) 
  972. * unchecked_value => text : apply for checkbox, onoff_checkbox, switcher_checkbox only ( it's value set to database when checkbox is unchecked ) 
  973. * checked_label => text : apply for onoff_checkbox, switcher_checkbox only ( set it to show the text instead ON word default ) 
  974. * unchecked_label => text : apply for onoff_checkbox, switcher_checkbox only ( set it to show the text instead OFF word default ) 
  975. * options => array : apply for select, multiselect, radio types 
  976. * onoff_options => array : apply for onoff_radio only 
  977. * ---------------- example --------------------- 
  978. * array(  
  979. * array( 'val' => 1,  
  980. * 'text' => 'Top',  
  981. * 'checked_label' => 'ON',  
  982. * 'unchecked_value' => 'OFF' ),  
  983. * array( 'val' => 2,  
  984. * 'text' => 'Bottom',  
  985. * 'checked_label' => 'ON',  
  986. * 'unchecked_value' => 'OFF' ),  
  987. * ) 
  988. * --------------------------------------------- 
  989. * args => array : apply for single_select_page only 
  990. * min => number : apply for slider, border, border_corner types only 
  991. * max => number : apply for slider, border, border_corner types only 
  992. * increment => number : apply for slider, border, border_corner types only 
  993. * textarea_rows => number : apply for wp_editor type only 
  994. * ids => array : apply for array_textfields only 
  995. * ---------------- example --------------------- 
  996. * array(  
  997. * array( 'id' => 'box_margin_top',  
  998. * 'name' => 'Top',  
  999. * 'class' => '',  
  1000. * 'css' => 'width:40px;',  
  1001. * 'default' => '10px' ),  
  1002. * array( 'id' => 'box_margin_top',  
  1003. * 'name' => 'Top',  
  1004. * 'class' => '',  
  1005. * 'css' => 'width:40px;',  
  1006. * 'default' => '10px' ),  
  1007. * ) 
  1008. * --------------------------------------------- 
  1009. * strip_methods => true | false : apply for upload type only 
  1010. * submit_data => array : apply for ajax_submit only 
  1011. * ---------------- example --------------------- 
  1012. * array( 
  1013. * 'ajax_url' => admin_url( 'admin-ajax.php', 'relative' ),  
  1014. * 'ajax_type' => 'POST',  
  1015. * 'data' => array( 
  1016. * 'action' => 'action_name',  
  1017. * ),  
  1018. * ),  
  1019. * button_name => text : apply for ajax_submit, ajax_multi_submit only 
  1020. * progressing_text => text : apply for ajax_submit, ajax_multi_submit only 
  1021. * completed_text => text : apply for ajax_submit, ajax_multi_submit only 
  1022. * successed_text => text : apply for ajax_submit, ajax_multi_submit only 
  1023. * statistic_column => number : apply for ajax_multi_submit only 
  1024. * resubmit => true | false : apply for ajax_multi_submit only 
  1025. * multi_submit => array : apply for ajax_multi_submit only 
  1026. * ---------------- example --------------------- 
  1027. * array( 
  1028. * array( 
  1029. * 'item_id' => 'item_ajax_id',  
  1030. * 'item_name' => 'Item Ajax Name',  
  1031. * 'current_items' => 20,  
  1032. * 'total_items' => 20,  
  1033. * 'progressing_text' => 'Processing,  
  1034. * 'completed_text' => 'Completed',  
  1035. * 'submit_data' => array( 
  1036. * 'ajax_url' => admin_url( 'admin-ajax.php', 'relative' ),  
  1037. * 'ajax_type' => 'POST',  
  1038. * 'data' => array( 
  1039. * 'action' => 'action_name',  
  1040. * ) 
  1041. * ),  
  1042. * 'show_statistic' => true,  
  1043. * 'statistic_customizer' => array( 
  1044. * 'current_color' => '#96587d',  
  1045. * ),  
  1046. * ),  
  1047. * array( 
  1048. * ... 
  1049. * ),  
  1050. * ... 
  1051. * ) 
  1052. */ 
  1053.  
  1054. public function admin_forms( $options, $form_key, $option_name = '', $form_messages = array() ) { 
  1055. global $wc_predictive_search_fonts_face, $wc_predictive_search_uploader, $current_subtab; 
  1056.  
  1057. $new_settings = array(); $new_single_setting = ''; // :) 
  1058. $admin_message = ''; 
  1059.  
  1060. if ( isset( $_POST['form_name_action'] ) && $_POST['form_name_action'] == $form_key ) { 
  1061.  
  1062. do_action( $this->plugin_name . '_before_settings_save_reset' ); 
  1063. do_action( $this->plugin_name . '-' . trim( $form_key ) . '_before_settings_save' ); 
  1064.  
  1065. // Save settings action 
  1066. if ( isset( $_POST['bt_save_settings'] ) ) { 
  1067. $this->save_settings( $options, $option_name ); 
  1068. $admin_message = $this->get_success_message( ( isset( $form_messages['success_message'] ) ) ? $form_messages['success_message'] : '' ); 
  1069. }  
  1070. // Reset settings action 
  1071. elseif ( isset( $_POST['bt_reset_settings'] ) ) { 
  1072. $this->reset_settings( $options, $option_name, true ); 
  1073. $admin_message = $this->get_success_message( ( isset( $form_messages['reset_message'] ) ) ? $form_messages['reset_message'] : '' ); 
  1074.  
  1075. do_action( $this->plugin_name . '-' . trim( $form_key ) . '_after_settings_save' ); 
  1076. do_action( $this->plugin_name . '_after_settings_save_reset' ); 
  1077. do_action( $this->plugin_name . '-' . trim( $form_key ) . '_settings_init' ); 
  1078. do_action( $this->plugin_name . '_settings_init' ); 
  1079.  
  1080. $option_values = array(); 
  1081. if ( trim( $option_name ) != '' ) { 
  1082. $option_values = get_option( $option_name, array() ); 
  1083. if ( is_array( $option_values ) ) 
  1084. $option_values = array_map( array( $this, 'admin_stripslashes' ), $option_values ); 
  1085. else 
  1086. $option_values = array(); 
  1087.  
  1088. $default_settings = $this->get_settings_default( $options, $option_name ); 
  1089.  
  1090. $option_values = array_merge($default_settings, $option_values); 
  1091.  
  1092. if ( !is_array( $options ) || count( $options ) < 1 ) return ''; 
  1093. ?> 
  1094.  
  1095. <?php echo $admin_message; ?> 
  1096. <div class="a3rev_panel_container" style="visibility:hidden; height:0; overflow:hidden;" > 
  1097. <form action="" method="post"> 
  1098. <?php do_action( $this->plugin_name . '-' . trim( $form_key ) . '_settings_start' ); ?> 
  1099. <?php 
  1100. $count_heading = 0; 
  1101. $end_heading_id = false; 
  1102. $header_box_opening = false; 
  1103. $header_sub_box_opening = false; 
  1104.  
  1105. $user_id = get_current_user_id(); 
  1106. $opened_box = get_user_meta( $user_id, $this->plugin_name . '-' . trim( $form_key ), true ); 
  1107. if ( empty( $opened_box ) || ! is_array( $opened_box ) ) { 
  1108. $opened_box = array(); 
  1109.  
  1110. $toggle_box_open = $this->settings_get_option( $this->toggle_box_open_option, 0 ); 
  1111. if ( ! isset( $_POST['bt_save_settings'] ) && 0 == $toggle_box_open ) { 
  1112. delete_user_meta( $user_id, $this->plugin_name . '-' . trim( $form_key ) ); 
  1113.  
  1114. foreach ( $options as $value ) { 
  1115. if ( ! isset( $value['type'] ) ) continue; 
  1116. if ( ! isset( $value['id'] ) ) $value['id'] = ''; 
  1117. if ( ! isset( $value['name'] ) ) $value['name'] = ''; 
  1118. if ( ! isset( $value['class'] ) ) $value['class'] = ''; 
  1119. if ( ! isset( $value['css'] ) ) $value['css'] = ''; 
  1120. if ( ! isset( $value['default'] ) ) $value['default'] = ''; 
  1121. if ( ! isset( $value['desc'] ) ) $value['desc'] = ''; 
  1122. if ( ! isset( $value['desc_tip'] ) ) $value['desc_tip'] = false; 
  1123. if ( ! isset( $value['placeholder'] ) ) $value['placeholder'] = ''; 
  1124.  
  1125. // For way it has an option name 
  1126. if ( ! isset( $value['separate_option'] ) ) $value['separate_option'] = false; 
  1127.  
  1128. // Custom attribute handling 
  1129. $custom_attributes = array(); 
  1130.  
  1131. if ( ! empty( $value['custom_attributes'] ) && is_array( $value['custom_attributes'] ) ) 
  1132. foreach ( $value['custom_attributes'] as $attribute => $attribute_value ) 
  1133. $custom_attributes[] = esc_attr( $attribute ) . '="' . esc_attr( $attribute_value ) . '"'; 
  1134.  
  1135. // Description handling 
  1136. if ( $value['desc_tip'] === true ) { 
  1137. $description = ''; 
  1138. $tip = $value['desc']; 
  1139. } elseif ( ! empty( $value['desc_tip'] ) ) { 
  1140. $description = $value['desc']; 
  1141. $tip = $value['desc_tip']; 
  1142. } elseif ( ! empty( $value['desc'] ) ) { 
  1143. $description = $value['desc']; 
  1144. $tip = ''; 
  1145. } else { 
  1146. $description = $tip = ''; 
  1147.  
  1148. if ( $description && in_array( $value['type'], array( 'manual_check_version', 'ajax_submit', 'ajax_multi_submit', 'textarea', 'radio', 'onoff_radio', 'typography', 'border', 'border_styles', 'array_textfields', 'wp_editor', 'upload' ) ) ) { 
  1149. $description = '<div class="desc" style="margin-bottom:5px;">' . $description . '</div>'; 
  1150. } elseif ( $description ) { 
  1151. $description = '<span class="description" style="margin-left:5px;">' . $description . '</span>'; 
  1152.  
  1153. /** 
  1154. * Add Default value into description and description tip if it has shortcode : 
  1155. * [default_value] : apply for normal types 
  1156. * [default_value_width] : apply for image_size type 
  1157. * [default_value_height] : apply for image_size type 
  1158. * [default_value_size] : apply for typography type 
  1159. * [default_value_line_height] : apply for typography type 
  1160. * [default_value_face] : apply for typography type 
  1161. * [default_value_style] : apply for typography, border, border_styles types 
  1162. * [default_value_color] : apply for typography, border, border_styles types 
  1163. * [default_value_width] : apply for border, border_styles types 
  1164. * [default_value_rounded_value]: apply for border, border_corner types 
  1165. * [default_value_top_left_corner]: apply for border, border_corner types 
  1166. * [default_value_top_right_corner]: apply for border, border_corner types 
  1167. * [default_value_bottom_left_corner]: apply for border, border_corner types 
  1168. * [default_value_bottom_right_corner]: apply for border, border_corner types 
  1169. */ 
  1170. if ( $value['type'] == 'image_size' ) { 
  1171. if ( ! is_array( $value['default'] ) ) $value['default'] = array(); 
  1172. if ( ! isset( $value['default']['width'] ) ) $value['default']['width'] = ''; 
  1173. if ( ! isset( $value['default']['height'] ) ) $value['default']['height'] = ''; 
  1174. if ( ! isset( $value['default']['crop'] ) ) $value['default']['crop'] = 1; 
  1175.  
  1176. $description = str_replace( '[default_value_width]', $value['default']['width'], $description ); 
  1177. $description = str_replace( '[default_value_height]', $value['default']['height'], $description ); 
  1178. } elseif ( $value['type'] == 'typography' ) { 
  1179. if ( ! is_array( $value['default'] ) ) $value['default'] = array(); 
  1180. if ( ! isset( $value['default']['size'] ) ) $value['default']['size'] = ''; 
  1181. if ( ! isset( $value['default']['line_height'] ) ) $value['default']['line_height'] = ''; 
  1182. if ( ! isset( $value['default']['face'] ) ) $value['default']['face'] = ''; 
  1183. if ( ! isset( $value['default']['style'] ) ) $value['default']['style'] = ''; 
  1184. if ( ! isset( $value['default']['color'] ) || trim( $value['default']['color'] ) == '' ) $value['default']['color'] = '#515151'; 
  1185.  
  1186. $description = str_replace( '[default_value_size]', $value['default']['size'], $description ); 
  1187. $description = str_replace( '[default_value_face]', $value['default']['face'], $description ); 
  1188. $description = str_replace( '[default_value_style]', $value['default']['style'], $description ); 
  1189. $description = str_replace( '[default_value_color]', $value['default']['color'], $description ); 
  1190. } elseif ( in_array( $value['type'], array( 'border', 'border_styles', 'border_corner' ) ) ) { 
  1191. if ( ! is_array( $value['default'] ) ) $value['default'] = array(); 
  1192.  
  1193. if ( ! isset( $value['default']['width'] ) ) $value['default']['width'] = ''; 
  1194. if ( ! isset( $value['default']['style'] ) ) $value['default']['style'] = ''; 
  1195. if ( ! isset( $value['default']['color'] ) || trim( $value['default']['color'] ) == '' ) $value['default']['color'] = '#515151'; 
  1196.  
  1197. if ( ! isset( $value['default']['corner'] ) ) $value['default']['corner'] = 'rounded'; 
  1198. if ( ! isset( $value['default']['rounded_value'] ) ) $value['default']['rounded_value'] = ''; 
  1199. if ( ! isset( $value['default']['top_left_corner'] ) ) $value['default']['top_left_corner'] = $value['default']['rounded_value']; 
  1200. if ( ! isset( $value['default']['top_right_corner'] ) ) $value['default']['top_right_corner'] = $value['default']['rounded_value']; 
  1201. if ( ! isset( $value['default']['bottom_left_corner'] ) ) $value['default']['bottom_left_corner'] = $value['default']['rounded_value']; 
  1202. if ( ! isset( $value['default']['bottom_right_corner'] ) ) $value['default']['bottom_right_corner'] = $value['default']['rounded_value']; 
  1203.  
  1204. $description = str_replace( '[default_value_width]', $value['default']['width'], $description ); 
  1205. $description = str_replace( '[default_value_style]', $value['default']['style'], $description ); 
  1206. $description = str_replace( '[default_value_color]', $value['default']['color'], $description ); 
  1207. $description = str_replace( '[default_value_rounded_value]', $value['default']['rounded_value'], $description ); 
  1208. $description = str_replace( '[default_value_top_left_corner]', $value['default']['top_left_corner'], $description ); 
  1209. $description = str_replace( '[default_value_top_right_corner]', $value['default']['top_right_corner'], $description ); 
  1210. $description = str_replace( '[default_value_bottom_left_corner]', $value['default']['bottom_left_corner'], $description ); 
  1211. $description = str_replace( '[default_value_bottom_right_corner]', $value['default']['bottom_right_corner'], $description ); 
  1212. } elseif ( $value['type'] == 'box_shadow' ) { 
  1213. if ( ! is_array( $value['default'] ) ) $value['default'] = array(); 
  1214. if ( ! isset( $value['default']['enable'] ) || trim( $value['default']['enable'] ) == '' ) $value['default']['enable'] = 0; 
  1215. if ( ! isset( $value['default']['color'] ) || trim( $value['default']['color'] ) == '' ) $value['default']['color'] = '#515151'; 
  1216. if ( ! isset( $value['default']['h_shadow'] ) || trim( $value['default']['h_shadow'] ) == '' ) $value['default']['h_shadow'] = '0px'; 
  1217. if ( ! isset( $value['default']['v_shadow'] ) || trim( $value['default']['v_shadow'] ) == '' ) $value['default']['v_shadow'] = '0px'; 
  1218. if ( ! isset( $value['default']['blur'] ) || trim( $value['default']['blur'] ) == '' ) $value['default']['blur'] = '0px'; 
  1219. if ( ! isset( $value['default']['spread'] ) || trim( $value['default']['spread'] ) == '' ) $value['default']['spread'] = '0px'; 
  1220. if ( ! isset( $value['default']['inset'] ) || trim( $value['default']['inset'] ) == '' ) $value['default']['inset'] = ''; 
  1221.  
  1222. $description = str_replace( '[default_value_color]', $value['default']['color'], $description ); 
  1223. $description = str_replace( '[default_value_h_shadow]', $value['default']['h_shadow'], $description ); 
  1224. $description = str_replace( '[default_value_v_shadow]', $value['default']['v_shadow'], $description ); 
  1225. $description = str_replace( '[default_value_blur]', $value['default']['blur'], $description ); 
  1226. $description = str_replace( '[default_value_spread]', $value['default']['spread'], $description ); 
  1227.  
  1228. } elseif ( $value['type'] == 'bg_color' ) { 
  1229. if ( ! is_array( $value['default'] ) ) $value['default'] = array(); 
  1230. if ( ! isset( $value['default']['enable'] ) || trim( $value['default']['enable'] ) == '' ) $value['default']['enable'] = 0; 
  1231. if ( ! isset( $value['default']['color'] ) || trim( $value['default']['color'] ) == '' ) $value['default']['color'] = '#515151'; 
  1232.  
  1233. $description = str_replace( '[default_value_color]', $value['default']['color'], $description ); 
  1234. } elseif ( $value['type'] != 'multiselect' ) { 
  1235. $description = str_replace( '[default_value]', $value['default'], $description ); 
  1236.  
  1237. if ( $tip && in_array( $value['type'], array( 'checkbox' ) ) ) { 
  1238.  
  1239. $tip = '<p class="description">' . $tip . '</p>'; 
  1240.  
  1241. } elseif ( $tip ) { 
  1242.  
  1243. $tip = '<div class="help_tip a3-plugin-ui-icon a3-plugin-ui-help-icon" data-tip="' . esc_attr( $tip ) . '"></div>'; 
  1244.  
  1245.  
  1246. // Remove [, ] characters from id argument 
  1247. $child_key = false; 
  1248. if ( strstr( $value['id'], '[' ) ) { 
  1249. parse_str( esc_attr( $value['id'] ), $option_array ); 
  1250.  
  1251. // Option name is first key 
  1252. $option_keys = array_keys( $option_array ); 
  1253. $first_key = current( $option_keys ); 
  1254.  
  1255. $id_attribute = $first_key; 
  1256.  
  1257. $child_key = key( $option_array[ $id_attribute ] ); 
  1258. } else { 
  1259. $id_attribute = esc_attr( $value['id'] ); 
  1260.  
  1261. // Get option value when option name is not parse or when it's spearate option 
  1262. if ( trim( $option_name ) == '' || $value['separate_option'] != false ) { 
  1263. $option_value = $this->settings_get_option( $value['id'], $value['default'] ); 
  1264. // Get option value when it's an element from option array  
  1265. else { 
  1266. if ( $child_key != false ) { 
  1267. $option_value = ( isset( $option_values[ $id_attribute ][ $child_key ] ) ) ? $option_values[ $id_attribute ][ $child_key ] : $value['default']; 
  1268. } else { 
  1269. $option_value = ( isset( $option_values[ $id_attribute ] ) ) ? $option_values[ $id_attribute ] : $value['default']; 
  1270.  
  1271. // Generate name and id attributes 
  1272. if ( trim( $option_name ) == '' ) { 
  1273. $name_attribute = esc_attr( $value['id'] ); 
  1274. } elseif ( $value['separate_option'] != false ) { 
  1275. $name_attribute = esc_attr( $value['id'] ); 
  1276. $id_attribute = esc_attr( $option_name ) . '_' . $id_attribute; 
  1277. } else { 
  1278. // Array value 
  1279. if ( strstr( $value['id'], '[' ) ) { 
  1280. $name_attribute = esc_attr( $option_name ) . '[' . $id_attribute . ']' . str_replace( $id_attribute . '[', '[', esc_attr( $value['id'] ) ); 
  1281. } else { 
  1282. $name_attribute = esc_attr( $option_name ) . '[' . esc_attr( $value['id'] ) . ']'; 
  1283. $id_attribute = esc_attr( $option_name ) . '_' . $id_attribute; 
  1284.  
  1285. // Switch based on type 
  1286. switch( $value['type'] ) { 
  1287.  
  1288. // Heading 
  1289. case 'heading': 
  1290.  
  1291. $is_box = false; 
  1292. if ( isset( $value['is_box'] ) && true == $value['is_box'] ) { 
  1293. $is_box = true; 
  1294.  
  1295. $is_sub = false; 
  1296. if ( isset( $value['is_sub'] ) && true == $value['is_sub'] ) { 
  1297. $is_sub = true; 
  1298.  
  1299. $count_heading++; 
  1300. if ( $count_heading > 1 ) { 
  1301. if ( trim( $end_heading_id ) != '' ) do_action( $this->plugin_name . '_settings_' . sanitize_title( $end_heading_id ) . '_end' ); 
  1302. echo '</table>' . "\n\n"; 
  1303. echo '</div>' . "\n\n"; 
  1304. if ( trim( $end_heading_id ) != '' ) do_action( $this->plugin_name . '_settings_' . sanitize_title( $end_heading_id ) . '_after' ); 
  1305. if ( ! empty( $value['id'] ) ) 
  1306. $end_heading_id = $value['id']; 
  1307. else 
  1308. $end_heading_id = ''; 
  1309.  
  1310. if ( $header_sub_box_opening ) { 
  1311. $header_sub_box_opening = false; 
  1312.  
  1313. // close box inside 
  1314. echo '</div>' . "\n\n"; 
  1315.  
  1316. // close panel box 
  1317. echo '</div>' . "\n\n"; 
  1318.  
  1319. if ( $is_box && $header_box_opening && ! $is_sub ) { 
  1320. $header_box_opening = false; 
  1321.  
  1322. // close box inside 
  1323. echo '</div>' . "\n\n"; 
  1324.  
  1325. // close panel box 
  1326. echo '</div>' . "\n\n"; 
  1327.  
  1328. $view_doc = ( isset( $value['view_doc'] ) ) ? $value['view_doc'] : ''; 
  1329.  
  1330. if ( ! empty( $value['id'] ) ) do_action( $this->plugin_name . '_settings_' . sanitize_title( $value['id'] ) . '_before' ); 
  1331.  
  1332. if ( $is_box ) { 
  1333. $heading_box_id = $count_heading; 
  1334. if ( ! empty( $value['id'] ) ) { 
  1335. $heading_box_id = $value['id']; 
  1336.  
  1337. $toggle_box_class = 'enable_toggle_box_save'; 
  1338.  
  1339. $opened_class = ''; 
  1340. if ( in_array( $heading_box_id, $opened_box ) && 1 == $toggle_box_open ) { 
  1341. $opened_class = 'box_open'; 
  1342.  
  1343. if ( isset( $_POST['bt_save_settings']) && in_array( $heading_box_id, $opened_box ) ) { 
  1344. $opened_class = 'box_open'; 
  1345.  
  1346. // Change to open box for the heading set alway_open = true 
  1347. if ( isset( $value['alway_open'] ) && true == $value['alway_open'] ) { 
  1348. $opened_class = 'box_open'; 
  1349.  
  1350. // Change to close box for the heading set alway_close = true 
  1351. if ( isset( $value['alway_close'] ) && true == $value['alway_close'] ) { 
  1352. $opened_class = ''; 
  1353.  
  1354. // Make the box open on first load with this argument first_open = true 
  1355. if ( isset( $value['first_open'] ) && true == $value['first_open'] ) { 
  1356. $this_box_is_opened = get_user_meta( $user_id, $this->plugin_name . '-' . trim( $heading_box_id ) . '-' . 'opened', true ); 
  1357. if ( empty( $this_box_is_opened ) ) { 
  1358. $opened_class = 'box_open'; 
  1359. add_user_meta( $user_id, $this->plugin_name . '-' . trim( $heading_box_id ) . '-' . 'opened', 1 ); 
  1360.  
  1361. $box_handle_class = ''; 
  1362. if ( isset( $value['is_active'] ) && true == $value['is_active'] ) { 
  1363. $box_handle_class .= 'box_active'; 
  1364.  
  1365. if ( isset( $_GET['box_open'] ) && $_GET['box_open'] == $value['id'] ) { 
  1366. $opened_class = 'box_open'; 
  1367.  
  1368. // open panel box 
  1369. echo '<div id="'. esc_attr( $value['id'] ) . '" class="a3rev_panel_box '. esc_attr( $value['class'] ) .'" style="'. esc_attr( $value['css'] ) .'">' . "\n\n"; 
  1370.  
  1371. // open box handle 
  1372. echo '<div data-form-key="'. esc_attr( trim( $form_key ) ) .'" data-box-id="'. esc_attr( $heading_box_id ) .'" class="a3rev_panel_box_handle ' . $box_handle_class .'" >' . "\n\n"; 
  1373.  
  1374. echo ( ! empty( $value['name'] ) ) ? '<h3 class="a3-plugin-ui-panel-box '. $toggle_box_class . ' ' . $opened_class . '">'. esc_html( $value['name'] ) .' '. $view_doc .'</h3>' : ''; 
  1375.  
  1376. if ( stristr( $value['class'], 'pro_feature_fields' ) !== false && ! empty( $value['id'] ) ) $this->upgrade_top_message( true, sanitize_title( $value['id'] ) ); 
  1377. elseif ( stristr( $value['class'], 'pro_feature_fields' ) !== false ) $this->upgrade_top_message( true ); 
  1378.  
  1379. // close box handle 
  1380. echo '</div>' . "\n\n"; 
  1381.  
  1382. // open box inside 
  1383. echo '<div id="'. esc_attr( $value['id'] ) . '_box_inside" class="a3rev_panel_box_inside '.$opened_class.'" >' . "\n\n"; 
  1384.  
  1385. echo '<div class="a3rev_panel_inner">' . "\n\n"; 
  1386.  
  1387. if ( $is_sub ) { 
  1388. // Mark this heading as a sub box is openning to check for close it on next header box 
  1389. $header_sub_box_opening = true; 
  1390. } else { 
  1391. // Mark this heading as a box is openning to check for close it on next header box 
  1392. $header_box_opening = true; 
  1393.  
  1394. } else { 
  1395. echo '<div id="'. esc_attr( $value['id'] ) . '" class="a3rev_panel_inner '. esc_attr( $value['class'] ) .'" style="'. esc_attr( $value['css'] ) .'">' . "\n\n"; 
  1396. if ( stristr( $value['class'], 'pro_feature_fields' ) !== false && ! empty( $value['id'] ) ) $this->upgrade_top_message( true, sanitize_title( $value['id'] ) ); 
  1397. elseif ( stristr( $value['class'], 'pro_feature_fields' ) !== false ) $this->upgrade_top_message( true ); 
  1398.  
  1399. echo ( ! empty( $value['name'] ) ) ? '<h3>'. esc_html( $value['name'] ) .' '. $view_doc .'</h3>' : ''; 
  1400.  
  1401. if ( ! empty( $value['desc'] ) ) { 
  1402. echo '<div class="a3rev_panel_box_description" >' . "\n\n"; 
  1403. echo wpautop( wptexturize( $value['desc'] ) ); 
  1404. echo '</div>' . "\n\n"; 
  1405.  
  1406. echo '<table class="form-table">' . "\n\n"; 
  1407.  
  1408. if ( ! empty( $value['id'] ) ) do_action( $this->plugin_name . '_settings_' . sanitize_title( $value['id'] ) . '_start' ); 
  1409. break; 
  1410.  
  1411. // Google API Key input 
  1412. case 'google_api_key': 
  1413.  
  1414. $google_api_key = $this->settings_get_option( $this->google_api_key_option ); 
  1415. $google_api_key_enable = $this->settings_get_option( $this->google_api_key_option . '_enable', 0 ); 
  1416. if ( ! isset( $value['checked_label'] ) ) $value['checked_label'] = __( 'ON', 'woocommerce-predictive-search' ); 
  1417. if ( ! isset( $value['unchecked_label'] ) ) $value['unchecked_label'] = __( 'OFF', 'woocommerce-predictive-search' ); 
  1418.  
  1419. ?><tr valign="top"> 
  1420. <th scope="row" class="titledesc"> 
  1421. <?php echo $tip; ?> 
  1422. <label for="<?php echo $this->google_api_key_option; ?>"><?php echo __( 'Google Fonts API', 'woocommerce-predictive-search' ); ?></label> 
  1423. </th> 
  1424. <td class="forminp forminp-onoff_checkbox forminp-<?php echo sanitize_title( $value['type'] ) ?>"> 
  1425. <input 
  1426. name="<?php echo $this->google_api_key_option; ?>_enable" 
  1427. id="<?php echo $this->google_api_key_option; ?>_enable" 
  1428. class="a3rev-ui-onoff_checkbox a3rev-ui-onoff_google_api_key_enable" 
  1429. checked_label="<?php echo esc_html( $value['checked_label'] ); ?>" 
  1430. unchecked_label="<?php echo esc_html( $value['unchecked_label'] ); ?>" 
  1431. type="checkbox" 
  1432. value="1" 
  1433. <?php checked( $google_api_key_enable, 1 ); ?> 
  1434. /> <span class="description" style="margin-left:5px;"><?php echo __( 'ON to connect to Google Fonts API and have auto font updates direct from Google.', 'woocommerce-predictive-search' ); ?></span> 
  1435.  
  1436. <div> </div> 
  1437. <div class="a3rev-ui-google-api-key-container" style="<?php if( 1 != $google_api_key_enable ) { echo 'display: none;'; } ?>"> 
  1438. <div class="a3rev-ui-google-api-key-description"><?php echo sprintf( __( "Enter your existing Google Fonts API Key below. Don't have a key? Visit <a href='%s' target='_blank'>Google Developer API</a> to create a key", 'woocommerce-predictive-search' ), 'https://developers.google.com/fonts/docs/developer_api#APIKey' ); ?></div> 
  1439. <div class="a3rev-ui-google-api-key-inside  
  1440. <?php 
  1441. if ( $wc_predictive_search_fonts_face->is_valid_google_api_key() ) { 
  1442. echo 'a3rev-ui-google-valid-key'; 
  1443. } elseif ( '' != $google_api_key ) { 
  1444. echo 'a3rev-ui-google-unvalid-key'; 
  1445. ?> 
  1446. "> 
  1447. <input 
  1448. name="<?php echo $this->google_api_key_option; ?>" 
  1449. id="<?php echo $this->google_api_key_option; ?>" 
  1450. type="text" 
  1451. style="<?php echo esc_attr( $value['css'] ); ?>" 
  1452. value="<?php echo esc_attr( $google_api_key ); ?>" 
  1453. class="a3rev-ui-text a3rev-ui-<?php echo sanitize_title( $value['type'] ) ?> <?php echo esc_attr( $value['class'] ); ?>" 
  1454. placeholder="<?php echo __( 'Google Fonts API Key', 'woocommerce-predictive-search' ); ?>" 
  1455. <?php echo implode( ' ', $custom_attributes ); ?> 
  1456. /> 
  1457. <p class="a3rev-ui-google-valid-key-message"><?php echo __( 'Your Google API Key is valid and automatic font updates are enabled.', 'woocommerce-predictive-search' ); ?></p> 
  1458. <p class="a3rev-ui-google-unvalid-key-message"><?php echo __( 'Please enter a valid Google API Key.', 'woocommerce-predictive-search' ); ?></p> 
  1459. </div> 
  1460. </div> 
  1461. </td> 
  1462. </tr><?php 
  1463.  
  1464. break; 
  1465.  
  1466. // Manual Check New Version when click on the button instead of wait for daily 
  1467. case 'manual_check_version': 
  1468. $version_message = $this->get_version_message(); 
  1469. $new_version_class = ''; 
  1470. if ( '' != trim( $version_message ) ) { 
  1471. $new_version_class = 'a3rev-ui-new-version-message'; 
  1472.  
  1473. ?><tr valign="top"> 
  1474. <th scope="row" class="titledesc"> 
  1475. <?php echo $tip; ?> 
  1476. <label><?php echo __( 'Check New Version', 'woocommerce-predictive-search' ); ?></label> 
  1477. </th> 
  1478. <td class="forminp forminp-manual_check_version"> 
  1479. <?php echo $description; ?> 
  1480.  
  1481. <input 
  1482. data-transient-name="<?php echo $this->version_transient; ?>" 
  1483. name="<?php echo $this->plugin_name . '-check-version'; ?>" 
  1484. id="<?php echo $this->plugin_name . '-check-version'; ?>" 
  1485. class="button button-primary a3rev-ui-manual_check_version" 
  1486. type="button" 
  1487. value="<?php echo __( 'Check Now', 'woocommerce-predictive-search' ); ?>" 
  1488. /> <span class="a3rev-ui-version-checking"> </span> 
  1489. <p class="a3rev-ui-check-version-message <?php echo $new_version_class; ?>"><?php echo $version_message; ?></p> 
  1490.  
  1491. </td> 
  1492. </tr><?php 
  1493.  
  1494. break; 
  1495.  
  1496. // Ajax Submit type 
  1497. case 'ajax_submit' : 
  1498. $button_name = $value['button_name']; 
  1499. $progressing_text = $value['progressing_text']; 
  1500. $completed_text = $value['completed_text']; 
  1501. $successed_text = $value['successed_text']; 
  1502. $submit_data = json_encode( $value['submit_data'] ); 
  1503.  
  1504. ?><tr valign="top"> 
  1505. <th scope="row" class="titledesc"><?php echo $tip; ?><?php echo esc_html( $value['name'] ) ?></th> 
  1506. <td class="forminp"> 
  1507.  
  1508. <div class="a3rev-ui-<?php echo sanitize_title( $value['type'] ) ?>-control"> 
  1509.  
  1510. <button 
  1511. name="<?php echo $name_attribute; ?>" 
  1512. id="<?php echo $id_attribute; ?>" 
  1513. data-submit_data="<?php echo esc_attr( $submit_data ); ?>" 
  1514. type="button" 
  1515. class="a3rev-ui-<?php echo sanitize_title( $value['type'] ) ?>-button <?php echo esc_attr( $value['class'] ); ?>" 
  1516. style="<?php echo esc_attr( $value['css'] ); ?>" 
  1517. <?php echo implode( ' ', $custom_attributes ); ?> 
  1518. ><?php echo $button_name; ?></button> 
  1519. <span class="a3rev-ui-<?php echo sanitize_title( $value['type'] ) ?>-successed"><?php echo $successed_text; ?></span> 
  1520. <span class="a3rev-ui-<?php echo sanitize_title( $value['type'] ) ?>-errors"></span> 
  1521.  
  1522. <!-- Progress Bar --> 
  1523. <div class="a3rev-ui-progress-bar-wrap"> 
  1524. <div class="a3rev-ui-progress-inner"></div> 
  1525. <div class="a3rev-ui-progressing-text"><?php echo $progressing_text; ?></div> 
  1526. <div class="a3rev-ui-completed-text"><?php echo $completed_text; ?></div> 
  1527. </div> 
  1528.  
  1529. </div> 
  1530. <?php echo $description; ?> 
  1531. </td> 
  1532. </tr><?php 
  1533.  
  1534. break; 
  1535.  
  1536. // Ajax Multi Submit type 
  1537. case 'ajax_multi_submit' : 
  1538. $resubmit = $value['resubmit']; 
  1539. $button_name = $value['button_name']; 
  1540. $progressing_text = $value['progressing_text']; 
  1541. $completed_text = $value['completed_text']; 
  1542. $successed_text = $value['successed_text']; 
  1543. $statistic_column = isset( $value['statistic_column'] ) ? $value['statistic_column'] : 1; 
  1544.  
  1545. $multi_current_items = 0; 
  1546. $multi_total_items = 0; 
  1547.  
  1548. $multi_submit = $value['multi_submit']; 
  1549. $multi_ajax = array(); 
  1550. if ( is_array( $multi_submit ) && count( $multi_submit ) > 0 ) { 
  1551. $number_ajax = 0; 
  1552. $old_item_id = ''; 
  1553. foreach ( $multi_submit as $single_submit ) { 
  1554. $multi_current_items += (int) $single_submit['current_items']; 
  1555. $multi_total_items += (int) $single_submit['total_items']; 
  1556.  
  1557. $single_submit['next_item_id'] = ''; 
  1558. $multi_ajax[$single_submit['item_id']] = $single_submit; 
  1559.  
  1560. if ( $number_ajax > 0 ) { 
  1561. $multi_ajax[$old_item_id]['next_item_id'] = $single_submit['item_id']; 
  1562. $old_item_id = $single_submit['item_id']; 
  1563.  
  1564. $number_ajax++; 
  1565. $multi_ajax = json_encode( $multi_ajax ); 
  1566.  
  1567. ?><tr valign="top"> 
  1568. <th scope="row" class="titledesc"><?php echo $tip; ?><?php echo esc_html( $value['name'] ) ?></th> 
  1569. <td class="forminp"> 
  1570.  
  1571. <div class="a3rev-ui-<?php echo sanitize_title( $value['type'] ) ?>-control"> 
  1572. <?php echo $description; ?> 
  1573. <button 
  1574. data-resubmit="<?php echo $resubmit ? 1 : 0 ; ?>" 
  1575. name="<?php echo $name_attribute; ?>" 
  1576. id="<?php echo $id_attribute; ?>" 
  1577. data-multi_ajax="<?php echo esc_attr( $multi_ajax ); ?>" 
  1578. type="button" 
  1579. class="a3rev-ui-<?php echo sanitize_title( $value['type'] ) ?>-button <?php echo esc_attr( $value['class'] ); ?>" 
  1580. style="<?php echo esc_attr( $value['css'] ); ?>" 
  1581. <?php echo implode( ' ', $custom_attributes ); ?> 
  1582. ><?php echo $button_name; ?></button> 
  1583. <span class="a3rev-ui-<?php echo sanitize_title( $value['type'] ) ?>-successed"><?php echo $successed_text; ?></span> 
  1584. <span class="a3rev-ui-<?php echo sanitize_title( $value['type'] ) ?>-errors"></span> 
  1585.  
  1586. <!-- Progress Bar --> 
  1587. <div class="a3rev-ui-progress-bar-wrap"> 
  1588. <div class="a3rev-ui-progress-inner" data-current="<?php echo $multi_current_items; ?>" data-total="<?php echo $multi_total_items; ?>" ></div> 
  1589. <div class="a3rev-ui-progressing-text"><?php echo $progressing_text; ?></div> 
  1590. <div class="a3rev-ui-completed-text"><?php echo $completed_text; ?></div> 
  1591. </div> 
  1592. <div style="clear: both;"></div> 
  1593.  
  1594. <!-- Status Object --> 
  1595. <div class="a3rev-ui-statistics-wrap"> 
  1596. <?php if ( $multi_total_items > 0 ) { 
  1597. $column_width = round( (100 / $statistic_column ), 2, PHP_ROUND_HALF_DOWN ); 
  1598. foreach ( $multi_submit as $single_submit ) { 
  1599.  
  1600. $current_items = (int) $single_submit['current_items']; 
  1601. $total_items = (int) $single_submit['total_items']; 
  1602.  
  1603. // Calculate deg value for cirlce 
  1604. $current_deg = 360; 
  1605. $left_deg = 360; 
  1606. $right_deg = 180; 
  1607. $pie_class = 'pie-more-50'; 
  1608. if ( $current_items < $total_items ) { 
  1609. $current_deg = round( ( $current_items / $total_items ) * 360 ); 
  1610. if ( $current_deg <= 180 ) { 
  1611. $left_deg = $right_deg = $current_deg; 
  1612. $pie_class = ''; 
  1613. } else { 
  1614. $right_deg = 180; 
  1615. $left_deg = $current_deg; 
  1616.  
  1617. $statistic_customizer = isset ( $single_submit['statistic_customizer'] ) ? $single_submit['statistic_customizer'] : false; 
  1618. if ( $statistic_customizer ) { 
  1619. $current_color = isset( $statistic_customizer['current_color'] ) ? $statistic_customizer['current_color'] : ''; 
  1620. ?> 
  1621. <div style="<?php echo ( isset( $single_submit['show_statistic'] ) && ! $single_submit['show_statistic'] ) ? 'display:none;' : ''; ?> width: <?php echo $column_width; ?>%;" class="a3rev-ui-statistic-item a3rev-ui-statistic-<?php echo esc_attr( $single_submit['item_id'] ); ?>"> 
  1622. <div class="a3rev-ui-pie-wrap"> 
  1623. <div class="a3rev-ui-pie <?php echo esc_attr( $pie_class); ?>"> 
  1624. <div class="a3rev-ui-pie-left-side a3rev-ui-pie-half-circle" style="transform: rotate(<?php echo $left_deg; ?>deg); <?php echo ( ! empty( $current_color ) ? 'border-color:' . $current_color : '' ); ?>"></div> 
  1625. <div class="a3rev-ui-pie-right-side a3rev-ui-pie-half-circle" style="transform: rotate(<?php echo $right_deg; ?>deg); <?php echo ( ! empty( $current_color ) ? 'border-color:' . $current_color : '' ); ?>"></div> 
  1626. </div> 
  1627. <div class="a3rev-ui-pie-shadow"></div> 
  1628. </div> 
  1629. <div class="a3rev-ui-statistic-text"> 
  1630. <span class="a3rev-ui-statistic-current-item" data-current="<?php echo $current_items; ?>" ><?php echo $current_items; ?></span> 
  1631. <span class="a3rev-ui-statistic-separate">/</span> 
  1632. <span class="a3rev-ui-statistic-total-item"><?php echo $total_items; ?></span> 
  1633. <br /> 
  1634. <span class="a3rev-ui-statistic-item-name"><?php echo $single_submit['item_name']; ?></span> 
  1635. </div> 
  1636. </div> 
  1637. <?php 
  1638. } ?> 
  1639. </div> 
  1640. <div style="clear: both;"></div> 
  1641. </div> 
  1642. </td> 
  1643. </tr><?php 
  1644.  
  1645. break; 
  1646.  
  1647. // Toggle Box Open type 
  1648. case 'onoff_toggle_box' : 
  1649.  
  1650. $option_value = $this->settings_get_option( $this->toggle_box_open_option, 0 ); 
  1651. if ( ! isset( $value['checked_label'] ) ) $value['checked_label'] = __( 'ON', 'woocommerce-predictive-search' ); 
  1652. if ( ! isset( $value['unchecked_label'] ) ) $value['unchecked_label'] = __( 'OFF', 'woocommerce-predictive-search' ); 
  1653.  
  1654. ?><tr valign="top"> 
  1655. <th scope="row" class="titledesc"> 
  1656. <?php echo $tip; ?> 
  1657. <label for="<?php echo $this->toggle_box_open_option; ?>"><?php echo __( 'Open Box Display', 'woocommerce-predictive-search' ); ?></label> 
  1658. </th> 
  1659. <td class="forminp forminp-onoff_checkbox forminp-<?php echo sanitize_title( $value['type'] ) ?>"> 
  1660. <input 
  1661. name="<?php echo $this->toggle_box_open_option; ?>" 
  1662. id="<?php echo $this->toggle_box_open_option; ?>" 
  1663. class="a3rev-ui-onoff_checkbox a3rev-ui-onoff_toggle_box <?php echo esc_attr( $value['class'] ); ?>" 
  1664. checked_label="<?php echo esc_html( $value['checked_label'] ); ?>" 
  1665. unchecked_label="<?php echo esc_html( $value['unchecked_label'] ); ?>" 
  1666. type="checkbox" 
  1667. value="1" 
  1668. <?php checked( $option_value, 1 ); ?> 
  1669. <?php echo implode( ' ', $custom_attributes ); ?> 
  1670. /> <span class="description" style="margin-left:5px;"><?php echo __( 'ON and each admin panel setting box OPEN | CLOSED position are saved each time changes are SAVED.', 'woocommerce-predictive-search' ); ?></span> 
  1671. </td> 
  1672. </tr><?php 
  1673. break; 
  1674.  
  1675. // Standard text inputs and subtypes like 'number' 
  1676. case 'text': 
  1677. case 'email': 
  1678. case 'number': 
  1679. case 'password' : 
  1680.  
  1681. $type = $value['type']; 
  1682.  
  1683. ?><tr valign="top"> 
  1684. <th scope="row" class="titledesc"> 
  1685. <?php echo $tip; ?> 
  1686. <label for="<?php echo $id_attribute; ?>"><?php echo esc_html( $value['name'] ); ?></label> 
  1687. </th> 
  1688. <td class="forminp forminp-<?php echo sanitize_title( $value['type'] ) ?>"> 
  1689. <input 
  1690. name="<?php echo $name_attribute; ?>" 
  1691. id="<?php echo $id_attribute; ?>" 
  1692. type="<?php echo esc_attr( $type ); ?>" 
  1693. style="<?php echo esc_attr( $value['css'] ); ?>" 
  1694. value="<?php echo esc_attr( $option_value ); ?>" 
  1695. class="a3rev-ui-<?php echo sanitize_title( $value['type'] ) ?> <?php echo esc_attr( $value['class'] ); ?>" 
  1696. placeholder="<?php echo esc_attr( $value['placeholder'] ); ?>" 
  1697. <?php echo implode( ' ', $custom_attributes ); ?> 
  1698. /> <?php echo $description; ?> 
  1699. </td> 
  1700. </tr><?php 
  1701. break; 
  1702.  
  1703. // Color 
  1704. case 'color' : 
  1705.  
  1706. if ( trim( $value['default'] ) == '' ) $value['default'] = '#515151'; 
  1707. $default_color = ' data-default-color="' . esc_attr( $value['default'] ) . '"'; 
  1708. if ( '' == trim( $option_value ) ) $option_value = 'transparent'; 
  1709.  
  1710. ?><tr valign="top"> 
  1711. <th scope="row" class="titledesc"> 
  1712. <?php echo $tip; ?> 
  1713. <label for="<?php echo $id_attribute; ?>"><?php echo esc_html( $value['name'] ); ?></label> 
  1714. </th> 
  1715. <td class="forminp forminp-<?php echo sanitize_title( $value['type'] ) ?>"> 
  1716. <input 
  1717. name="<?php echo $name_attribute; ?>" 
  1718. id="<?php echo $id_attribute; ?>" 
  1719. type="text" 
  1720. value="<?php echo esc_attr( $option_value ); ?>" 
  1721. class="a3rev-color-picker" 
  1722. <?php echo $default_color; ?> 
  1723. /> <?php echo $description; ?> 
  1724. </td> 
  1725. </tr><?php 
  1726.  
  1727. break; 
  1728.  
  1729. // Background Color 
  1730. case 'bg_color' : 
  1731.  
  1732. if ( ! isset( $option_value['enable'] ) ) $option_value['enable'] = 0; 
  1733. $enable = $option_value['enable']; 
  1734.  
  1735. if ( trim( $value['default']['color'] ) == '' ) $value['default']['color'] = '#515151'; 
  1736. $default_color = ' data-default-color="' . esc_attr( $value['default']['color'] ) . '"'; 
  1737.  
  1738. $color = $option_value['color']; 
  1739. if ( '' == trim( $color ) ) $color = 'transparent'; 
  1740.  
  1741. ?><tr valign="top"> 
  1742. <th scope="row" class="titledesc"> 
  1743. <?php echo $tip; ?> 
  1744. <label for="<?php echo $id_attribute; ?>"><?php echo esc_html( $value['name'] ); ?></label> 
  1745. </th> 
  1746. <td class="forminp forminp-<?php echo sanitize_title( $value['type'] ) ?>"> 
  1747. <input 
  1748. name="<?php echo $name_attribute; ?>[enable]" 
  1749. id="<?php echo $id_attribute; ?>" 
  1750. class="a3rev-ui-bg_color-enable a3rev-ui-onoff_checkbox <?php echo esc_attr( $value['class'] ); ?>" 
  1751. checked_label="<?php _e( 'ON', 'woocommerce-predictive-search' ); ?>" 
  1752. unchecked_label="<?php _e( 'OFF', 'woocommerce-predictive-search' ); ?>" 
  1753. type="checkbox" 
  1754. value="1" 
  1755. <?php checked( 1, $enable ); ?> 
  1756. <?php echo implode( ' ', $custom_attributes ); ?> 
  1757. /> <?php echo $description; ?> 
  1758. <div style="clear:both;"></div> 
  1759. <div class="a3rev-ui-bg_color-enable-container"> 
  1760. <input 
  1761. name="<?php echo $name_attribute; ?>[color]" 
  1762. id="<?php echo $id_attribute; ?>-color" 
  1763. type="text" 
  1764. value="<?php echo esc_attr( $color ); ?>" 
  1765. class="a3rev-color-picker" 
  1766. <?php echo $default_color; ?> 
  1767. /> 
  1768. </div> 
  1769. </td> 
  1770. </tr><?php 
  1771.  
  1772. break; 
  1773.  
  1774. // Textarea 
  1775. case 'textarea': 
  1776.  
  1777. ?><tr valign="top"> 
  1778. <th scope="row" class="titledesc"> 
  1779. <?php echo $tip; ?> 
  1780. <label for="<?php echo $id_attribute; ?>"><?php echo esc_html( $value['name'] ); ?></label> 
  1781. </th> 
  1782. <td class="forminp forminp-<?php echo sanitize_title( $value['type'] ) ?>"> 
  1783. <?php echo $description; ?> 
  1784.  
  1785. <textarea 
  1786. name="<?php echo $name_attribute; ?>" 
  1787. id="<?php echo $id_attribute; ?>" 
  1788. style="<?php echo esc_attr( $value['css'] ); ?>" 
  1789. class="a3rev-ui-<?php echo sanitize_title( $value['type'] ) ?> <?php echo esc_attr( $value['class'] ); ?>" 
  1790. placeholder="<?php echo esc_attr( $value['placeholder'] ); ?>" 
  1791. <?php echo implode( ' ', $custom_attributes ); ?> 
  1792. ><?php echo esc_textarea( $option_value ); ?></textarea> 
  1793. </td> 
  1794. </tr><?php 
  1795. break; 
  1796.  
  1797. // Select boxes 
  1798. case 'select' : 
  1799. case 'multiselect' : 
  1800.  
  1801. if ( trim( $value['class'] ) == '' ) $value['class'] = 'chzn-select'; 
  1802. if ( is_rtl() ) { 
  1803. $value['class'] .= ' chzn-rtl'; 
  1804. if ( ! isset( $value['options'] ) ) $value['options'] = array(); 
  1805.  
  1806. ?><tr valign="top"> 
  1807. <th scope="row" class="titledesc"> 
  1808. <?php echo $tip; ?> 
  1809. <label for="<?php echo $id_attribute; ?>"><?php echo esc_html( $value['name'] ); ?></label> 
  1810. </th> 
  1811. <td class="forminp forminp-<?php echo sanitize_title( $value['type'] ) ?>"> 
  1812. <select 
  1813. name="<?php echo $name_attribute; ?><?php if ( $value['type'] == 'multiselect' ) echo '[]'; ?>" 
  1814. id="<?php echo $id_attribute; ?>" 
  1815. style="<?php echo esc_attr( $value['css'] ); ?>" 
  1816. class="a3rev-ui-<?php echo sanitize_title( $value['type'] ) ?> <?php echo esc_attr( $value['class'] ); ?>" 
  1817. data-placeholder="<?php echo esc_html( $value['placeholder'] ); ?>" 
  1818. <?php echo implode( ' ', $custom_attributes ); ?> 
  1819. <?php if ( $value['type'] == 'multiselect' ) echo 'multiple="multiple"'; ?> 
  1820. <?php 
  1821. if ( is_array( $value['options'] ) && count( $value['options'] ) > 0 ) { 
  1822. foreach ( $value['options'] as $key => $val ) { 
  1823. if ( is_array( $val ) ) { 
  1824. ?> 
  1825. <optgroup label="<?php echo esc_attr( $key ); ?>"> 
  1826. <?php 
  1827. foreach ( $val as $sub_key => $sub_val ) { 
  1828. ?> 
  1829. <option value="<?php echo esc_attr( $sub_key ); ?>" <?php 
  1830.  
  1831. if ( is_array( $option_value ) ) 
  1832. selected( in_array( $sub_key, $option_value ), true ); 
  1833. else 
  1834. selected( $option_value, $sub_key ); 
  1835.  
  1836. ?>><?php echo $sub_val ?></option> 
  1837. <?php 
  1838. ?> 
  1839. </optgroup> 
  1840. <?php 
  1841. } else { 
  1842. ?> 
  1843. <option value="<?php echo esc_attr( $key ); ?>" <?php 
  1844.  
  1845. if ( is_array( $option_value ) ) 
  1846. selected( in_array( $key, $option_value ), true ); 
  1847. else 
  1848. selected( $option_value, $key ); 
  1849.  
  1850. ?>><?php echo $val ?></option> 
  1851. <?php 
  1852. ?> 
  1853. </select> <?php echo $description; ?> 
  1854. </td> 
  1855. </tr><?php 
  1856. break; 
  1857.  
  1858. // Radio inputs 
  1859. case 'radio' : 
  1860.  
  1861. if ( ! isset( $value['options'] ) ) $value['options'] = array(); 
  1862.  
  1863. ?><tr valign="top"> 
  1864. <th scope="row" class="titledesc"> 
  1865. <?php echo $tip; ?> 
  1866. <label for="<?php echo $id_attribute; ?>"><?php echo esc_html( $value['name'] ); ?></label> 
  1867. </th> 
  1868. <td class="forminp forminp-<?php echo sanitize_title( $value['type'] ) ?>"> 
  1869. <fieldset> 
  1870. <?php echo $description; ?> 
  1871. <ul> 
  1872. <?php 
  1873. if ( is_array( $value['options'] ) && count( $value['options'] ) > 0 ) { 
  1874. foreach ( $value['options'] as $val => $text ) { 
  1875. ?> 
  1876. <li> 
  1877. <label><input 
  1878. name="<?php echo $name_attribute; ?>" 
  1879. value="<?php echo $val; ?>" 
  1880. type="radio" 
  1881. style="<?php echo esc_attr( $value['css'] ); ?>" 
  1882. class="a3rev-ui-<?php echo sanitize_title( $value['type'] ) ?> <?php echo esc_attr( $value['class'] ); ?>" 
  1883. <?php echo implode( ' ', $custom_attributes ); ?> 
  1884. <?php checked( $val, $option_value ); ?> 
  1885. /> <span class="description" style="margin-left:5px;"><?php echo $text ?></span></label> 
  1886. </li> 
  1887. <?php 
  1888. ?> 
  1889. </ul> 
  1890. </fieldset> 
  1891. </td> 
  1892. </tr><?php 
  1893. break; 
  1894.  
  1895. // OnOff Radio inputs 
  1896. case 'onoff_radio' : 
  1897.  
  1898. if ( ! isset( $value['onoff_options'] ) ) $value['onoff_options'] = array(); 
  1899.  
  1900. ?><tr valign="top"> 
  1901. <th scope="row" class="titledesc"> 
  1902. <?php echo $tip; ?> 
  1903. <label for="<?php echo $id_attribute; ?>"><?php echo esc_html( $value['name'] ); ?></label> 
  1904. </th> 
  1905. <td class="forminp forminp-<?php echo sanitize_title( $value['type'] ) ?>"> 
  1906. <fieldset> 
  1907. <?php echo $description; ?> 
  1908. <ul> 
  1909. <?php 
  1910. if ( is_array( $value['onoff_options'] ) && count( $value['onoff_options'] ) > 0 ) { 
  1911. foreach ( $value['onoff_options'] as $i_option ) { 
  1912. if ( ! isset( $i_option['checked_label'] ) ) $i_option['checked_label'] = __( 'ON', 'woocommerce-predictive-search' ); 
  1913. if ( ! isset( $i_option['unchecked_label'] ) ) $i_option['unchecked_label'] = __( 'OFF', 'woocommerce-predictive-search' ); 
  1914. if ( ! isset( $i_option['val'] ) ) $i_option['val'] = 1; 
  1915. if ( ! isset( $i_option['text'] ) ) $i_option['text'] = ''; 
  1916. ?> 
  1917. <li> 
  1918. <input 
  1919. name="<?php echo $name_attribute; ?>" 
  1920. <?php if ( $i_option['val'] == $option_value ) echo ' checkbox-disabled="true" ' ; ?> 
  1921. class="a3rev-ui-onoff_radio <?php echo esc_attr( $value['class'] ); ?>" 
  1922. checked_label="<?php echo esc_html( $i_option['checked_label'] ); ?>" 
  1923. unchecked_label="<?php echo esc_html( $i_option['unchecked_label'] ); ?>" 
  1924. type="radio" 
  1925. value="<?php echo esc_attr( stripslashes( $i_option['val'] ) ); ?>" 
  1926. <?php checked( esc_attr( stripslashes( $i_option['val'] ) ), $option_value ); ?> 
  1927. <?php echo implode( ' ', $custom_attributes ); ?> 
  1928. /> <span class="description" style="margin-left:5px;"><?php echo $i_option['text'] ?></span> 
  1929. </li> 
  1930. <?php 
  1931. ?> 
  1932. </ul> 
  1933. </fieldset> 
  1934. </td> 
  1935. </tr><?php 
  1936. break; 
  1937.  
  1938. // Checkbox input 
  1939. case 'checkbox' : 
  1940.  
  1941. if ( ! isset( $value['checked_value'] ) ) $value['checked_value'] = 1; 
  1942. if ( ! isset( $value['hide_if_checked'] ) ) $value['hide_if_checked'] = false; 
  1943. if ( ! isset( $value['show_if_checked'] ) ) $value['show_if_checked'] = false; 
  1944.  
  1945. if ( ! isset( $value['checkboxgroup'] ) || ( isset( $value['checkboxgroup'] ) && $value['checkboxgroup'] == 'start' ) ) { 
  1946. ?> 
  1947. <tr valign="top" class="<?php 
  1948. if ( $value['hide_if_checked'] == 'yes' || $value['show_if_checked']=='yes') echo 'hidden_option'; 
  1949. if ( $value['hide_if_checked'] == 'option' ) echo 'hide_options_if_checked'; 
  1950. if ( $value['show_if_checked'] == 'option' ) echo 'show_options_if_checked'; 
  1951. ?>"> 
  1952. <th scope="row" class="titledesc"> 
  1953. <label for="<?php echo $id_attribute; ?>"><?php echo esc_html( $value['name'] ); ?></label> 
  1954. </th> 
  1955. <td class="forminp forminp-checkbox"> 
  1956. <fieldset> 
  1957. <?php 
  1958. } else { 
  1959. ?> 
  1960. <fieldset class="<?php 
  1961. if ( $value['hide_if_checked'] == 'yes' || $value['show_if_checked'] == 'yes') echo 'hidden_option'; 
  1962. if ( $value['hide_if_checked'] == 'option') echo 'hide_options_if_checked'; 
  1963. if ( $value['show_if_checked'] == 'option') echo 'show_options_if_checked'; 
  1964. ?>"> 
  1965. <?php 
  1966.  
  1967. ?> 
  1968. <legend class="screen-reader-text"><span><?php echo esc_html( $value['name'] ) ?></span></legend> 
  1969.  
  1970. <label for="<?php echo $id_attribute; ?>"> 
  1971. <input 
  1972. name="<?php echo $name_attribute; ?>" 
  1973. id="<?php echo $id_attribute; ?>" 
  1974. type="checkbox" 
  1975. value="<?php echo esc_attr( stripslashes( $value['checked_value'] ) ); ?>" 
  1976. <?php checked( $option_value, esc_attr( stripslashes( $value['checked_value'] ) ) ); ?> 
  1977. <?php echo implode( ' ', $custom_attributes ); ?> 
  1978. /> <?php echo $description; ?></label> <?php echo $tip; ?> 
  1979. <?php 
  1980.  
  1981. if ( ! isset( $value['checkboxgroup'] ) || ( isset( $value['checkboxgroup'] ) && $value['checkboxgroup'] == 'end' ) ) { 
  1982. ?> 
  1983. </fieldset> 
  1984. </td> 
  1985. </tr> 
  1986. <?php 
  1987. } else { 
  1988. ?> 
  1989. </fieldset> 
  1990. <?php 
  1991.  
  1992. break; 
  1993.  
  1994. // OnOff Checkbox input 
  1995. case 'onoff_checkbox' : 
  1996.  
  1997. if ( ! isset( $value['checked_value'] ) ) $value['checked_value'] = 1; 
  1998. if ( ! isset( $value['checked_label'] ) ) $value['checked_label'] = __( 'ON', 'woocommerce-predictive-search' ); 
  1999. if ( ! isset( $value['unchecked_label'] ) ) $value['unchecked_label'] = __( 'OFF', 'woocommerce-predictive-search' ); 
  2000.  
  2001. ?><tr valign="top"> 
  2002. <th scope="row" class="titledesc"> 
  2003. <?php echo $tip; ?> 
  2004. <label for="<?php echo $id_attribute; ?>"><?php echo esc_html( $value['name'] ); ?></label> 
  2005. </th> 
  2006. <td class="forminp forminp-<?php echo sanitize_title( $value['type'] ) ?>"> 
  2007. <input 
  2008. name="<?php echo $name_attribute; ?>" 
  2009. id="<?php echo $id_attribute; ?>" 
  2010. class="a3rev-ui-onoff_checkbox <?php echo esc_attr( $value['class'] ); ?>" 
  2011. checked_label="<?php echo esc_html( $value['checked_label'] ); ?>" 
  2012. unchecked_label="<?php echo esc_html( $value['unchecked_label'] ); ?>" 
  2013. type="checkbox" 
  2014. value="<?php echo esc_attr( stripslashes( $value['checked_value'] ) ); ?>" 
  2015. <?php checked( $option_value, esc_attr( stripslashes( $value['checked_value'] ) ) ); ?> 
  2016. <?php echo implode( ' ', $custom_attributes ); ?> 
  2017. /> <?php echo $description; ?> 
  2018. </td> 
  2019. </tr><?php 
  2020.  
  2021. break; 
  2022.  
  2023. // Switcher Checkbox input 
  2024. case 'switcher_checkbox' : 
  2025.  
  2026. if ( ! isset( $value['checked_value'] ) ) $value['checked_value'] = 1; 
  2027. if ( ! isset( $value['checked_label'] ) ) $value['checked_label'] = __( 'ON', 'woocommerce-predictive-search' ); 
  2028. if ( ! isset( $value['unchecked_label'] ) ) $value['unchecked_label'] = __( 'OFF', 'woocommerce-predictive-search' ); 
  2029.  
  2030. ?><tr valign="top"> 
  2031. <th scope="row" class="titledesc"> 
  2032. <?php echo $tip; ?> 
  2033. <label for="<?php echo $id_attribute; ?>"><?php echo esc_html( $value['name'] ); ?></label> 
  2034. </th> 
  2035. <td class="forminp forminp-<?php echo sanitize_title( $value['type'] ) ?>"> 
  2036. <input 
  2037. name="<?php echo $name_attribute; ?>" 
  2038. id="<?php echo $id_attribute; ?>" 
  2039. class="a3rev-ui-onoff_checkbox <?php echo esc_attr( $value['class'] ); ?>" 
  2040. checked_label="<?php echo esc_html( $value['checked_label'] ); ?>" 
  2041. unchecked_label="<?php echo esc_html( $value['unchecked_label'] ); ?>" 
  2042. type="checkbox" 
  2043. value="<?php echo esc_attr( stripslashes( $value['checked_value'] ) ); ?>" 
  2044. <?php checked( $option_value, esc_attr( stripslashes( $value['checked_value'] ) ) ); ?> 
  2045. <?php echo implode( ' ', $custom_attributes ); ?> 
  2046. /> <?php echo $description; ?> 
  2047. </td> 
  2048. </tr><?php 
  2049.  
  2050. break; 
  2051.  
  2052. // Image size settings 
  2053. case 'image_size' : 
  2054.  
  2055. $width = $option_value['width']; 
  2056. $height = $option_value['height']; 
  2057. $crop = checked( 1, $option_value['crop'], false ); 
  2058.  
  2059. ?><tr valign="top"> 
  2060. <th scope="row" class="titledesc"><?php echo $tip; ?><?php echo esc_html( $value['name'] ) ?></th> 
  2061. <td class="forminp forminp-<?php echo sanitize_title( $value['type'] ) ?>"> 
  2062.  
  2063. <label><?php _e( 'Width', 'woocommerce-predictive-search' ); ?> <input name="<?php echo $name_attribute; ?>[width]" id="<?php echo $id_attribute; ?>-width" type="text" class="a3rev-ui-<?php echo sanitize_title( $value['type'] ) ?>-width" value="<?php echo $width; ?>" /></label> 
  2064.  
  2065. <label><?php _e( 'Height', 'woocommerce-predictive-search' ); ?> <input name="<?php echo $name_attribute; ?>[height]" id="<?php echo $id_attribute; ?>-height" type="text" class="a3rev-ui-<?php echo sanitize_title( $value['type'] ) ?>-height" value="<?php echo $height; ?>" /></label> 
  2066.  
  2067. <label><?php _e( 'Hard Crop', 'woocommerce-predictive-search' ); ?> <input name="<?php echo $name_attribute; ?>[crop]" id="<?php echo $id_attribute; ?>-crop" type="checkbox" class="a3rev-ui-<?php echo sanitize_title( $value['type'] ) ?>-crop" <?php echo $crop; ?> /></label> 
  2068.  
  2069. </td> 
  2070. </tr><?php 
  2071. break; 
  2072.  
  2073. // Single page selects 
  2074. case 'single_select_page' : 
  2075.  
  2076. if ( trim( $value['class'] ) == '' ) $value['class'] = 'chzn-select-deselect'; 
  2077. if ( is_rtl() ) { 
  2078. $value['class'] .= ' chzn-rtl'; 
  2079.  
  2080. $args = array( 'name' => $name_attribute,  
  2081. 'id' => $id_attribute,  
  2082. 'sort_column' => 'menu_order',  
  2083. 'sort_order' => 'ASC',  
  2084. 'show_option_none' => ' ',  
  2085. 'class' => 'a3rev-ui-' . sanitize_title( $value['type'] ) . ' ' . $value['class'],  
  2086. 'echo' => false,  
  2087. 'selected' => absint( $option_value ) 
  2088. ); 
  2089.  
  2090. if( isset( $value['args'] ) ) 
  2091. $args = wp_parse_args( $value['args'], $args ); 
  2092.  
  2093. ?><tr valign="top"> 
  2094. <th scope="row" class="titledesc"><?php echo $tip; ?><?php echo esc_html( $value['name'] ) ?></th> 
  2095. <td class="forminp"> 
  2096. <?php echo str_replace(' id=', " data-placeholder='" . esc_html( $value['placeholder'] ) . "' style='" . $value['css'] . "' class='" . $value['class'] . "' id=", wp_dropdown_pages( $args ) ); ?> <?php echo $description; ?> 
  2097. </td> 
  2098. </tr><?php 
  2099. break; 
  2100.  
  2101. // Font Control 
  2102. case 'typography': 
  2103.  
  2104. $default_color = ' data-default-color="' . esc_attr( $value['default']['color'] ) . '"'; 
  2105.  
  2106. if ( ! isset( $option_value['line_height'] ) ) { 
  2107. $option_value['line_height'] = '1.4em'; 
  2108.  
  2109. $size = $option_value['size']; 
  2110. $line_height = $option_value['line_height']; 
  2111. $face = $option_value['face']; 
  2112. $style = $option_value['style']; 
  2113. $color = $option_value['color']; 
  2114.  
  2115. ?><tr valign="top"> 
  2116. <th scope="row" class="titledesc"><?php echo $tip; ?><?php echo esc_html( $value['name'] ) ?></th> 
  2117. <td class="forminp"> 
  2118. <?php echo $description; ?> 
  2119. <div class="a3rev-ui-<?php echo sanitize_title( $value['type'] ) ?>-control"> 
  2120. <!-- Font Size --> 
  2121. <select 
  2122. name="<?php echo $name_attribute; ?>[size]" 
  2123. id="<?php echo $id_attribute; ?>-size" 
  2124. class="a3rev-ui-<?php echo sanitize_title( $value['type'] ) ?>-size chzn-select <?php if ( is_rtl() ) { echo 'chzn-rtl'; } ?>" 
  2125. <?php 
  2126. for ( $i = 6; $i <= 70; $i++ ) { 
  2127. ?> 
  2128. <option value="<?php echo esc_attr( $i ); ?>px" <?php 
  2129. selected( $size, $i.'px' ); 
  2130. ?>><?php echo esc_attr( $i ); ?>px</option> 
  2131. <?php 
  2132. ?> 
  2133. </select> 
  2134. <!-- Line Height --> 
  2135. <select 
  2136. name="<?php echo $name_attribute; ?>[line_height]" 
  2137. id="<?php echo $id_attribute; ?>-line_height" 
  2138. class="a3rev-ui-<?php echo sanitize_title( $value['type'] ) ?>-line_height chzn-select <?php if ( is_rtl() ) { echo 'chzn-rtl'; } ?>" 
  2139. <?php 
  2140. for ( $i = 0.6; $i <= 3.1; $i = $i + 0.1 ) { 
  2141. ?> 
  2142. <option value="<?php echo esc_attr( $i ); ?>em" <?php 
  2143. selected( $line_height, $i.'em' ); 
  2144. ?>><?php echo esc_attr( $i ); ?>em</option> 
  2145. <?php 
  2146. ?> 
  2147. </select> 
  2148. <!-- Font Face --> 
  2149. <select 
  2150. name="<?php echo $name_attribute; ?>[face]" 
  2151. id="<?php echo $id_attribute; ?>-face" 
  2152. class="a3rev-ui-<?php echo sanitize_title( $value['type'] ) ?>-face chzn-select <?php if ( is_rtl() ) { echo 'chzn-rtl'; } ?>" 
  2153. <optgroup label="<?php _e( '-- Default Fonts --', 'woocommerce-predictive-search' ); ?>"> 
  2154. <?php 
  2155. foreach ( $wc_predictive_search_fonts_face->get_default_fonts() as $val => $text ) { 
  2156. ?> 
  2157. <option value="<?php echo esc_attr( $val ); ?>" <?php 
  2158. selected( esc_attr( $val ), esc_attr( $face ) ); 
  2159. ?>><?php echo esc_attr( $text ); ?></option> 
  2160. <?php 
  2161. ?> 
  2162. </optgroup> 
  2163. <optgroup label="<?php _e( '-- Google Fonts --', 'woocommerce-predictive-search' ); ?>"> 
  2164. <?php 
  2165. foreach ( $wc_predictive_search_fonts_face->get_google_fonts() as $font ) { 
  2166. ?> 
  2167. <option value="<?php echo esc_attr( $font['name'] ); ?>" <?php 
  2168. selected( esc_attr( $font['name'] ), esc_attr( $face ) ); 
  2169. ?>><?php echo esc_attr( $font['name'] ); ?></option> 
  2170. <?php 
  2171. ?> 
  2172. </optgroup> 
  2173. </select>  
  2174.  
  2175. <!-- Font Weight --> 
  2176. <select 
  2177. name="<?php echo $name_attribute; ?>[style]" 
  2178. id="<?php echo $id_attribute; ?>-style" 
  2179. class="a3rev-ui-<?php echo sanitize_title( $value['type'] ) ?>-style chzn-select <?php if ( is_rtl() ) { echo 'chzn-rtl'; } ?>" 
  2180. <?php 
  2181. foreach ( $this->get_font_weights() as $val => $text ) { 
  2182. ?> 
  2183. <option value="<?php echo esc_attr( $val ); ?>" <?php 
  2184. selected( esc_attr( $val ), esc_attr( $style ) ); 
  2185. ?>><?php echo esc_attr( $text ); ?></option> 
  2186. <?php 
  2187. ?> 
  2188. </select> 
  2189.  
  2190. <!-- Font Color --> 
  2191. <input 
  2192. name="<?php echo $name_attribute; ?>[color]" 
  2193. id="<?php echo $id_attribute; ?>-color" 
  2194. type="text" 
  2195. value="<?php echo esc_attr( $color ); ?>" 
  2196. class="a3rev-ui-<?php echo sanitize_title( $value['type'] ) ?>-color a3rev-color-picker" 
  2197. <?php echo $default_color; ?> 
  2198. />  
  2199.  
  2200. <!-- Preview Button --> 
  2201. <div class="a3rev-ui-typography-preview"><a href="#" class="a3rev-ui-typography-preview-button button submit-button" title="<?php _e( 'Preview your customized typography settings', 'woocommerce-predictive-search' ); ?>"><span> </span></a></div> 
  2202.  
  2203. </div> 
  2204.  
  2205. </td> 
  2206. </tr><?php 
  2207.  
  2208. break; 
  2209.  
  2210. // Border Styles & Corner Control 
  2211. case 'border': 
  2212.  
  2213. if ( ! is_array( $value['default'] ) ) $value['default'] = array(); 
  2214.  
  2215. // For Border Styles 
  2216. $default_color = ' data-default-color="' . esc_attr( $value['default']['color'] ) . '"'; 
  2217.  
  2218. $width = $option_value['width']; 
  2219. $style = $option_value['style']; 
  2220. $color = $option_value['color']; 
  2221.  
  2222. // For Border Corner 
  2223. if ( ! isset( $value['min'] ) ) $value['min'] = 0; 
  2224. if ( ! isset( $value['max'] ) ) $value['max'] = 100; 
  2225. if ( ! isset( $value['increment'] ) ) $value['increment'] = 1; 
  2226.  
  2227. if ( ! isset( $option_value['corner'] ) ) $option_value['corner'] = ''; 
  2228. $corner = $option_value['corner']; 
  2229.  
  2230. if ( ! isset( $option_value['rounded_value'] ) ) $option_value['rounded_value'] = 3; 
  2231. $rounded_value = $option_value['rounded_value']; 
  2232.  
  2233. if ( ! isset( $option_value['top_left_corner'] ) ) $option_value['top_left_corner'] = 3; 
  2234. $top_left_corner = $option_value['top_left_corner']; 
  2235.  
  2236. if ( ! isset( $option_value['top_right_corner'] ) ) $option_value['top_right_corner'] = 3; 
  2237. $top_right_corner = $option_value['top_right_corner']; 
  2238.  
  2239. if ( ! isset( $option_value['bottom_left_corner'] ) ) $option_value['bottom_left_corner'] = 3; 
  2240. $bottom_left_corner = $option_value['bottom_left_corner']; 
  2241.  
  2242. if ( ! isset( $option_value['bottom_right_corner'] ) ) $option_value['bottom_right_corner'] = 3; 
  2243. $bottom_right_corner = $option_value['bottom_right_corner']; 
  2244.  
  2245. if ( trim( $rounded_value ) == '' || trim( $rounded_value ) <= 0 ) $rounded_value = $value['min']; 
  2246. $rounded_value = intval( $rounded_value ); 
  2247.  
  2248. if ( trim( $top_left_corner ) == '' || trim( $top_left_corner ) <= 0 ) $top_left_corner = $rounded_value; 
  2249. $top_left_corner = intval( $top_left_corner ); 
  2250.  
  2251. if ( trim( $top_right_corner ) == '' || trim( $top_right_corner ) <= 0 ) $top_right_corner = $rounded_value; 
  2252. $top_right_corner = intval( $top_right_corner ); 
  2253.  
  2254. if ( trim( $bottom_left_corner ) == '' || trim( $bottom_left_corner ) <= 0 ) $bottom_left_corner = $rounded_value; 
  2255. $bottom_left_corner = intval( $bottom_left_corner ); 
  2256.  
  2257. if ( trim( $bottom_right_corner ) == '' || trim( $bottom_right_corner ) <= 0 ) $bottom_right_corner = $rounded_value; 
  2258. $bottom_right_corner = intval( $bottom_right_corner ); 
  2259.  
  2260. ?><tr valign="top"> 
  2261. <th scope="row" class="titledesc"><?php echo $tip; ?><?php echo esc_html( $value['name'] ) ?></th> 
  2262. <td class="forminp forminp-border_corner"> 
  2263. <?php echo $description; ?> 
  2264. <div class="a3rev-ui-settings-control"> 
  2265. <!-- Border Width --> 
  2266. <select 
  2267. name="<?php echo $name_attribute; ?>[width]" 
  2268. id="<?php echo $id_attribute; ?>-width" 
  2269. class="a3rev-ui-border_styles-width chzn-select <?php if ( is_rtl() ) { echo 'chzn-rtl'; } ?>" 
  2270. <?php 
  2271. for ( $i = 0; $i <= 20; $i++ ) { 
  2272. ?> 
  2273. <option value="<?php echo esc_attr( $i ); ?>px" <?php 
  2274. selected( $width, $i.'px' ); 
  2275. ?>><?php echo esc_attr( $i ); ?>px</option> 
  2276. <?php 
  2277. ?> 
  2278. </select>  
  2279.  
  2280. <!-- Border Style --> 
  2281. <select 
  2282. name="<?php echo $name_attribute; ?>[style]" 
  2283. id="<?php echo $id_attribute; ?>-style" 
  2284. class="a3rev-ui-border_styles-style chzn-select <?php if ( is_rtl() ) { echo 'chzn-rtl'; } ?>" 
  2285. <?php 
  2286. foreach ( $this->get_border_styles() as $val => $text ) { 
  2287. ?> 
  2288. <option value="<?php echo esc_attr( $val ); ?>" <?php 
  2289. selected( esc_attr( $val ), esc_attr( $style ) ); 
  2290. ?>><?php echo esc_attr( $text ); ?></option> 
  2291. <?php 
  2292. ?> 
  2293. </select> 
  2294.  
  2295. <!-- Border Color --> 
  2296. <input 
  2297. name="<?php echo $name_attribute; ?>[color]" 
  2298. id="<?php echo $id_attribute; ?>-color" 
  2299. type="text" 
  2300. value="<?php echo esc_attr( $color ); ?>" 
  2301. class="a3rev-ui-border_styles-color a3rev-color-picker" 
  2302. <?php echo $default_color; ?> 
  2303. /> 
  2304.  
  2305. <!-- Preview Button --> 
  2306. <div class="a3rev-ui-settings-preview"><a href="#" class="a3rev-ui-border-preview-button a3rev-ui-settings-preview-button button submit-button" title="<?php _e( 'Preview your customized border settings', 'woocommerce-predictive-search' ); ?>"><span> </span></a></div> 
  2307. <span class="description" style="margin-left:5px;"><?php echo __( '0px = No Border', 'woocommerce-predictive-search' ); ?></span> 
  2308. <div style="clear:both; margin-bottom:10px"></div> 
  2309.  
  2310. <!-- Border Corner : Rounded or Square --> 
  2311. <input 
  2312. name="<?php echo $name_attribute; ?>[corner]" 
  2313. id="<?php echo $id_attribute; ?>" 
  2314. class="a3rev-ui-border-corner a3rev-ui-onoff_checkbox <?php echo esc_attr( $value['class'] ); ?>" 
  2315. checked_label="<?php _e( 'Rounded', 'woocommerce-predictive-search' ); ?>" 
  2316. unchecked_label="<?php _e( 'Square', 'woocommerce-predictive-search' ); ?>" 
  2317. type="checkbox" 
  2318. value="rounded" 
  2319. <?php checked( 'rounded', $corner ); ?> 
  2320. <?php echo implode( ' ', $custom_attributes ); ?> 
  2321. />  
  2322.  
  2323. <!-- Border Rounded Value --> 
  2324. <div class="a3rev-ui-border-corner-value-container"> 
  2325. <div class="a3rev-ui-border_corner-top_left"> 
  2326. <span class="a3rev-ui-border_corner-span"><?php _e( 'Top Left Corner', 'woocommerce-predictive-search' ); ?></span> 
  2327. <div class="a3rev-ui-slide-container"> 
  2328. <div class="a3rev-ui-slide-container-start"> 
  2329. <div class="a3rev-ui-slide-container-end"> 
  2330. <div class="a3rev-ui-slide" id="<?php echo $id_attribute; ?>-top_left_corner_div" min="<?php echo esc_attr( $value['min'] ); ?>" max="<?php echo esc_attr( $value['max'] ); ?>" inc="<?php echo esc_attr( $value['increment'] ); ?>"></div> 
  2331. </div> 
  2332. </div> 
  2333. <div class="a3rev-ui-slide-result-container"> 
  2334. <input 
  2335. readonly="readonly" 
  2336. name="<?php echo $name_attribute; ?>[top_left_corner]" 
  2337. id="<?php echo $id_attribute; ?>-top_left_corner" 
  2338. type="text" 
  2339. value="<?php echo esc_attr( $top_left_corner ); ?>" 
  2340. class="a3rev-ui-border_top_left_corner a3rev-ui-slider" 
  2341. /> <span class="a3rev-ui-border_corner-px">px</span> 
  2342. </div> 
  2343. </div> 
  2344. </div> 
  2345. <div class="a3rev-ui-border_corner-top_right"> 
  2346. <span class="a3rev-ui-border_corner-span"><?php _e( 'Top Right Corner', 'woocommerce-predictive-search' ); ?></span>  
  2347. <div class="a3rev-ui-slide-container"> 
  2348. <div class="a3rev-ui-slide-container-start"> 
  2349. <div class="a3rev-ui-slide-container-end"> 
  2350. <div class="a3rev-ui-slide" id="<?php echo $id_attribute; ?>-top_right_corner_div" min="<?php echo esc_attr( $value['min'] ); ?>" max="<?php echo esc_attr( $value['max'] ); ?>" inc="<?php echo esc_attr( $value['increment'] ); ?>"></div> 
  2351. </div> 
  2352. </div> 
  2353. <div class="a3rev-ui-slide-result-container"> 
  2354. <input 
  2355. readonly="readonly" 
  2356. name="<?php echo $name_attribute; ?>[top_right_corner]" 
  2357. id="<?php echo $id_attribute; ?>-top_right_corner" 
  2358. type="text" 
  2359. value="<?php echo esc_attr( $top_right_corner ); ?>" 
  2360. class="a3rev-ui-border_top_right_corner a3rev-ui-slider" 
  2361. /> <span class="a3rev-ui-border_corner-px">px</span> 
  2362. </div> 
  2363. </div> 
  2364. </div> 
  2365. <div class="a3rev-ui-border_corner-bottom_right"> 
  2366. <span class="a3rev-ui-border_corner-span"><?php _e( 'Bottom Right Corner', 'woocommerce-predictive-search' ); ?></span>  
  2367. <div class="a3rev-ui-slide-container"> 
  2368. <div class="a3rev-ui-slide-container-start"> 
  2369. <div class="a3rev-ui-slide-container-end"> 
  2370. <div class="a3rev-ui-slide" id="<?php echo $id_attribute; ?>-bottom_right_corner_div" min="<?php echo esc_attr( $value['min'] ); ?>" max="<?php echo esc_attr( $value['max'] ); ?>" inc="<?php echo esc_attr( $value['increment'] ); ?>"></div> 
  2371. </div> 
  2372. </div> 
  2373. <div class="a3rev-ui-slide-result-container"> 
  2374. <input 
  2375. readonly="readonly" 
  2376. name="<?php echo $name_attribute; ?>[bottom_right_corner]" 
  2377. id="<?php echo $id_attribute; ?>-bottom_right_corner" 
  2378. type="text" 
  2379. value="<?php echo esc_attr( $bottom_right_corner ); ?>" 
  2380. class="a3rev-ui-border_bottom_right_corner a3rev-ui-slider" 
  2381. /> <span class="a3rev-ui-border_corner-px">px</span> 
  2382. </div> 
  2383. </div> 
  2384. </div> 
  2385. <div class="a3rev-ui-border_corner-bottom_left"> 
  2386. <span class="a3rev-ui-border_corner-span"><?php _e( 'Bottom Left Corner', 'woocommerce-predictive-search' ); ?></span> 
  2387. <div class="a3rev-ui-slide-container">  
  2388. <div class="a3rev-ui-slide-container-start"> 
  2389. <div class="a3rev-ui-slide-container-end"> 
  2390. <div class="a3rev-ui-slide" id="<?php echo $id_attribute; ?>-bottom_left_corner_div" min="<?php echo esc_attr( $value['min'] ); ?>" max="<?php echo esc_attr( $value['max'] ); ?>" inc="<?php echo esc_attr( $value['increment'] ); ?>"></div> 
  2391. </div> 
  2392. </div> 
  2393. <div class="a3rev-ui-slide-result-container"> 
  2394. <input 
  2395. readonly="readonly" 
  2396. name="<?php echo $name_attribute; ?>[bottom_left_corner]" 
  2397. id="<?php echo $id_attribute; ?>-bottom_left_corner" 
  2398. type="text" 
  2399. value="<?php echo esc_attr( $bottom_left_corner ); ?>" 
  2400. class="a3rev-ui-border_bottom_left_corner a3rev-ui-slider" 
  2401. /> <span class="a3rev-ui-border_corner-px">px</span> 
  2402. </div> 
  2403. </div> 
  2404. </div> 
  2405. </div> 
  2406. <div style="clear:both"></div> 
  2407. </div> 
  2408.  
  2409. </td> 
  2410. </tr><?php 
  2411.  
  2412. break; 
  2413.  
  2414. // Border Style Control 
  2415. case 'border_styles': 
  2416.  
  2417. $default_color = ' data-default-color="' . esc_attr( $value['default']['color'] ) . '"'; 
  2418.  
  2419. $width = $option_value['width']; 
  2420. $style = $option_value['style']; 
  2421. $color = $option_value['color']; 
  2422.  
  2423. ?><tr valign="top"> 
  2424. <th scope="row" class="titledesc"><?php echo $tip; ?><?php echo esc_html( $value['name'] ) ?></th> 
  2425. <td class="forminp"> 
  2426. <?php echo $description; ?> 
  2427. <div class="a3rev-ui-settings-control"> 
  2428. <!-- Border Width --> 
  2429. <select 
  2430. name="<?php echo $name_attribute; ?>[width]" 
  2431. id="<?php echo $id_attribute; ?>-width" 
  2432. class="a3rev-ui-border_styles-width chzn-select <?php if ( is_rtl() ) { echo 'chzn-rtl'; } ?>" 
  2433. <?php 
  2434. for ( $i = 0; $i <= 20; $i++ ) { 
  2435. ?> 
  2436. <option value="<?php echo esc_attr( $i ); ?>px" <?php 
  2437. selected( $width, $i.'px' ); 
  2438. ?>><?php echo esc_attr( $i ); ?>px</option> 
  2439. <?php 
  2440. ?> 
  2441. </select>  
  2442.  
  2443. <!-- Border Style --> 
  2444. <select 
  2445. name="<?php echo $name_attribute; ?>[style]" 
  2446. id="<?php echo $id_attribute; ?>-style" 
  2447. class="a3rev-ui-border_styles-style chzn-select <?php if ( is_rtl() ) { echo 'chzn-rtl'; } ?>" 
  2448. <?php 
  2449. foreach ( $this->get_border_styles() as $val => $text ) { 
  2450. ?> 
  2451. <option value="<?php echo esc_attr( $val ); ?>" <?php 
  2452. selected( esc_attr( $val ), esc_attr( $style ) ); 
  2453. ?>><?php echo esc_attr( $text ); ?></option> 
  2454. <?php 
  2455. ?> 
  2456. </select> 
  2457.  
  2458. <!-- Border Color --> 
  2459. <input 
  2460. name="<?php echo $name_attribute; ?>[color]" 
  2461. id="<?php echo $id_attribute; ?>-color" 
  2462. type="text" 
  2463. value="<?php echo esc_attr( $color ); ?>" 
  2464. class="a3rev-ui-border_styles-color a3rev-color-picker" 
  2465. <?php echo $default_color; ?> 
  2466. /> 
  2467.  
  2468. <!-- Preview Button --> 
  2469. <div class="a3rev-ui-settings-preview"><a href="#" class="a3rev-ui-border-preview-button a3rev-ui-settings-preview-button button submit-button" title="<?php _e( 'Preview your customized border styles settings', 'woocommerce-predictive-search' ); ?>"><span> </span></a></div> 
  2470. <span class="description" style="margin-left:5px;"><?php echo __( '0px = No Border', 'woocommerce-predictive-search' ); ?></span> 
  2471. </div> 
  2472.  
  2473. </td> 
  2474. </tr><?php 
  2475.  
  2476. break; 
  2477.  
  2478. // Border Rounded Corners Control 
  2479. case 'border_corner': 
  2480.  
  2481. if ( ! isset( $value['min'] ) ) $value['min'] = 0; 
  2482. if ( ! isset( $value['max'] ) ) $value['max'] = 100; 
  2483. if ( ! isset( $value['increment'] ) ) $value['increment'] = 1; 
  2484.  
  2485. if ( ! isset( $option_value['corner'] ) ) $option_value['corner'] = ''; 
  2486. $corner = $option_value['corner']; 
  2487.  
  2488. if ( ! isset( $option_value['rounded_value'] ) ) $option_value['rounded_value'] = 3; 
  2489. $rounded_value = $option_value['rounded_value']; 
  2490.  
  2491. if ( ! isset( $option_value['top_left_corner'] ) ) $option_value['top_left_corner'] = 3; 
  2492. $top_left_corner = $option_value['top_left_corner']; 
  2493.  
  2494. if ( ! isset( $option_value['top_right_corner'] ) ) $option_value['top_right_corner'] = 3; 
  2495. $top_right_corner = $option_value['top_right_corner']; 
  2496.  
  2497. if ( ! isset( $option_value['bottom_left_corner'] ) ) $option_value['bottom_left_corner'] = 3; 
  2498. $bottom_left_corner = $option_value['bottom_left_corner']; 
  2499.  
  2500. if ( ! isset( $option_value['bottom_right_corner'] ) ) $option_value['bottom_right_corner'] = 3; 
  2501. $bottom_right_corner = $option_value['bottom_right_corner']; 
  2502.  
  2503. if ( trim( $rounded_value ) == '' || trim( $rounded_value ) <= 0 ) $rounded_value = $value['min']; 
  2504. $rounded_value = intval( $rounded_value ); 
  2505.  
  2506. if ( trim( $top_left_corner ) == '' || trim( $top_left_corner ) <= 0 ) $top_left_corner = $rounded_value; 
  2507. $top_left_corner = intval( $top_left_corner ); 
  2508.  
  2509. if ( trim( $top_right_corner ) == '' || trim( $top_right_corner ) <= 0 ) $top_right_corner = $rounded_value; 
  2510. $top_right_corner = intval( $top_right_corner ); 
  2511.  
  2512. if ( trim( $bottom_left_corner ) == '' || trim( $bottom_left_corner ) <= 0 ) $bottom_left_corner = $rounded_value; 
  2513. $bottom_left_corner = intval( $bottom_left_corner ); 
  2514.  
  2515. if ( trim( $bottom_right_corner ) == '' || trim( $bottom_right_corner ) <= 0 ) $bottom_right_corner = $rounded_value; 
  2516. $bottom_right_corner = intval( $bottom_right_corner ); 
  2517.  
  2518. ?><tr valign="top"> 
  2519. <th scope="row" class="titledesc"><?php echo $tip; ?><?php echo esc_html( $value['name'] ) ?></th> 
  2520. <td class="forminp forminp-<?php echo sanitize_title( $value['type'] ) ?>"> 
  2521. <div class="a3rev-ui-settings-control">  
  2522. <!-- Border Corner : Rounded or Square --> 
  2523. <input 
  2524. name="<?php echo $name_attribute; ?>[corner]" 
  2525. id="<?php echo $id_attribute; ?>" 
  2526. class="a3rev-ui-border-corner a3rev-ui-onoff_checkbox <?php echo esc_attr( $value['class'] ); ?>" 
  2527. checked_label="<?php _e( 'Rounded', 'woocommerce-predictive-search' ); ?>" 
  2528. unchecked_label="<?php _e( 'Square', 'woocommerce-predictive-search' ); ?>" 
  2529. type="checkbox" 
  2530. value="rounded" 
  2531. <?php checked( 'rounded', $corner ); ?> 
  2532. <?php echo implode( ' ', $custom_attributes ); ?> 
  2533. />  
  2534.  
  2535. <!-- Preview Button --> 
  2536. <div class="a3rev-ui-settings-preview"><a href="#" class="a3rev-ui-border-preview-button a3rev-ui-settings-preview-button button submit-button" title="<?php _e( 'Preview your customized border settings', 'woocommerce-predictive-search' ); ?>"><span> </span></a></div> 
  2537. <?php echo $description; ?> 
  2538. <!-- Border Rounded Value --> 
  2539. <div class="a3rev-ui-border-corner-value-container"> 
  2540. <div class="a3rev-ui-border_corner-top_left"> 
  2541. <span class="a3rev-ui-border_corner-span"><?php _e( 'Top Left Corner', 'woocommerce-predictive-search' ); ?></span> 
  2542. <div class="a3rev-ui-slide-container"> 
  2543. <div class="a3rev-ui-slide-container-start"> 
  2544. <div class="a3rev-ui-slide-container-end"> 
  2545. <div class="a3rev-ui-slide" id="<?php echo $id_attribute; ?>-top_left_corner_div" min="<?php echo esc_attr( $value['min'] ); ?>" max="<?php echo esc_attr( $value['max'] ); ?>" inc="<?php echo esc_attr( $value['increment'] ); ?>"></div> 
  2546. </div> 
  2547. </div> 
  2548. <div class="a3rev-ui-slide-result-container"> 
  2549. <input 
  2550. readonly="readonly" 
  2551. name="<?php echo $name_attribute; ?>[top_left_corner]" 
  2552. id="<?php echo $id_attribute; ?>-top_left_corner" 
  2553. type="text" 
  2554. value="<?php echo esc_attr( $top_left_corner ); ?>" 
  2555. class="a3rev-ui-border_top_left_corner a3rev-ui-slider" 
  2556. /> <span class="a3rev-ui-border_corner-px">px</span> 
  2557. </div> 
  2558. </div> 
  2559. </div> 
  2560. <div class="a3rev-ui-border_corner-top_right"> 
  2561. <span class="a3rev-ui-border_corner-span"><?php _e( 'Top Right Corner', 'woocommerce-predictive-search' ); ?></span> 
  2562. <div class="a3rev-ui-slide-container">  
  2563. <div class="a3rev-ui-slide-container-start"> 
  2564. <div class="a3rev-ui-slide-container-end"> 
  2565. <div class="a3rev-ui-slide" id="<?php echo $id_attribute; ?>-top_right_corner_div" min="<?php echo esc_attr( $value['min'] ); ?>" max="<?php echo esc_attr( $value['max'] ); ?>" inc="<?php echo esc_attr( $value['increment'] ); ?>"></div> 
  2566. </div> 
  2567. </div> 
  2568. <div class="a3rev-ui-slide-result-container"> 
  2569. <input 
  2570. readonly="readonly" 
  2571. name="<?php echo $name_attribute; ?>[top_right_corner]" 
  2572. id="<?php echo $id_attribute; ?>-top_right_corner" 
  2573. type="text" 
  2574. value="<?php echo esc_attr( $top_right_corner ); ?>" 
  2575. class="a3rev-ui-border_top_right_corner a3rev-ui-slider" 
  2576. /> <span class="a3rev-ui-border_corner-px">px</span> 
  2577. </div> 
  2578. </div> 
  2579. </div> 
  2580. <div class="a3rev-ui-border_corner-bottom_right"> 
  2581. <span class="a3rev-ui-border_corner-span"><?php _e( 'Bottom Right Corner', 'woocommerce-predictive-search' ); ?></span> 
  2582. <div class="a3rev-ui-slide-container">  
  2583. <div class="a3rev-ui-slide-container-start"> 
  2584. <div class="a3rev-ui-slide-container-end"> 
  2585. <div class="a3rev-ui-slide" id="<?php echo $id_attribute; ?>-bottom_right_corner_div" min="<?php echo esc_attr( $value['min'] ); ?>" max="<?php echo esc_attr( $value['max'] ); ?>" inc="<?php echo esc_attr( $value['increment'] ); ?>"></div> 
  2586. </div> 
  2587. </div> 
  2588. <div class="a3rev-ui-slide-result-container"> 
  2589. <input 
  2590. readonly="readonly" 
  2591. name="<?php echo $name_attribute; ?>[bottom_right_corner]" 
  2592. id="<?php echo $id_attribute; ?>-bottom_right_corner" 
  2593. type="text" 
  2594. value="<?php echo esc_attr( $bottom_right_corner ); ?>" 
  2595. class="a3rev-ui-border_bottom_right_corner a3rev-ui-slider" 
  2596. /> <span class="a3rev-ui-border_corner-px">px</span> 
  2597. </div> 
  2598. </div> 
  2599. </div> 
  2600. <div class="a3rev-ui-border_corner-bottom_left"> 
  2601. <span class="a3rev-ui-border_corner-span"><?php _e( 'Bottom Left Corner', 'woocommerce-predictive-search' ); ?></span>  
  2602. <div class="a3rev-ui-slide-container"> 
  2603. <div class="a3rev-ui-slide-container-start"> 
  2604. <div class="a3rev-ui-slide-container-end"> 
  2605. <div class="a3rev-ui-slide" id="<?php echo $id_attribute; ?>-bottom_left_corner_div" min="<?php echo esc_attr( $value['min'] ); ?>" max="<?php echo esc_attr( $value['max'] ); ?>" inc="<?php echo esc_attr( $value['increment'] ); ?>"></div> 
  2606. </div> 
  2607. </div> 
  2608. <div class="a3rev-ui-slide-result-container"> 
  2609. <input 
  2610. readonly="readonly" 
  2611. name="<?php echo $name_attribute; ?>[bottom_left_corner]" 
  2612. id="<?php echo $id_attribute; ?>-bottom_left_corner" 
  2613. type="text" 
  2614. value="<?php echo esc_attr( $bottom_left_corner ); ?>" 
  2615. class="a3rev-ui-border_bottom_left_corner a3rev-ui-slider" 
  2616. /> <span class="a3rev-ui-border_corner-px">px</span> 
  2617. </div> 
  2618. </div> 
  2619. </div> 
  2620. </div> 
  2621. <div style="clear:both"></div> 
  2622. </div> 
  2623. <div style="clear:both"></div> 
  2624. </td> 
  2625. </tr><?php 
  2626.  
  2627. break; 
  2628.  
  2629. // Box Shadow Control 
  2630. case 'box_shadow': 
  2631.  
  2632. $default_color = ' data-default-color="' . esc_attr( $value['default']['color'] ) . '"'; 
  2633.  
  2634. if ( ! isset( $option_value['enable'] ) ) $option_value['enable'] = 0; 
  2635. $enable = $option_value['enable']; 
  2636. if ( ! isset( $option_value['inset'] ) ) $option_value['inset'] = ''; 
  2637. $h_shadow = $option_value['h_shadow']; 
  2638. $v_shadow = $option_value['v_shadow']; 
  2639. $blur = $option_value['blur']; 
  2640. $spread = $option_value['spread']; 
  2641. $color = $option_value['color']; 
  2642. $inset = $option_value['inset']; 
  2643.  
  2644. ?><tr valign="top"> 
  2645. <th scope="row" class="titledesc"><?php echo $tip; ?><?php echo esc_html( $value['name'] ) ?></th> 
  2646. <td class="forminp forminp-box_shadow"> 
  2647. <input 
  2648. name="<?php echo $name_attribute; ?>[enable]" 
  2649. id="<?php echo $id_attribute; ?>" 
  2650. class="a3rev-ui-box_shadow-enable a3rev-ui-onoff_checkbox <?php echo esc_attr( $value['class'] ); ?>" 
  2651. checked_label="<?php _e( 'YES', 'woocommerce-predictive-search' ); ?>" 
  2652. unchecked_label="<?php _e( 'NO', 'woocommerce-predictive-search' ); ?>" 
  2653. type="checkbox" 
  2654. value="1" 
  2655. <?php checked( 1, $enable ); ?> 
  2656. <?php echo implode( ' ', $custom_attributes ); ?> 
  2657. /> 
  2658. <?php echo $description; ?> 
  2659. <div style="clear:both;"></div>  
  2660. <div class="a3rev-ui-box_shadow-enable-container"> 
  2661. <div class="a3rev-ui-settings-control"> 
  2662. <!-- Box Horizontal Shadow Size --> 
  2663. <select 
  2664. name="<?php echo $name_attribute; ?>[h_shadow]" 
  2665. id="<?php echo $id_attribute; ?>-h_shadow" 
  2666. class="a3rev-ui-box_shadow-h_shadow chzn-select <?php if ( is_rtl() ) { echo 'chzn-rtl'; } ?>" 
  2667. data-placeholder="<?php _e( 'Horizontal Shadow', 'woocommerce-predictive-search' ); ?>" 
  2668. <?php 
  2669. for ( $i = -20; $i <= 20; $i++ ) { 
  2670. ?> 
  2671. <option value="<?php echo esc_attr( $i ); ?>px" <?php 
  2672. selected( $h_shadow, $i.'px' ); 
  2673. ?>><?php echo esc_attr( $i ); ?>px</option> 
  2674. <?php 
  2675. ?> 
  2676. </select>  
  2677.  
  2678. <!-- Box Vertical Shadow Size --> 
  2679. <select 
  2680. name="<?php echo $name_attribute; ?>[v_shadow]" 
  2681. id="<?php echo $id_attribute; ?>-v_shadow" 
  2682. class="a3rev-ui-box_shadow-v_shadow chzn-select <?php if ( is_rtl() ) { echo 'chzn-rtl'; } ?>" 
  2683. data-placeholder="<?php _e( 'Vertical Shadow', 'woocommerce-predictive-search' ); ?>" 
  2684. <?php 
  2685. for ( $i = -20; $i <= 20; $i++ ) { 
  2686. ?> 
  2687. <option value="<?php echo esc_attr( $i ); ?>px" <?php 
  2688. selected( $v_shadow, $i.'px' ); 
  2689. ?>><?php echo esc_attr( $i ); ?>px</option> 
  2690. <?php 
  2691. ?> 
  2692. </select>  
  2693.  
  2694. <!-- Box Blur Distance --> 
  2695. <select 
  2696. name="<?php echo $name_attribute; ?>[blur]" 
  2697. id="<?php echo $id_attribute; ?>-blur" 
  2698. class="a3rev-ui-box_shadow-blur chzn-select <?php if ( is_rtl() ) { echo 'chzn-rtl'; } ?>" 
  2699. data-placeholder="<?php _e( 'Blur Distance', 'woocommerce-predictive-search' ); ?>" 
  2700. <?php 
  2701. for ( $i = 0; $i <= 20; $i++ ) { 
  2702. ?> 
  2703. <option value="<?php echo esc_attr( $i ); ?>px" <?php 
  2704. selected( $blur, $i.'px' ); 
  2705. ?>><?php echo esc_attr( $i ); ?>px</option> 
  2706. <?php 
  2707. ?> 
  2708. </select>  
  2709.  
  2710. <!-- Box Spread --> 
  2711. <select 
  2712. name="<?php echo $name_attribute; ?>[spread]" 
  2713. id="<?php echo $id_attribute; ?>-spread" 
  2714. class="a3rev-ui-box_shadow-spread chzn-select <?php if ( is_rtl() ) { echo 'chzn-rtl'; } ?>" 
  2715. data-placeholder="<?php _e( 'Spread Size', 'woocommerce-predictive-search' ); ?>" 
  2716. <?php 
  2717. for ( $i = 0; $i <= 20; $i++ ) { 
  2718. ?> 
  2719. <option value="<?php echo esc_attr( $i ); ?>px" <?php 
  2720. selected( $spread, $i.'px' ); 
  2721. ?>><?php echo esc_attr( $i ); ?>px</option> 
  2722. <?php 
  2723. ?> 
  2724. </select>  
  2725.  
  2726. <!-- Box Shadow Inset --> 
  2727. <input 
  2728. name="<?php echo $name_attribute; ?>[inset]" 
  2729. id="<?php echo $id_attribute; ?>" 
  2730. class="a3rev-ui-box_shadow-inset a3rev-ui-onoff_checkbox" 
  2731. checked_label="<?php _e( 'INNER', 'woocommerce-predictive-search' ); ?>" 
  2732. unchecked_label="<?php _e( 'OUTER', 'woocommerce-predictive-search' ); ?>" 
  2733. type="checkbox" 
  2734. value="inset" 
  2735. <?php checked( 'inset', $inset ); ?> 
  2736. <?php echo implode( ' ', $custom_attributes ); ?> 
  2737. />  
  2738.  
  2739. <!-- Box Shadow Color --> 
  2740. <input 
  2741. name="<?php echo $name_attribute; ?>[color]" 
  2742. id="<?php echo $id_attribute; ?>-color" 
  2743. type="text" 
  2744. value="<?php echo esc_attr( $color ); ?>" 
  2745. class="a3rev-ui-box_shadow-color a3rev-color-picker" 
  2746. <?php echo $default_color; ?> 
  2747. /> 
  2748.  
  2749. <!-- Preview Button --> 
  2750. <div class="a3rev-ui-settings-preview"><a href="#" class="a3rev-ui-box_shadow-preview-button a3rev-ui-settings-preview-button button submit-button" title="<?php _e( 'Preview your customized box shadow settings', 'woocommerce-predictive-search' ); ?>"><span> </span></a></div>  
  2751. </div> 
  2752. <div style="clear:both;"></div> 
  2753. </div> 
  2754. </td> 
  2755. </tr><?php 
  2756.  
  2757. break; 
  2758.  
  2759. // Slider Control 
  2760. case 'slider': 
  2761.  
  2762. if ( ! isset( $value['min'] ) ) $value['min'] = 0; 
  2763. if ( ! isset( $value['max'] ) ) $value['max'] = 100; 
  2764. if ( ! isset( $value['increment'] ) ) $value['increment'] = 1; 
  2765. if ( trim( $option_value ) == '' || trim( $option_value ) <= 0 ) $option_value = $value['min']; 
  2766. $option_value = intval( $option_value ); 
  2767.  
  2768. ?><tr valign="top"> 
  2769. <th scope="row" class="titledesc"> 
  2770. <?php echo $tip; ?> 
  2771. <label for="<?php echo $id_attribute; ?>"><?php echo esc_html( $value['name'] ); ?></label> 
  2772. </th> 
  2773. <td class="forminp forminp-<?php echo sanitize_title( $value['type'] ) ?>"> 
  2774. <div class="a3rev-ui-slide-container"> 
  2775. <div class="a3rev-ui-slide-container-start"><div class="a3rev-ui-slide-container-end"> 
  2776. <div class="a3rev-ui-slide" id="<?php echo $id_attribute; ?>_div" min="<?php echo esc_attr( $value['min'] ); ?>" max="<?php echo esc_attr( $value['max'] ); ?>" inc="<?php echo esc_attr( $value['increment'] ); ?>"></div> 
  2777. </div></div> 
  2778. <div class="a3rev-ui-slide-result-container"> 
  2779. <input 
  2780. readonly="readonly" 
  2781. name="<?php echo $name_attribute; ?>" 
  2782. id="<?php echo $id_attribute; ?>" 
  2783. type="text" 
  2784. value="<?php echo esc_attr( $option_value ); ?>" 
  2785. class="a3rev-ui-slider" 
  2786. <?php echo implode( ' ', $custom_attributes ); ?> 
  2787. /> <?php echo $description; ?> 
  2788. </div> 
  2789. </div> 
  2790. </td> 
  2791. </tr><?php 
  2792.  
  2793. break; 
  2794.  
  2795. // Upload Control 
  2796. case 'upload': 
  2797.  
  2798. $class = 'a3rev-ui-' . sanitize_title( $value['type'] ) . ' ' . esc_attr( $value['class'] ); 
  2799.  
  2800. $strip_methods = true; 
  2801. if ( isset( $value['strip_methods'] ) ) { 
  2802. $strip_methods = $value['strip_methods']; 
  2803.  
  2804. if ( strstr( $name_attribute, ']' ) ) { 
  2805. $attachment_id_name_attribute = substr_replace( $name_attribute, '_attachment_id', -1, 0 ); 
  2806. } else { 
  2807. $attachment_id_name_attribute = $name_attribute.'_attachment_id'; 
  2808. $attachment_id = $this->settings_get_option( $attachment_id_name_attribute, 0 ); 
  2809.  
  2810. ?><tr valign="top"> 
  2811. <th scope="row" class="titledesc"> 
  2812. <?php echo $tip; ?> 
  2813. <label for="<?php echo $id_attribute; ?>"><?php echo esc_html( $value['name'] ); ?></label> 
  2814. </th> 
  2815. <td class="forminp forminp-<?php echo sanitize_title( $value['type'] ) ?>"> 
  2816. <?php echo $description; ?> 
  2817. <?php echo $wc_predictive_search_uploader->upload_input( $name_attribute, $id_attribute, $option_value, $attachment_id, $value['default'], esc_html( $value['name'] ), $class, esc_attr( $value['css'] ) , '', $strip_methods );?> 
  2818. </td> 
  2819. </tr><?php 
  2820.  
  2821. break; 
  2822.  
  2823. // WP Editor Control 
  2824. case 'wp_editor': 
  2825.  
  2826. if ( ! isset( $value['textarea_rows'] ) ) $value['textarea_rows'] = 15; 
  2827.  
  2828. ?><tr valign="top"> 
  2829. <th scope="row" class="titledesc"> 
  2830. <?php echo $tip; ?> 
  2831. <label for="<?php echo $id_attribute; ?>"><?php echo esc_html( $value['name'] ); ?></label> 
  2832. </th> 
  2833. <td class="forminp forminp-<?php echo sanitize_title( $value['type'] ) ?>"> 
  2834. <?php echo $description; ?> 
  2835. <?php remove_all_filters('mce_external_plugins'); ?> 
  2836. <?php wp_editor( $option_value,  
  2837. $id_attribute,  
  2838. array( 'textarea_name' => $name_attribute,  
  2839. 'wpautop' => true,  
  2840. 'editor_class' => 'a3rev-ui-' . sanitize_title( $value['type'] ) . ' ' . esc_attr( $value['class'] ),  
  2841. 'textarea_rows' => $value['textarea_rows'] ) ); ?>  
  2842. </td> 
  2843. </tr><?php 
  2844.  
  2845. break; 
  2846.  
  2847. // Array Text Field Control 
  2848. case 'array_textfields': 
  2849.  
  2850. if ( !isset( $value['ids'] ) || !is_array( $value['ids'] ) || count( $value['ids'] ) < 1 ) break; 
  2851.  
  2852. ?><tr valign="top"> 
  2853. <th scope="row" class="titledesc"> 
  2854. <?php echo $tip; ?> 
  2855. <label for="<?php echo $id_attribute; ?>"><?php echo esc_html( $value['name'] ); ?></label> 
  2856. </th> 
  2857. <td class="forminp forminp-<?php echo sanitize_title( $value['type'] ) ?>"> 
  2858. <?php echo $description; ?> 
  2859. <div class="a3rev-ui-array_textfields-container"> 
  2860. <?php 
  2861. foreach ( $value['ids'] as $text_field ) { 
  2862.  
  2863. if ( ! isset( $text_field['id'] ) ) $text_field['id'] = ''; 
  2864. if ( ! isset( $text_field['name'] ) ) $text_field['name'] = ''; 
  2865. if ( ! isset( $text_field['class'] ) ) $text_field['class'] = ''; 
  2866. if ( ! isset( $text_field['css'] ) ) $text_field['css'] = ''; 
  2867. if ( ! isset( $text_field['default'] ) ) $text_field['default'] = ''; 
  2868.  
  2869. // Remove [, ] characters from id argument 
  2870. $key = false; 
  2871. if ( strstr( $text_field['id'], '[' ) ) { 
  2872. parse_str( esc_attr( $text_field['id'] ), $option_array ); 
  2873.  
  2874. // Option name is first key 
  2875. $option_keys = array_keys( $option_array ); 
  2876. $first_key = current( $option_keys ); 
  2877.  
  2878. $id_attribute = $first_key; 
  2879.  
  2880. $key = key( $option_array[ $id_attribute ] ); 
  2881. } else { 
  2882. $id_attribute = esc_attr( $text_field['id'] ); 
  2883.  
  2884. // Get option value when option name is not parse or when it's spearate option 
  2885. if ( trim( $option_name ) == '' || $value['separate_option'] != false ) { 
  2886. $option_value = $this->settings_get_option( $text_field['id'], $text_field['default'] ); 
  2887. // Get option value when it's an element from option array  
  2888. else { 
  2889. if ( $key != false ) { 
  2890. $option_value = ( isset( $option_values[ $id_attribute ][ $key ] ) ) ? $option_values[ $id_attribute ][ $key ] : $text_field['default']; 
  2891. } else { 
  2892. $option_value = ( isset( $option_values[ $id_attribute ] ) ) ? $option_values[ $id_attribute ] : $text_field['default']; 
  2893.  
  2894. // Generate name and id attributes 
  2895. if ( trim( $option_name ) == '' ) { 
  2896. $name_attribute = esc_attr( $text_field['id'] ); 
  2897. } elseif ( $value['separate_option'] != false ) { 
  2898. $name_attribute = esc_attr( $text_field['id'] ); 
  2899. $id_attribute = esc_attr( $option_name ) . '_' . $id_attribute; 
  2900. } else { 
  2901. // Array value 
  2902. if ( strstr( $text_field['id'], '[' ) ) { 
  2903. $name_attribute = esc_attr( $option_name ) . '[' . $id_attribute . ']' . str_replace( $id_attribute . '[', '[', esc_attr( $text_field['id'] ) ); 
  2904. } else { 
  2905. $name_attribute = esc_attr( $option_name ) . '[' . esc_attr( $text_field['id'] ) . ']'; 
  2906. $id_attribute = esc_attr( $option_name ) . '_' . $id_attribute; 
  2907. ?> 
  2908. <label><input 
  2909. name="<?php echo $name_attribute; ?>" 
  2910. id="<?php echo $id_attribute; ?>" 
  2911. type="text" 
  2912. style="<?php echo esc_attr( $text_field['css'] ); ?>" 
  2913. value="<?php echo esc_attr( $option_value ); ?>" 
  2914. class="a3rev-ui-<?php echo sanitize_title( $value['type'] ) ?> <?php echo esc_attr( $text_field['class'] ); ?>" 
  2915. /> <span><?php echo esc_html( $text_field['name'] ); ?></span></label>  
  2916. <?php 
  2917. ?> 
  2918. </div> 
  2919.  
  2920. </td> 
  2921. </tr><?php 
  2922.  
  2923. break; 
  2924.  
  2925. // Default: run an action 
  2926. default: 
  2927. do_action( $this->plugin_name . '_admin_field_' . $value['type'], $value ); 
  2928. break; 
  2929.  
  2930. // :) 
  2931. if ( ! isset( $this->is_free_plugin ) || ! $this->is_free_plugin ) { 
  2932. $fs = array( 0 => 'c', 1 => 'p', 2 => 'h', 3 => 'i', 4 => 'e', 5 => 'n', 6 => 'k', 7 => '_' ); 
  2933. $cs = array( 0 => 'U', 1 => 'g', 2 => 'p', 3 => 'r', 4 => 'd', 5 => 'a', 6 => 'e', 7 => '_' ); 
  2934. $check_settings_save = true; 
  2935. if ( isset( $this->class_name ) && ! class_exists( $this->class_name . $cs[7] . $cs[0] . $cs[2] . $cs[1] . $cs[3] . $cs[5] . $cs[4] . $cs[6] ) ) { 
  2936. $check_settings_save = false; 
  2937. if ( ! function_exists( $this->plugin_name . $fs[7] . $fs[0] . $fs[2] . $fs[4] . $fs[0] . $fs[6] . $fs[7] . $fs[1] . $fs[3] . $fs[5] ) ) { 
  2938. $check_settings_save = false; 
  2939. if ( ! $check_settings_save ) { 
  2940.  
  2941. if ( trim( $option_name ) != '' ) { 
  2942. update_option( $option_name, $new_settings ); 
  2943.  
  2944. foreach ( $options as $value ) { 
  2945. if ( ! isset( $value['type'] ) ) continue; 
  2946. if ( in_array( $value['type'], array( 'heading' ) ) ) continue; 
  2947. if ( ! isset( $value['id'] ) || trim( $value['id'] ) == '' ) continue; 
  2948. if ( ! isset( $value['default'] ) ) $value['default'] = ''; 
  2949. if ( ! isset( $value['free_version'] ) ) $value['free_version'] = false; 
  2950.  
  2951. // For way it has an option name 
  2952. if ( ! isset( $value['separate_option'] ) ) $value['separate_option'] = false; 
  2953.  
  2954. // Remove [, ] characters from id argument 
  2955. if ( strstr( $value['id'], '[' ) ) { 
  2956. parse_str( esc_attr( $value['id'] ), $option_array ); 
  2957.  
  2958. // Option name is first key 
  2959. $option_keys = array_keys( $option_array ); 
  2960. $first_key = current( $option_keys ); 
  2961.  
  2962. $id_attribute = $first_key; 
  2963. } else { 
  2964. $id_attribute = esc_attr( $value['id'] ); 
  2965.  
  2966. if ( trim( $option_name ) == '' || $value['separate_option'] != false ) { 
  2967. update_option( $id_attribute, $new_single_setting ); 
  2968.  
  2969. if ( $end_heading_id !== false ) { 
  2970. if ( trim( $end_heading_id ) != '' ) do_action( $this->plugin_name . '_settings_' . sanitize_title( $end_heading_id ) . '_end' ); 
  2971. echo '</table>' . "\n\n"; 
  2972. echo '</div>' . "\n\n"; 
  2973. if ( trim( $end_heading_id ) != '' ) do_action( $this->plugin_name . '_settings_' . sanitize_title( $end_heading_id ) . '_after' );  
  2974.  
  2975. if ( $header_sub_box_opening ) { 
  2976. $header_sub_box_opening = false; 
  2977.  
  2978. // close box inside 
  2979. echo '</div>' . "\n\n"; 
  2980.  
  2981. // close panel box 
  2982. echo '</div>' . "\n\n"; 
  2983.  
  2984. if ( $header_box_opening ) { 
  2985. $header_box_opening = false; 
  2986.  
  2987. // close box inside 
  2988. echo '</div>' . "\n\n"; 
  2989.  
  2990. // close panel box 
  2991. echo '</div>' . "\n\n"; 
  2992.  
  2993. ?> 
  2994. <?php do_action( $this->plugin_name . '-' . trim( $form_key ) . '_settings_end' ); ?> 
  2995. <p class="submit"> 
  2996. <input type="submit" value="<?php _e('Save changes', 'woocommerce-predictive-search' ); ?>" class="button button-primary" name="bt_save_settings" /> 
  2997. <input type="submit" name="bt_reset_settings" class="button" value="<?php _e('Reset Settings', 'woocommerce-predictive-search' ); ?>" /> 
  2998. <input type="hidden" name="form_name_action" value="<?php echo $form_key; ?>" /> 
  2999. <input type="hidden" class="last_tab" name="subtab" value="#<?php echo $current_subtab; ?>" /> 
  3000. </p> 
  3001.  
  3002. </form> 
  3003. </div> 
  3004.  
  3005. <?php 
  3006.  
  3007. /**-----------------------------------------------------------------------------------*/ 
  3008. /** Custom panel box for use on another page - panel_box() */ 
  3009. /**-----------------------------------------------------------------------------------*/ 
  3010. public function panel_box( $settings_html = '', $options = array() ) { 
  3011. if ( ! isset( $options['id'] ) ) $options['id'] = ''; 
  3012. if ( ! isset( $options['name'] ) ) $options['name'] = ''; 
  3013. if ( ! isset( $options['class'] ) ) $options['class'] = ''; 
  3014. if ( ! isset( $options['css'] ) ) $options['css'] = ''; 
  3015. if ( ! isset( $options['desc'] ) ) $options['desc'] = ''; 
  3016. if ( ! isset( $options['desc_tip'] ) ) $options['desc_tip'] = false; 
  3017.  
  3018. $is_box = false; 
  3019. if ( isset( $options['is_box'] ) && true == $options['is_box'] ) { 
  3020. $is_box = true; 
  3021.  
  3022. $view_doc = ( isset( $options['view_doc'] ) ) ? $options['view_doc'] : ''; 
  3023.  
  3024. if ( $is_box ) { 
  3025.  
  3026. $heading_box_id = ''; 
  3027. if ( ! empty( $options['id'] ) ) { 
  3028. $heading_box_id = $options['id']; 
  3029.  
  3030. if ( '' != trim( $heading_box_id ) ) { 
  3031.  
  3032. $user_id = get_current_user_id(); 
  3033. $opened_box = get_user_meta( $user_id, $this->plugin_name . '-custom-boxes' , true ); 
  3034. if ( empty( $opened_box ) || ! is_array( $opened_box ) ) { 
  3035. $opened_box = array(); 
  3036.  
  3037. $toggle_box_open = $this->settings_get_option( $this->toggle_box_open_option, 0 ); 
  3038.  
  3039. $toggle_box_class = ''; 
  3040. if ( 1 == $toggle_box_open ) { 
  3041. $toggle_box_class = 'enable_toggle_box_save'; 
  3042.  
  3043. $opened_class = ''; 
  3044. if ( in_array( $heading_box_id, $opened_box ) && 1 == $toggle_box_open ) { 
  3045. $opened_class = 'box_open'; 
  3046.  
  3047. // Change to open box for the heading set alway_open = true 
  3048. if ( isset( $options['alway_open'] ) && true == $options['alway_open'] ) { 
  3049. $opened_class = 'box_open'; 
  3050.  
  3051. // Change to close box for the heading set alway_close = true 
  3052. if ( isset( $options['alway_close'] ) && true == $options['alway_close'] ) { 
  3053. $opened_class = ''; 
  3054.  
  3055. // Make the box open on first load with this argument first_open = true 
  3056. if ( isset( $options['first_open'] ) && true == $options['first_open'] ) { 
  3057. $this_box_is_opened = get_user_meta( $user_id, $this->plugin_name . '-' . trim( $heading_box_id ) . '-' . 'opened', true ); 
  3058. if ( empty( $this_box_is_opened ) ) { 
  3059. $opened_class = 'box_open'; 
  3060. add_user_meta( $user_id, $this->plugin_name . '-' . trim( $heading_box_id ) . '-' . 'opened', 1 ); 
  3061.  
  3062. } else { 
  3063.  
  3064. $toggle_box_class = ''; 
  3065. $opened_class = ''; 
  3066.  
  3067.  
  3068. // open panel box 
  3069. echo '<div id="'. esc_attr( $options['id'] ) . '" class="a3rev_panel_box '. esc_attr( $options['class'] ) .'" style="'. esc_attr( $options['css'] ) .'">' . "\n\n"; 
  3070.  
  3071. // open box handle 
  3072. echo '<div data-form-key="custom-boxes" data-box-id="'. esc_attr( $heading_box_id ) .'" class="a3rev_panel_box_handle" >' . "\n\n"; 
  3073.  
  3074. echo ( ! empty( $options['name'] ) ) ? '<h3 class="a3-plugin-ui-panel-box '. $toggle_box_class . ' ' . $opened_class . '">'. esc_html( $options['name'] ) .' '. $view_doc .'</h3>' : ''; 
  3075.  
  3076. if ( stristr( $options['class'], 'pro_feature_fields' ) !== false && ! empty( $options['id'] ) ) $this->upgrade_top_message( true, sanitize_title( $options['id'] ) ); 
  3077. elseif ( stristr( $options['class'], 'pro_feature_fields' ) !== false ) $this->upgrade_top_message( true ); 
  3078.  
  3079. // close box handle 
  3080. echo '</div>' . "\n\n"; 
  3081.  
  3082. // open box inside 
  3083. echo '<div id="'. esc_attr( $options['id'] ) . '_box_inside" class="a3rev_panel_box_inside '.$opened_class.'" style="padding-top: 10px;" >' . "\n\n"; 
  3084.  
  3085. echo '<div class="a3rev_panel_inner">' . "\n\n"; 
  3086.  
  3087. } else { 
  3088. echo '<div id="'. esc_attr( $options['id'] ) . '" class="a3rev_panel_inner '. esc_attr( $options['class'] ) .'" style="'. esc_attr( $options['css'] ) .'">' . "\n\n"; 
  3089. if ( stristr( $options['class'], 'pro_feature_fields' ) !== false && ! empty( $options['id'] ) ) $this->upgrade_top_message( true, sanitize_title( $options['id'] ) ); 
  3090. elseif ( stristr( $options['class'], 'pro_feature_fields' ) !== false ) $this->upgrade_top_message( true ); 
  3091.  
  3092. echo ( ! empty( $options['name'] ) ) ? '<h3>'. esc_html( $options['name'] ) .' '. $view_doc .'</h3>' : ''; 
  3093.  
  3094. if ( ! empty( $options['desc'] ) ) { 
  3095. echo '<div class="a3rev_panel_box_description" >' . "\n\n"; 
  3096. echo wpautop( wptexturize( $options['desc'] ) ); 
  3097. echo '</div>' . "\n\n"; 
  3098.  
  3099. echo $settings_html; 
  3100.  
  3101. echo '</div>'; 
  3102.  
  3103. if ( $is_box ) { 
  3104. // close box inside 
  3105. echo '</div>' . "\n\n"; 
  3106.  
  3107. // close panel box 
  3108. echo '</div>' . "\n\n"; 
  3109.  
  3110. /**-----------------------------------------------------------------------------------*/ 
  3111. /** Custom Stripslashed for array in array - admin_stripslashes() */ 
  3112. /**-----------------------------------------------------------------------------------*/ 
  3113. public function admin_stripslashes( $values ) { 
  3114. if ( is_array( $values ) ) { 
  3115. $values = array_map( array( $this, 'admin_stripslashes' ), $values ); 
  3116. } else { 
  3117. $values = esc_attr( stripslashes( $values ) );  
  3118.  
  3119. return $values; 
  3120.  
  3121. /**-----------------------------------------------------------------------------------*/ 
  3122. /** hextorgb() */ 
  3123. /** Convert Hex to RGB for color */ 
  3124. /**-----------------------------------------------------------------------------------*/ 
  3125. public function hextorgb( $color = '', $text = true ) { 
  3126. $color = trim( $color ); 
  3127. if ( '' == $color || 'transparent' == $color ) { 
  3128. return false; 
  3129.  
  3130. if ( '#' == $color[0] ) { 
  3131. $color = substr( $color, 1 ); 
  3132.  
  3133. if ( 6 == strlen( $color ) ) { 
  3134. list( $r, $g, $b ) = array( $color[0].$color[1], $color[2].$color[3], $color[4].$color[5] ); 
  3135. } elseif ( 3 == strlen( $color ) ) { 
  3136. list( $r, $g, $b ) = array( $color[0].$color[0], $color[1].$color[1], $color[2].$color[2] ); 
  3137. } else { 
  3138. return false; 
  3139.  
  3140. $r = hexdec($r); 
  3141. $g = hexdec($g); 
  3142. $b = hexdec($b); 
  3143.  
  3144. if ( $text ) { 
  3145. return $r.', '.$g.', '.$b; 
  3146. } else { 
  3147. return array( $r, $g, $b ); 
  3148.  
  3149. /**-----------------------------------------------------------------------------------*/ 
  3150. /** generate_border_css() */ 
  3151. /** Generate Border CSS on frontend */ 
  3152. /**-----------------------------------------------------------------------------------*/ 
  3153. public function generate_border_css( $option ) { 
  3154.  
  3155. $border_css = ''; 
  3156.  
  3157. $border_css .= 'border: ' . esc_attr( $option['width'] ) . ' ' . esc_attr( $option['style'] ) . ' ' . esc_attr( $option['color'] ) .' !important;'; 
  3158.  
  3159. if ( isset( $option['corner'] ) && esc_attr( $option['corner'] ) == 'rounded' ) { 
  3160. if ( ! isset( $option['rounded_value'] ) ) $option['rounded_value'] = 0; 
  3161. if ( ! isset( $option['top_left_corner'] ) ) $option['top_left_corner'] = $option['rounded_value']; 
  3162. if ( ! isset( $option['top_right_corner'] ) ) $option['top_right_corner'] = $option['rounded_value']; 
  3163. if ( ! isset( $option['bottom_left_corner'] ) ) $option['bottom_left_corner'] = $option['rounded_value']; 
  3164. if ( ! isset( $option['bottom_right_corner'] ) ) $option['bottom_right_corner'] = $option['rounded_value']; 
  3165.  
  3166. $border_css .= 'border-radius: ' . $option['top_left_corner'] . 'px ' . $option['top_right_corner'] . 'px ' . $option['bottom_right_corner'] . 'px ' . $option['bottom_left_corner'] . 'px !important;'; 
  3167. $border_css .= '-moz-border-radius: ' . $option['top_left_corner'] . 'px ' . $option['top_right_corner'] . 'px ' . $option['bottom_right_corner'] . 'px ' . $option['bottom_left_corner'] . 'px !important;'; 
  3168. $border_css .= '-webkit-border-radius: ' . $option['top_left_corner'] . 'px ' . $option['top_right_corner'] . 'px ' . $option['bottom_right_corner'] . 'px ' . $option['bottom_left_corner'] . 'px !important;'; 
  3169. } else { 
  3170. $border_css .= 'border-radius: 0px !important;'; 
  3171. $border_css .= '-moz-border-radius: 0px !important;'; 
  3172. $border_css .= '-webkit-border-radius: 0px !important;';  
  3173.  
  3174. return $border_css; 
  3175.  
  3176.  
  3177. /**-----------------------------------------------------------------------------------*/ 
  3178. /** generate_border_style_css() */ 
  3179. /** Generate Border Style CSS on frontend */ 
  3180. /**-----------------------------------------------------------------------------------*/ 
  3181. public function generate_border_style_css( $option ) { 
  3182.  
  3183. $border_style_css = ''; 
  3184.  
  3185. $border_style_css .= 'border: ' . esc_attr( $option['width'] ) . ' ' . esc_attr( $option['style'] ) . ' ' . esc_attr( $option['color'] ) .' !important;'; 
  3186.  
  3187. return $border_style_css; 
  3188.  
  3189.  
  3190. /**-----------------------------------------------------------------------------------*/ 
  3191. /** generate_border_corner_css() */ 
  3192. /** Generate Border Corner CSS on frontend */ 
  3193. /**-----------------------------------------------------------------------------------*/ 
  3194. public function generate_border_corner_css( $option ) { 
  3195.  
  3196. $border_corner_css = ''; 
  3197.  
  3198. if ( isset( $option['corner'] ) && esc_attr( $option['corner'] ) == 'rounded' ) { 
  3199. if ( ! isset( $option['rounded_value'] ) ) $option['rounded_value'] = 0; 
  3200. if ( ! isset( $option['top_left_corner'] ) ) $option['top_left_corner'] = $option['rounded_value']; 
  3201. if ( ! isset( $option['top_right_corner'] ) ) $option['top_right_corner'] = $option['rounded_value']; 
  3202. if ( ! isset( $option['bottom_left_corner'] ) ) $option['bottom_left_corner'] = $option['rounded_value']; 
  3203. if ( ! isset( $option['bottom_right_corner'] ) ) $option['bottom_right_corner'] = $option['rounded_value']; 
  3204.  
  3205. $border_corner_css .= 'border-radius: ' . $option['top_left_corner'] . 'px ' . $option['top_right_corner'] . 'px ' . $option['bottom_right_corner'] . 'px ' . $option['bottom_left_corner'] . 'px !important;'; 
  3206. $border_corner_css .= '-moz-border-radius: ' . $option['top_left_corner'] . 'px ' . $option['top_right_corner'] . 'px ' . $option['bottom_right_corner'] . 'px ' . $option['bottom_left_corner'] . 'px !important;'; 
  3207. $border_corner_css .= '-webkit-border-radius: ' . $option['top_left_corner'] . 'px ' . $option['top_right_corner'] . 'px ' . $option['bottom_right_corner'] . 'px ' . $option['bottom_left_corner'] . 'px !important;'; 
  3208. } else { 
  3209. $border_corner_css .= 'border-radius: 0px !important;'; 
  3210. $border_corner_css .= '-moz-border-radius: 0px !important;'; 
  3211. $border_corner_css .= '-webkit-border-radius: 0px !important;'; 
  3212.  
  3213. return $border_corner_css; 
  3214.  
  3215.  
  3216. /**-----------------------------------------------------------------------------------*/ 
  3217. /** generate_shadow_css() */ 
  3218. /** Generate Shadow CSS on frontend */ 
  3219. /**-----------------------------------------------------------------------------------*/ 
  3220. public function generate_shadow_css( $option ) { 
  3221.  
  3222. $shadow_css = ''; 
  3223. if ( ! isset( $option['inset'] ) ) $option['inset'] = ''; 
  3224.  
  3225. if ( isset( $option['enable'] ) && $option['enable'] == 1 ) { 
  3226. $shadow_css .= 'box-shadow: ' . $option['h_shadow'] . ' ' . $option['v_shadow'] . ' ' . $option['blur'] . ' ' . $option['spread'] . ' ' . $option['color'] . ' ' . $option['inset'] . ' !important;'; 
  3227. $shadow_css .= '-moz-box-shadow: ' . $option['h_shadow'] . ' ' . $option['v_shadow'] . ' ' . $option['blur'] . ' ' . $option['spread'] . ' ' . $option['color'] . ' ' . $option['inset'] . ' !important;'; 
  3228. $shadow_css .= '-webkit-box-shadow: ' . $option['h_shadow'] . ' ' . $option['v_shadow'] . ' ' . $option['blur'] . ' ' . $option['spread'] . ' ' . $option['color'] . ' ' . $option['inset'] . ' !important;'; 
  3229. } else { 
  3230. $shadow_css .= 'box-shadow: none !important ;'; 
  3231. $shadow_css .= '-moz-box-shadow: none !important ;'; 
  3232. $shadow_css .= '-webkit-box-shadow: none !important ;'; 
  3233.  
  3234. return $shadow_css; 
  3235.  
  3236.  
  3237. /**-----------------------------------------------------------------------------------*/ 
  3238. /** generate_background_css() */ 
  3239. /** Generate Background Color CSS on frontend */ 
  3240. /**-----------------------------------------------------------------------------------*/ 
  3241. public function generate_background_color_css( $option, $transparency = 100 ) { 
  3242.  
  3243. $return_css = ''; 
  3244.  
  3245. if ( isset( $option['enable'] ) && $option['enable'] == 1 ) { 
  3246. $color = $option['color']; 
  3247. if ( 100 != $transparency ) { 
  3248. $color = $this->hextorgb( $color ); 
  3249. $transparency = (int) $transparency / 100; 
  3250.  
  3251. if ( $color !== false ) { 
  3252. $return_css .= 'background-color: rgba( ' . $color . ', ' . $transparency . ' ) !important;'; 
  3253. } else { 
  3254. $return_css .= 'background-color: transparent !important ;'; 
  3255. } else { 
  3256. $return_css .= 'background-color: ' . $color . ' !important ;'; 
  3257. } else { 
  3258. $return_css .= 'background-color: transparent !important ;'; 
  3259.  
  3260. return $return_css; 
  3261.  
  3262.