WC_Predictive_Search_Global_Settings

The WooCommerce Predictive Search LITE WC Predictive Search Global Settings class.

Defined (1)

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

/admin/settings/global-settings.php  
  1. class WC_Predictive_Search_Global_Settings extends WC_Predictive_Search_Admin_UI 
  2.  
  3. /** 
  4. * @var string 
  5. */ 
  6. private $parent_tab = 'global-settings'; 
  7.  
  8. /** 
  9. * @var array 
  10. */ 
  11. private $subtab_data; 
  12.  
  13. /** 
  14. * @var string 
  15. * You must change to correct option name that you are working 
  16. */ 
  17. public $option_name = ''; 
  18.  
  19. /** 
  20. * @var string 
  21. * You must change to correct form key that you are working 
  22. */ 
  23. public $form_key = 'wc_predictive_search_global_settings'; 
  24.  
  25. /** 
  26. * @var string 
  27. * You can change the order show of this sub tab in list sub tabs 
  28. */ 
  29. private $position = 1; 
  30.  
  31. /** 
  32. * @var array 
  33. */ 
  34. public $form_fields = array(); 
  35.  
  36. /** 
  37. * @var array 
  38. */ 
  39. public $form_messages = array(); 
  40.  
  41. /**-----------------------------------------------------------------------------------*/ 
  42. /** __construct() */ 
  43. /** Settings Constructor */ 
  44. /**-----------------------------------------------------------------------------------*/ 
  45. public function __construct() { 
  46.  
  47. $this->init_form_fields(); 
  48. $this->subtab_init(); 
  49.  
  50. $this->form_messages = array( 
  51. 'success_message' => __( 'Global Settings successfully saved.', 'woocommerce-predictive-search' ),  
  52. 'error_message' => __( 'Error: Global Settings can not save.', 'woocommerce-predictive-search' ),  
  53. 'reset_message' => __( 'Global Settings successfully reseted.', 'woocommerce-predictive-search' ),  
  54. ); 
  55.  
  56. add_action( $this->plugin_name . '-' . $this->form_key . '_settings_end', array( $this, 'include_script' ) ); 
  57.  
  58. add_action( $this->plugin_name . '_set_default_settings' , array( $this, 'set_default_settings' ) ); 
  59.  
  60. add_action( $this->plugin_name . '-' . $this->form_key . '_settings_init' , array( $this, 'after_save_settings' ) ); 
  61. //add_action( $this->plugin_name . '_get_all_settings' , array( $this, 'get_settings' ) ); 
  62.  
  63. /**-----------------------------------------------------------------------------------*/ 
  64. /** subtab_init() */ 
  65. /** Sub Tab Init */ 
  66. /**-----------------------------------------------------------------------------------*/ 
  67. public function subtab_init() { 
  68.  
  69. add_filter( $this->plugin_name . '-' . $this->parent_tab . '_settings_subtabs_array', array( $this, 'add_subtab' ), $this->position ); 
  70.  
  71.  
  72. /**-----------------------------------------------------------------------------------*/ 
  73. /** set_default_settings() 
  74. /** Set default settings with function called from Admin Interface */ 
  75. /**-----------------------------------------------------------------------------------*/ 
  76. public function set_default_settings() { 
  77. global $wc_predictive_search_admin_interface; 
  78.  
  79. $wc_predictive_search_admin_interface->reset_settings( $this->form_fields, $this->option_name, false ); 
  80.  
  81. /**-----------------------------------------------------------------------------------*/ 
  82. /** after_save_settings() 
  83. /** Process when clean on deletion option is un selected */ 
  84. /**-----------------------------------------------------------------------------------*/ 
  85. public function after_save_settings() { 
  86. if ( ( isset( $_POST['bt_save_settings'] ) || isset( $_POST['bt_reset_settings'] ) ) && get_option( 'woocommerce_search_lite_clean_on_deletion' ) == 'no' ) { 
  87. $uninstallable_plugins = (array) get_option('uninstall_plugins'); 
  88. unset($uninstallable_plugins[WOOPS_NAME]); 
  89. update_option('uninstall_plugins', $uninstallable_plugins); 
  90.  
  91. if ( isset( $_POST['bt_save_settings'] ) ) { 
  92. flush_rewrite_rules(); 
  93. } elseif ( 1 == get_option( 'wc_predictive_search_just_confirm', 0 ) ) { 
  94. delete_option( 'wc_predictive_search_just_confirm' ); 
  95. flush_rewrite_rules(); 
  96.  
  97. if ( ( isset( $_POST['bt_save_settings'] ) || isset( $_POST['bt_reset_settings'] ) ) ) { 
  98. global $wc_ps_exclude_data; 
  99. $wc_ps_exclude_data->empty_table(); 
  100.  
  101. delete_option( 'woocommerce_search_exclude_products' ); 
  102. delete_option( 'woocommerce_search_exclude_posts' ); 
  103. delete_option( 'woocommerce_search_exclude_pages' ); 
  104. if ( isset( $_POST['bt_save_settings'] ) ) { 
  105. global $wc_ps_exclude_data; 
  106. if ( isset( $_POST['woocommerce_search_exclude_products'] ) && count( $_POST['woocommerce_search_exclude_products'] ) > 0 ) { 
  107. foreach ( $_POST['woocommerce_search_exclude_products'] as $item_id ) { 
  108. $wc_ps_exclude_data->insert_item( $item_id, 'product' ); 
  109. if ( isset( $_POST['woocommerce_search_exclude_posts'] ) && count( $_POST['woocommerce_search_exclude_posts'] ) > 0 ) { 
  110. foreach ( $_POST['woocommerce_search_exclude_posts'] as $item_id ) { 
  111. $wc_ps_exclude_data->insert_item( $item_id, 'post' ); 
  112. if ( isset( $_POST['woocommerce_search_exclude_pages'] ) && count( $_POST['woocommerce_search_exclude_pages'] ) > 0 ) { 
  113. foreach ( $_POST['woocommerce_search_exclude_pages'] as $item_id ) { 
  114. $wc_ps_exclude_data->insert_item( $item_id, 'page' ); 
  115.  
  116. /**-----------------------------------------------------------------------------------*/ 
  117. /** get_settings() 
  118. /** Get settings with function called from Admin Interface */ 
  119. /**-----------------------------------------------------------------------------------*/ 
  120. public function get_settings() { 
  121. global $wc_predictive_search_admin_interface; 
  122.  
  123. $wc_predictive_search_admin_interface->get_settings( $this->form_fields, $this->option_name ); 
  124.  
  125. /** 
  126. * subtab_data() 
  127. * Get SubTab Data 
  128. * ============================================= 
  129. * array ( 
  130. * 'name' => 'my_subtab_name' : (required) Enter your subtab name that you want to set for this subtab 
  131. * 'label' => 'My SubTab Name' : (required) Enter the subtab label 
  132. * 'callback_function' => 'my_callback_function' : (required) The callback function is called to show content of this subtab 
  133. * ) 
  134. */ 
  135. public function subtab_data() { 
  136.  
  137. $subtab_data = array( 
  138. 'name' => 'global-settings',  
  139. 'label' => __( 'Settings', 'woocommerce-predictive-search' ),  
  140. 'callback_function' => 'wc_predictive_search_global_settings_form',  
  141. ); 
  142.  
  143. if ( $this->subtab_data ) return $this->subtab_data; 
  144. return $this->subtab_data = $subtab_data; 
  145.  
  146.  
  147. /**-----------------------------------------------------------------------------------*/ 
  148. /** add_subtab() */ 
  149. /** Add Subtab to Admin Init 
  150. /**-----------------------------------------------------------------------------------*/ 
  151. public function add_subtab( $subtabs_array ) { 
  152.  
  153. if ( ! is_array( $subtabs_array ) ) $subtabs_array = array(); 
  154. $subtabs_array[] = $this->subtab_data(); 
  155.  
  156. return $subtabs_array; 
  157.  
  158. /**-----------------------------------------------------------------------------------*/ 
  159. /** settings_form() */ 
  160. /** Call the form from Admin Interface 
  161. /**-----------------------------------------------------------------------------------*/ 
  162. public function settings_form() { 
  163. global $wc_predictive_search_admin_interface; 
  164.  
  165. $output = ''; 
  166. $output .= $wc_predictive_search_admin_interface->admin_forms( $this->form_fields, $this->form_key, $this->option_name, $this->form_messages ); 
  167.  
  168. return $output; 
  169.  
  170. /**-----------------------------------------------------------------------------------*/ 
  171. /** init_form_fields() */ 
  172. /** Init all fields of this form */ 
  173. /**-----------------------------------------------------------------------------------*/ 
  174. public function init_form_fields() { 
  175.  
  176. global $wpdb; 
  177. $all_products = array(); 
  178. $all_posts = array(); 
  179. $all_pages = array(); 
  180.  
  181. $products_excluded = array(); 
  182. $posts_excluded = array(); 
  183. $pages_excluded = array(); 
  184.  
  185. if ( is_admin() && in_array (basename($_SERVER['PHP_SELF']), array('admin.php') ) && isset( $_GET['page'] ) && $_GET['page'] == 'woo-predictive-search' && ( ! isset( $_GET['tab'] ) || $_GET['tab'] == 'global-settings' ) ) { 
  186.  
  187. $results_products = $wpdb->get_results("SELECT ID, post_title FROM ".$wpdb->prefix."posts WHERE post_type='product' AND post_status='publish' ORDER BY post_title ASC"); 
  188. if ($results_products) { 
  189. foreach($results_products as $product_data) { 
  190. $all_products[$product_data->ID] = $product_data->post_title; 
  191. $results_posts = $wpdb->get_results("SELECT ID, post_title FROM ".$wpdb->prefix."posts WHERE post_type='post' AND post_status='publish' ORDER BY post_title ASC"); 
  192. if ($results_posts) { 
  193. foreach($results_posts as $post_data) { 
  194. $all_posts[$post_data->ID] = $post_data->post_title; 
  195. $results_pages = $wpdb->get_results("SELECT ID, post_title FROM ".$wpdb->prefix."posts WHERE post_type='page' AND post_status='publish' ORDER BY post_title ASC"); 
  196. if ($results_pages) { 
  197. foreach($results_pages as $page_data) { 
  198. $all_pages[$page_data->ID] = $page_data->post_title; 
  199.  
  200. if ( isset( $_POST['bt_save_settings'] ) ) { 
  201. $products_excluded = array(); 
  202. if ( isset( $_POST['woocommerce_search_exclude_products'] ) ) { 
  203. $products_excluded = $_POST['woocommerce_search_exclude_products']; 
  204. $posts_excluded = array(); 
  205. if ( isset( $_POST['woocommerce_search_exclude_posts'] ) ) { 
  206. $posts_excluded = $_POST['woocommerce_search_exclude_posts']; 
  207. $pages_excluded = array(); 
  208. if ( isset( $_POST['woocommerce_search_exclude_pages'] ) ) { 
  209. $pages_excluded = $_POST['woocommerce_search_exclude_pages']; 
  210. } else { 
  211. $products_excluded = $wpdb->get_col( $wpdb->prepare( "SELECT object_id FROM {$wpdb->prefix}ps_exclude WHERE object_type = %s ", 'product' ) ); 
  212. $posts_excluded = $wpdb->get_col( $wpdb->prepare( "SELECT object_id FROM {$wpdb->prefix}ps_exclude WHERE object_type = %s ", 'post' ) ); 
  213. $pages_excluded = $wpdb->get_col( $wpdb->prepare( "SELECT object_id FROM {$wpdb->prefix}ps_exclude WHERE object_type = %s ", 'page' ) ); 
  214.  
  215.  
  216. // Define settings 
  217. $this->form_fields = apply_filters( $this->option_name . '_settings_fields', array( 
  218.  
  219. array( 
  220. 'name' => __( 'Plugin Framework Global Settings', 'woocommerce-predictive-search' ),  
  221. 'id' => 'plugin_framework_global_box',  
  222. 'type' => 'heading',  
  223. 'first_open'=> true,  
  224. 'is_box' => true,  
  225. ),  
  226.  
  227. array( 
  228. 'name' => __( 'Customize Admin Setting Box Display', 'woocommerce-predictive-search' ),  
  229. 'desc' => __( 'By default each admin panel will open with all Setting Boxes in the CLOSED position.', 'woocommerce-predictive-search' ),  
  230. 'type' => 'heading',  
  231. ),  
  232. array( 
  233. 'type' => 'onoff_toggle_box',  
  234. ),  
  235. array( 
  236. 'name' => __( 'Google Fonts', 'woocommerce-predictive-search' ),  
  237. 'desc' => __( 'By Default Google Fonts are pulled from a static JSON file in this plugin. This file is updated but does not have the latest font releases from Google.', 'woocommerce-predictive-search' ),  
  238. 'type' => 'heading',  
  239. ),  
  240. array( 
  241. 'type' => 'google_api_key',  
  242. ),  
  243. array( 
  244. 'name' => __( 'House Keeping', 'woocommerce-predictive-search' ),  
  245. 'type' => 'heading',  
  246. ),  
  247. array( 
  248. 'name' => __( 'Clean Up On Deletion', 'woocommerce-predictive-search' ),  
  249. 'desc' => __( 'On deletion (not deactivate) the plugin will completely remove all tables and data it created, leaving no trace it was ever here.', 'woocommerce-predictive-search' ),  
  250. 'id' => 'woocommerce_search_lite_clean_on_deletion',  
  251. 'type' => 'onoff_checkbox',  
  252. 'default' => 'no',  
  253. 'separate_option' => true,  
  254. 'free_version' => true,  
  255. 'checked_value' => 'yes',  
  256. 'unchecked_value' => 'no',  
  257. 'checked_label' => __( 'ON', 'woocommerce-predictive-search' ),  
  258. 'unchecked_label' => __( 'OFF', 'woocommerce-predictive-search' ),  
  259. ),  
  260.  
  261. array( 
  262. 'name' => __( 'Search Results No-Cache', 'woocommerce-predictive-search' ),  
  263. 'desc' => __( 'While testing different setting and the results in search box dropdown you need to switch ON Results No-Cache On. Search box dropdown results are cached in local store for frontend users for faster delivery on repeat searches. Be sure to turn this OFF when you are finished testing.', 'woocommerce-predictive-search' ),  
  264. 'type' => 'heading',  
  265. 'id' => 'predictive_search_nocache_box',  
  266. 'is_box' => true,  
  267. ),  
  268. array( 
  269. 'name' => __( 'Results No-Cache', 'woocommerce-predictive-search' ),  
  270. 'id' => 'woocommerce_search_is_debug',  
  271. 'type' => 'onoff_checkbox',  
  272. 'default' => 'yes',  
  273. 'checked_value' => 'yes',  
  274. 'unchecked_value' => 'no',  
  275. 'checked_label' => __( 'ON', 'woocommerce-predictive-search' ),  
  276. 'unchecked_label' => __( 'OFF', 'woocommerce-predictive-search' ),  
  277. ),  
  278.  
  279. array( 
  280. 'name' => __( 'Predictive Search Mode', 'woocommerce-predictive-search' ),  
  281. 'desc' => __( '<strong>IMPORTANT!</strong> Remember to turn ON the No-Cache option so that you see the difference between the 2 search modes when testing.', 'woocommerce-predictive-search' ),  
  282. 'type' => 'heading',  
  283. 'id' => 'predictive_search_mode_box',  
  284. 'is_box' => true,  
  285. ),  
  286. array( 
  287. 'name' => __( 'Search Mode', 'woocommerce-predictive-search' ),  
  288. 'desc' => '</span><span class="description predictive_search_mode_strict">' . __( "STRICT MODE will return exact match results. Example if user types 'out' the results will include all items that have 'out' at the start of a word such as 'outside', 'outsized' etc. This gives 100% relevant results every time but can lead to a lot of 'Nothing Found' results depending on how customers search your site.", 'woocommerce-predictive-search' ) . '</span>' 
  289. . '<span class="description predictive_search_mode_broad">' . __( "BROAD MODE just like Strict mode will return results that have the search term at the start but will also search within a word. Example if user types 'out' all items that have 'out' at the start will be returned plus all that have 'out' within a word such as 'fadeout', 'about' etc. Results are not as accurate as STRICT MODE but there will be less 'Nothing Found' results.", 'woocommerce-predictive-search' ) . '</span><span>',  
  290. 'class' => 'predictive_search_mode',  
  291. 'id' => 'predictive_search_mode',  
  292. 'type' => 'switcher_checkbox',  
  293. 'default' => 'broad',  
  294. 'checked_value' => 'strict',  
  295. 'unchecked_value' => 'broad',  
  296. 'checked_label' => __( 'STRICT', 'woocommerce-predictive-search' ),  
  297. 'unchecked_label' => __( 'BROAD', 'woocommerce-predictive-search' ),  
  298. ),  
  299.  
  300. array( 
  301. 'name' => __('Search Page Configuration', 'woocommerce-predictive-search' ),  
  302. 'type' => 'heading',  
  303. 'desc' => ( class_exists('SitePress') ) ? __('Predictive Search has detected the WPML plugin. On install a search page was auto created for each language in use. Please use the WPML String Translations plugin to make translation for plugin text for each page. If adding another language after installing Predictive Search you have to manually create a search page for it.', 'woocommerce-predictive-search' ) : __('A search results page needs to be selected so that WooCommerce Predictive Search knows where to show search results. This page should have been created upon installation of the plugin, if not you need to create it.', 'woocommerce-predictive-search' ),  
  304. 'id' => 'predictive_search_page_configuration_box',  
  305. 'is_box' => true,  
  306. ),  
  307. array( 
  308. 'name' => __( 'Search Page', 'woocommerce-predictive-search' ),  
  309. 'desc' => __('Page contents:', 'woocommerce-predictive-search' ).' [woocommerce_search]',  
  310. 'id' => 'woocommerce_search_page_id',  
  311. 'type' => 'single_select_page',  
  312. ),  
  313.  
  314. array( 
  315. 'name' => __( 'Predictive Search Focus Keywords', 'woocommerce-predictive-search' ),  
  316. 'desc' => '<img class="rwd_image_maps" src="'.WOOPS_IMAGES_URL.'/premium-focus-keywords.png" usemap="#focusKeywordsMap" style="width: auto; max-width: 100%;" border="0" /> 
  317. <map name="focusKeywordsMap" id="focusKeywordsMap"> 
  318. <area shape="rect" coords="370, 340, 875, 405" href="'.$this->pro_plugin_page_url.'" target="_blank" /> 
  319. </map>',  
  320. 'type' => 'heading',  
  321. 'id' => 'predictive_search_focus_keywords_box',  
  322. 'is_box' => true,  
  323. ),  
  324.  
  325. array( 
  326. 'name' => __( 'Special Characters', 'woocommerce-predictive-search' ),  
  327. 'desc' => __( 'Select any special characters that are used on this site. Selecting a character will mean that results will be returned when user search input includes or excludes the special character. <strong>IMPORTANT!</strong> Do not turn this feature on unless needed. If ON - only select actual characters used in Product Titles, SKU, Category Names etc - each special character selected creates 1 extra query per search object, per product, post or page.', 'woocommerce-predictive-search' ),  
  328. 'type' => 'heading',  
  329. 'id' => 'predictive_search_special_characters_box',  
  330. 'is_box' => true,  
  331. ),  
  332. array( 
  333. 'name' => __( 'Special Character Function', 'woocommerce-predictive-search' ),  
  334. 'class' => 'woocommerce_search_remove_special_character',  
  335. 'id' => 'woocommerce_search_remove_special_character',  
  336. 'type' => 'onoff_checkbox',  
  337. 'default' => 'no',  
  338. 'checked_value' => 'yes',  
  339. 'unchecked_value' => 'no',  
  340. 'checked_label' => __( 'ON', 'woocommerce-predictive-search' ),  
  341. 'unchecked_label' => __( 'OFF', 'woocommerce-predictive-search' ),  
  342. ),  
  343.  
  344. array( 
  345. 'type' => 'heading',  
  346. 'class' => 'woocommerce_search_remove_special_character_container',  
  347. ),  
  348. array( 
  349. 'name' => __( 'Character Syntax', 'woocommerce-predictive-search' ),  
  350. 'id' => 'woocommerce_search_replace_special_character',  
  351. 'type' => 'onoff_radio',  
  352. 'default' => 'remove',  
  353. 'onoff_options' => array( 
  354. array( 
  355. 'val' => 'ignore',  
  356. 'text' => __( 'IGNORE. ON to ignore or skip over special characters in the string.', 'woocommerce-predictive-search' ),  
  357. 'checked_label' => __( 'ON', 'woocommerce-predictive-search' ),  
  358. 'unchecked_label' => __( 'OFF', 'woocommerce-predictive-search' ),  
  359. ),  
  360. array( 
  361. 'val' => 'remove',  
  362. 'text' => __( 'REMOVE. ON to remove or see special characters as a space.', 'woocommerce-predictive-search' ).' <span class="description">('.__( 'recommended', 'woocommerce-predictive-search' ).')</span>' ,  
  363. 'checked_label' => __( 'ON', 'woocommerce-predictive-search' ),  
  364. 'unchecked_label' => __( 'OFF', 'woocommerce-predictive-search' ),  
  365. ),  
  366. array( 
  367. 'val' => 'both',  
  368. 'text' => __( 'BOTH. On to use ignore and remove for special characters.', 'woocommerce-predictive-search' ),  
  369. 'checked_label' => __( 'ON', 'woocommerce-predictive-search' ),  
  370. 'unchecked_label' => __( 'OFF', 'woocommerce-predictive-search' ),  
  371. ),  
  372. ),  
  373. ),  
  374.  
  375. array( 
  376. 'name' => __( "Select Characters", 'woocommerce-predictive-search' ),  
  377. 'id' => 'woocommerce_search_special_characters',  
  378. 'type' => 'multiselect',  
  379. 'css' => 'width:600px; min-height:80px;',  
  380. 'options' => WC_Predictive_Search_Functions::special_characters_list(),  
  381. ),  
  382.  
  383. array( 
  384. 'name' => __( 'Exclude From Predictive Search', 'woocommerce-predictive-search' ),  
  385. 'type' => 'heading',  
  386. 'id' => 'predictive_search_exclude_box',  
  387. 'is_box' => true,  
  388. ),  
  389. array( 
  390. 'name' => __( 'Exclude Out Of Stock', 'woocommerce-predictive-search' ),  
  391. 'desc' => __( 'ON to exclude out of stock products from search results', 'woocommerce-predictive-search' ),  
  392. 'class' => 'woocommerce_search_exclude_out_stock',  
  393. 'id' => 'woocommerce_search_exclude_out_stock',  
  394. 'type' => 'onoff_checkbox',  
  395. 'default' => 'yes',  
  396. 'checked_value' => 'yes',  
  397. 'unchecked_value' => 'no',  
  398. 'checked_label' => __( 'ON', 'woocommerce-predictive-search' ),  
  399. 'unchecked_label' => __( 'OFF', 'woocommerce-predictive-search' ),  
  400. ),  
  401. array(  
  402. 'name' => __( 'Exclude Products', 'woocommerce-predictive-search' ),  
  403. 'id' => 'woocommerce_search_exclude_products',  
  404. 'type' => 'multiselect',  
  405. 'placeholder' => __( 'Choose Products', 'woocommerce-predictive-search' ),  
  406. 'css' => 'width:600px; min-height:80px;',  
  407. 'options' => $all_products,  
  408. 'default' => $products_excluded,  
  409. ),  
  410. array(  
  411. 'name' => __( 'Exclude Posts', 'woocommerce-predictive-search' ),  
  412. 'id' => 'woocommerce_search_exclude_posts',  
  413. 'type' => 'multiselect',  
  414. 'placeholder' => __( 'Choose Posts', 'woocommerce-predictive-search' ),  
  415. 'css' => 'width:600px; min-height:80px;',  
  416. 'options' => $all_posts,  
  417. 'default' => $posts_excluded,  
  418. ),  
  419. array(  
  420. 'name' => __( 'Exclude Pages', 'woocommerce-predictive-search' ),  
  421. 'id' => 'woocommerce_search_exclude_pages',  
  422. 'type' => 'multiselect',  
  423. 'placeholder' => __( 'Choose Pages', 'woocommerce-predictive-search' ),  
  424. 'css' => 'width:600px; min-height:80px;',  
  425. 'options' => $all_pages,  
  426. 'default' => $pages_excluded,  
  427. ),  
  428.  
  429. array( 
  430. 'name' => __( 'Google Analytics Site Search Integration', 'woocommerce-predictive-search' ),  
  431. 'type' => 'heading',  
  432. 'desc' => '<img class="rwd_image_maps" src="'.WOOPS_IMAGES_URL.'/premium-google-analytics.png" usemap="#googleAnalyticsMap" style="width: auto; max-width: 100%;" border="0" /> 
  433. <map name="googleAnalyticsMap" id="googleAnalyticsMap"> 
  434. <area shape="rect" coords="500, 505, 915, 560" href="'.$this->pro_plugin_page_url.'" target="_blank" /> 
  435. </map>',  
  436. 'id' => 'predictive_search_google_analytics_box',  
  437. 'is_box' => true,  
  438. ),  
  439.  
  440. )); 
  441.  
  442. public function include_script() { 
  443. wp_enqueue_script( 'jquery-rwd-image-maps' ); 
  444. ?> 
  445. <script> 
  446. (function($) { 
  447.  
  448. $(document).ready(function() { 
  449.  
  450. if ( $("input.woocommerce_search_focus_enable:checked").val() != 'yes') { 
  451. $('.woocommerce_search_focus_plugin_container').css( {'visibility': 'hidden', 'height' : '0px', 'overflow' : 'hidden', 'margin-bottom' : '0px' } ); 
  452.  
  453. if ( $("input.woocommerce_search_remove_special_character:checked").val() != 'yes') { 
  454. $('.woocommerce_search_remove_special_character_container').css( {'visibility': 'hidden', 'height' : '0px', 'overflow' : 'hidden', 'margin-bottom' : '0px' } ); 
  455.  
  456. if ( $("input.predictive_search_mode:checked").val() != 'strict') { 
  457. $('.predictive_search_mode_strict').hide(); 
  458. } else { 
  459. $('.predictive_search_mode_broad').hide(); 
  460.  
  461. $(document).on( "a3rev-ui-onoff_checkbox-switch", '.woocommerce_search_focus_enable', function( event, value, status ) { 
  462. $('.woocommerce_search_focus_plugin_container').attr('style', 'display:none;'); 
  463. if ( status == 'true' ) { 
  464. $(".woocommerce_search_focus_plugin_container").slideDown(); 
  465. } else { 
  466. $(".woocommerce_search_focus_plugin_container").slideUp(); 
  467. }); 
  468.  
  469. $(document).on( "a3rev-ui-onoff_checkbox-switch", '.woocommerce_search_remove_special_character', function( event, value, status ) { 
  470. $('.woocommerce_search_remove_special_character_container').attr('style', 'display:none;'); 
  471. if ( status == 'true' ) { 
  472. $(".woocommerce_search_remove_special_character_container").slideDown(); 
  473. } else { 
  474. $(".woocommerce_search_remove_special_character_container").slideUp(); 
  475. }); 
  476.  
  477. $(document).on( "a3rev-ui-onoff_checkbox-switch", '.predictive_search_mode', function( event, value, status ) { 
  478. if ( status == 'true' ) { 
  479. $(".predictive_search_mode_strict").attr('style', 'display: inline;'); 
  480. $(".predictive_search_mode_broad").attr('style', 'display: none;'); 
  481. } else { 
  482. $(".predictive_search_mode_strict").attr('style', 'display: none;'); 
  483. $(".predictive_search_mode_broad").attr('style', 'display: inline;'); 
  484. }); 
  485.  
  486. }); 
  487.  
  488. })(jQuery); 
  489. </script> 
  490. <?php