Advanced Woo Search - Version 2.48

Version Description

( 2022-02-21 ) = * Add - New admin notices about integrations * Update - Tested with WC 6.2 * Update - Integration for Woodmart theme * Update - Support for WCFM - WooCommerce Multivendor Marketplace plugin * Dev - Add aws_seamless_search_form_filter filter

Download this release

Release Info

Developer Mihail Barinov
Plugin Icon 128x128 Advanced Woo Search
Version 2.48
Comparing to
See all releases

Code changes from version 2.47 to 2.48

advanced-woo-search.php CHANGED
@@ -3,12 +3,12 @@
3
  /*
4
  Plugin Name: Advanced Woo Search
5
  Description: Advance ajax WooCommerce product search.
6
- Version: 2.47
7
  Author: ILLID
8
  Author URI: https://advanced-woo-search.com/
9
  Text Domain: advanced-woo-search
10
  WC requires at least: 3.0.0
11
- WC tested up to: 6.1.0
12
  */
13
 
14
 
@@ -85,8 +85,8 @@ final class AWS_Main {
85
  add_filter( 'wcml_multi_currency_ajax_actions', array( $this, 'add_wpml_ajax_actions' ) );
86
 
87
  if ( $this->get_settings('seamless') === 'true' ) {
88
- add_filter( 'get_search_form', array( $this, 'markup' ), 999999 );
89
- add_filter( 'get_product_search_form', array( $this, 'markup' ), 999999 );
90
  }
91
 
92
  }
@@ -96,7 +96,7 @@ final class AWS_Main {
96
  */
97
  private function define_constants() {
98
 
99
- $this->define( 'AWS_VERSION', '2.47' );
100
 
101
  $this->define( 'AWS_DIR', plugin_dir_path( AWS_FILE ) );
102
  $this->define( 'AWS_URL', plugin_dir_url( AWS_FILE ) );
@@ -126,6 +126,7 @@ final class AWS_Main {
126
  include_once( 'includes/widget.php' );
127
 
128
  // Admin
 
129
  include_once( 'includes/admin/class-aws-admin.php' );
130
  include_once( 'includes/admin/class-aws-admin-ajax.php' );
131
  include_once( 'includes/admin/class-aws-admin-fields.php' );
@@ -146,6 +147,23 @@ final class AWS_Main {
146
 
147
  }
148
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
149
  /*
150
  * Sort products
151
  */
3
  /*
4
  Plugin Name: Advanced Woo Search
5
  Description: Advance ajax WooCommerce product search.
6
+ Version: 2.48
7
  Author: ILLID
8
  Author URI: https://advanced-woo-search.com/
9
  Text Domain: advanced-woo-search
10
  WC requires at least: 3.0.0
11
+ WC tested up to: 6.2.0
12
  */
13
 
14
 
85
  add_filter( 'wcml_multi_currency_ajax_actions', array( $this, 'add_wpml_ajax_actions' ) );
86
 
87
  if ( $this->get_settings('seamless') === 'true' ) {
88
+ add_filter( 'get_search_form', array( $this, 'markup_filter' ), 999999 );
89
+ add_filter( 'get_product_search_form', array( $this, 'markup_filter' ), 999999 );
90
  }
91
 
92
  }
96
  */
97
  private function define_constants() {
98
 
99
+ $this->define( 'AWS_VERSION', '2.48' );
100
 
101
  $this->define( 'AWS_DIR', plugin_dir_path( AWS_FILE ) );
102
  $this->define( 'AWS_URL', plugin_dir_url( AWS_FILE ) );
126
  include_once( 'includes/widget.php' );
127
 
128
  // Admin
129
+ include_once( 'includes/admin/class-aws-admin-notices.php' );
130
  include_once( 'includes/admin/class-aws-admin.php' );
131
  include_once( 'includes/admin/class-aws-admin-ajax.php' );
132
  include_once( 'includes/admin/class-aws-admin-fields.php' );
147
 
148
  }
149
 
150
+ /*
151
+ * Filter search box markup
152
+ */
153
+ public function markup_filter( $search_form = '' ) {
154
+
155
+ $markup = $this->markup();
156
+
157
+ /**
158
+ * Filter search form markup for seamless integration
159
+ * @since 2.48
160
+ * @param string $markup New search form markup
161
+ * @param string $search_form Old search form markup
162
+ */
163
+ return apply_filters( 'aws_seamless_search_form_filter', $markup, $search_form );
164
+
165
+ }
166
+
167
  /*
168
  * Sort products
169
  */
includes/admin/class-aws-admin-notices.php ADDED
@@ -0,0 +1,196 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if ( ! defined( 'ABSPATH' ) ) {
4
+ exit;
5
+ }
6
+
7
+
8
+ if ( ! class_exists( 'AWS_Admin_Notices' ) ) :
9
+
10
+ /**
11
+ * Class for plugin admin panel
12
+ */
13
+ class AWS_Admin_Notices {
14
+
15
+ /**
16
+ * @var AWS_Admin_Notices The single instance of the class
17
+ */
18
+ protected static $_instance = null;
19
+
20
+ /**
21
+ * Main AWS_Admin_Notices Instance
22
+ *
23
+ * Ensures only one instance of AWS_Admin_Notices is loaded or can be loaded.
24
+ *
25
+ * @static
26
+ * @return AWS_Admin_Notices - Main instance
27
+ */
28
+ public static function instance() {
29
+ if ( is_null( self::$_instance ) ) {
30
+ self::$_instance = new self();
31
+ }
32
+ return self::$_instance;
33
+ }
34
+
35
+ /*
36
+ * Constructor
37
+ */
38
+ public function __construct() {
39
+
40
+ // Welcome notice
41
+ add_action( 'admin_notices', array( $this, 'display_welcome_header' ), 1 );
42
+
43
+ // Reindex notice
44
+ add_action( 'admin_notices', array( $this, 'display_reindex_message' ), 1 );
45
+
46
+ // Plugins integration notice
47
+ add_action( 'admin_notices', array( $this, 'plugins_integration_notice' ), 1 );
48
+
49
+ // Hide notices
50
+ add_action( 'admin_init', array( $this, 'hide_notices' ) );
51
+
52
+ }
53
+
54
+ /*
55
+ * Show notices about PRO plugin integrations
56
+ */
57
+ public function plugins_integration_notice() {
58
+
59
+ if ( ! current_user_can( 'manage_options' ) ) {
60
+ return;
61
+ }
62
+
63
+ if ( ! class_exists( 'WCFMmp' ) && ! class_exists('ACF') ) {
64
+ return;
65
+ }
66
+
67
+ $hide_option = get_option( 'aws_hide_int_notices' );
68
+ $notice_top_message = sprintf( __( 'Hi! Looks like you are using some plugins that have the advanced integration with %s. Please find more details below.', 'advanced-woo-search' ), '<b>Advanced Woo Search PRO</b>' );
69
+ $notice_message = '';
70
+ $notice_id = '';
71
+
72
+ if ( class_exists( 'WCFMmp' ) && ( ! $hide_option || array_search( 'wcfm', $hide_option ) === false ) ) {
73
+ $notice_message .= '<li>' . __( 'WCFM Multivendor Marketplace plugin.', 'advanced-woo-search' ) . ' <a target="_blank" href="https://advanced-woo-search.com/features/wcfm-plugin-support/?utm_source=wp-plugin&utm_medium=integration_notice&utm_campaign=wcfm">' . __( 'Learn more', 'advanced-woo-search' ) . '</a></li>';
74
+ $notice_id .= 'wcfm|';
75
+ }
76
+
77
+ if ( class_exists('ACF') && ( ! $hide_option || array_search( 'acf', $hide_option ) === false ) ) {
78
+ $notice_message .= '<li>' . __( 'Advanced Custom Fields ( ACF ) plugin.', 'advanced-woo-search' ) . ' <a target="_blank" href="https://advanced-woo-search.com/guide/acf-support/?utm_source=wp-plugin&utm_medium=integration_notice&utm_campaign=acf">' . __( 'Learn more', 'advanced-woo-search' ) . '</a></li>';
79
+ $notice_id .= 'acf|';
80
+ }
81
+
82
+ $notice_id = 'aws_hide_int_notices=' . urlencode( trim( $notice_id, '|' ) );
83
+
84
+ if ( $notice_message ) {
85
+
86
+ $check_timing = $this->check_activation_time();
87
+ if ( ! $check_timing ) {
88
+ return;
89
+ }
90
+
91
+ $current_page_url = function_exists('wc_get_current_admin_url') ? wc_get_current_admin_url() : esc_url( admin_url('admin.php?page=aws-options'));
92
+ $dismiss_link = strpos( $current_page_url, '?' ) === false ? $current_page_url . '?' : $current_page_url . '&';
93
+
94
+ $html = '';
95
+
96
+ $html .= '<div class="aws-integration-notice notice notice-success" style="position:relative;">';
97
+ $html .= '<div class="aws-integration-notice--content">';
98
+ $html .= '<h2>Advanced Woo Search: ' . __( 'Integrations for your plugins', 'advanced-woo-search' ) . '</h2>';
99
+ $html .= '<p>' . $notice_top_message. '</p>';
100
+ $html .= '<ul style="list-style:disc;padding-left:20px;margin:15px 0 18px;">' . $notice_message. '</ul>';
101
+ $html .= '<a href="https://advanced-woo-search.com/features/?utm_source=wp-plugin&utm_medium=integration_notice&utm_campaign=all_pro" target="_blank" class="button button-primary">' . __( 'All PRO Features', 'advanced-woo-search' ) . '</a>&nbsp;&nbsp;<a href="https://advanced-woo-search.com/pricing/?utm_source=wp-plugin&utm_medium=integration_notice&utm_campaign=pricing" target="_blank" class="button button-primary">' . __( 'View Pricing', 'advanced-woo-search' ) . '</a>';
102
+ $html .= '<div style="margin-bottom:15px;"></div>';
103
+ $html .= '<a href="' . $dismiss_link . $notice_id . '" title="' . __( 'Dismiss', 'advanced-woo-search' ) . '" style="color:#787c82;text-decoration:none;font-size:16px;position:absolute;top:0;right:1px;border:none;margin:0;padding:9px;background:0 0;cursor:pointer;"><span style="font-size:16px;" class="dashicons dashicons-dismiss"></span></a>';
104
+ $html .= '</div>';
105
+ $html .= '</div>';
106
+
107
+ echo $html;
108
+
109
+ }
110
+
111
+ }
112
+
113
+ /*
114
+ * Add welcome notice
115
+ */
116
+ public function display_welcome_header() {
117
+
118
+ if ( ! isset( $_GET['page'] ) || $_GET['page'] !== 'aws-options' ) {
119
+ return;
120
+ }
121
+
122
+ if ( ! current_user_can( 'manage_options' ) ) {
123
+ return;
124
+ }
125
+
126
+ $hide_notice = get_option( 'aws_hide_welcome_notice' );
127
+
128
+ if ( ! $hide_notice || $hide_notice === 'true' ) {
129
+ return;
130
+ }
131
+
132
+ echo AWS_Admin_Meta_Boxes::get_welcome_notice();
133
+
134
+ }
135
+
136
+ /*
137
+ * Add reindex notice after index options change
138
+ */
139
+ public function display_reindex_message() {
140
+
141
+ if ( ! isset( $_GET['page'] ) || $_GET['page'] !== 'aws-options' ) {
142
+ return;
143
+ }
144
+
145
+ if ( ! isset( $_POST["Submit"] ) || ! current_user_can( 'manage_options' ) ) {
146
+ return;
147
+ }
148
+
149
+ if ( isset( $_POST["index_variations"] ) || isset( $_POST["search_rule"] ) ) {
150
+ echo AWS_Admin_Meta_Boxes::get_reindex_notice();
151
+ }
152
+
153
+ }
154
+
155
+ /*
156
+ * Hide admin notices
157
+ */
158
+ public function hide_notices() {
159
+
160
+ if ( isset( $_GET['aws_hide_int_notices'] ) && $_GET['aws_hide_int_notices'] ) {
161
+ $option = strpos( $_GET['aws_hide_int_notices'], '|' ) !== false ? explode('|', $_GET['aws_hide_int_notices'] ) : array( $_GET['aws_hide_int_notices'] );
162
+ $option_current = get_option( 'aws_hide_int_notices' );
163
+ $option = $option_current ? array_merge( $option_current, $option ) : $option;
164
+ update_option( 'aws_hide_int_notices', $option, false );
165
+ }
166
+
167
+ }
168
+
169
+ /*
170
+ * Check plugin activation time
171
+ */
172
+ public function check_activation_time() {
173
+
174
+ $activation_time = get_option( 'aws_activation_time' );
175
+ $show_notices = false;
176
+
177
+ if ( ! $activation_time ) {
178
+ update_option( 'aws_activation_time', time(), 'no' );
179
+ } else {
180
+ $time_pass = time() - $activation_time;
181
+ $days_pass = (int) round((($time_pass/24)/60)/60);
182
+ if ( $days_pass && $days_pass > 7 ) {
183
+ $show_notices = true;
184
+ }
185
+ }
186
+
187
+ return $show_notices;
188
+
189
+ }
190
+
191
+ }
192
+
193
+ endif;
194
+
195
+
196
+ add_action( 'init', 'AWS_Admin_Notices::instance' );
includes/admin/class-aws-admin.php CHANGED
@@ -53,10 +53,6 @@ class AWS_Admin {
53
 
54
  add_action( 'admin_enqueue_scripts', array( &$this, 'admin_enqueue_scripts' ) );
55
 
56
- add_action( 'admin_notices', array( $this, 'display_welcome_header' ), 1 );
57
-
58
- add_action( 'admin_notices', array( $this, 'display_reindex_message' ), 1 );
59
-
60
  add_filter( 'submenu_file', array( $this, 'submenu_file' ), 10, 2 );
61
 
62
  add_filter( 'aws_admin_page_options_current', array( $this, 'check_sources_in_index' ), 1 );
@@ -227,48 +223,6 @@ class AWS_Admin {
227
 
228
  }
229
 
230
- /*
231
- * Add welcome notice
232
- */
233
- public function display_welcome_header() {
234
-
235
- if ( ! isset( $_GET['page'] ) || $_GET['page'] !== 'aws-options' ) {
236
- return;
237
- }
238
-
239
- if ( ! current_user_can( 'manage_options' ) ) {
240
- return;
241
- }
242
-
243
- $hide_notice = get_option( 'aws_hide_welcome_notice' );
244
-
245
- if ( ! $hide_notice || $hide_notice === 'true' ) {
246
- return;
247
- }
248
-
249
- echo AWS_Admin_Meta_Boxes::get_welcome_notice();
250
-
251
- }
252
-
253
- /*
254
- * Add reindex notice after index options change
255
- */
256
- public function display_reindex_message() {
257
-
258
- if ( ! isset( $_GET['page'] ) || $_GET['page'] !== 'aws-options' ) {
259
- return;
260
- }
261
-
262
- if ( ! isset( $_POST["Submit"] ) || ! current_user_can( 'manage_options' ) ) {
263
- return;
264
- }
265
-
266
- if ( isset( $_POST["index_variations"] ) || isset( $_POST["search_rule"] ) ) {
267
- echo AWS_Admin_Meta_Boxes::get_reindex_notice();
268
- }
269
-
270
- }
271
-
272
  }
273
 
274
  endif;
53
 
54
  add_action( 'admin_enqueue_scripts', array( &$this, 'admin_enqueue_scripts' ) );
55
 
 
 
 
 
56
  add_filter( 'submenu_file', array( $this, 'submenu_file' ), 10, 2 );
57
 
58
  add_filter( 'aws_admin_page_options_current', array( $this, 'check_sources_in_index' ), 1 );
223
 
224
  }
225
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
226
  }
227
 
228
  endif;
includes/class-aws-integrations.php CHANGED
@@ -116,6 +116,7 @@ if ( ! class_exists( 'AWS_Integrations' ) ) :
116
 
117
  if ( 'Woodmart' === $this->current_theme ) {
118
  add_action( 'wp_head', array( $this, 'woodmart_head_action' ) );
 
119
  }
120
 
121
  if ( 'Astra' === $this->current_theme ) {
@@ -860,6 +861,17 @@ if ( ! class_exists( 'AWS_Integrations' ) ) :
860
 
861
  <?php }
862
 
 
 
 
 
 
 
 
 
 
 
 
863
  /*
864
  * Astra theme form markup
865
  */
116
 
117
  if ( 'Woodmart' === $this->current_theme ) {
118
  add_action( 'wp_head', array( $this, 'woodmart_head_action' ) );
119
+ add_filter( 'aws_seamless_search_form_filter', array( $this, 'woodmart_seamless_search_form_filter' ), 10, 2 );
120
  }
121
 
122
  if ( 'Astra' === $this->current_theme ) {
861
 
862
  <?php }
863
 
864
+ /*
865
+ * Woodmart theme: Filter default search form markup
866
+ */
867
+ public function woodmart_seamless_search_form_filter( $markup, $search_form ) {
868
+ if ( strpos( $search_form, 'wd-search-full-screen' ) !== false ) {
869
+ $pattern = '/(<form[\s\S]*?<\/form>)/i';
870
+ $markup = preg_replace( $pattern, $markup, $search_form );
871
+ }
872
+ return $markup;
873
+ }
874
+
875
  /*
876
  * Astra theme form markup
877
  */
includes/modules/class-aws-wcfm.php CHANGED
@@ -82,7 +82,7 @@ if ( ! class_exists( 'AWS_WCFM' ) ) :
82
  $logo = '<img style="margin-right:4px;" width="24px" src="' . $store_logo . '" />';
83
  }
84
 
85
- $excerpt .= '<br><span style="margin-top:4px;display:block;" data-link="' . $store_url . '">' . $logo . $store_name . '</span>';
86
 
87
  }
88
 
82
  $logo = '<img style="margin-right:4px;" width="24px" src="' . $store_logo . '" />';
83
  }
84
 
85
+ $excerpt .= '<br><a style="margin-top:4px;display:block;" href="' . $store_url . '">' . $logo . $store_name . '</a>';
86
 
87
  }
88
 
languages/advanced-woo-search.pot CHANGED
@@ -793,4 +793,25 @@ msgid "AJAX search"
793
  msgstr ""
794
 
795
  msgid "Use or not live search feature."
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
796
  msgstr ""
793
  msgstr ""
794
 
795
  msgid "Use or not live search feature."
796
+ msgstr ""
797
+
798
+ msgid "Hi! Looks like you are using some plugins that have the advanced integration with %s. Please find more details below."
799
+ msgstr ""
800
+
801
+ msgid "WCFM Multivendor Marketplace plugin."
802
+ msgstr ""
803
+
804
+ msgid "Advanced Custom Fields ( ACF ) plugin."
805
+ msgstr ""
806
+
807
+ msgid "Integrations for your plugins"
808
+ msgstr ""
809
+
810
+ msgid "All PRO Features"
811
+ msgstr ""
812
+
813
+ msgid "View Pricing"
814
+ msgstr ""
815
+
816
+ msgid "Dismiss"
817
  msgstr ""
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_i
4
  Tags: widget, plugin, woocommerce, search, product search, woocommerce search, ajax search, live search, custom search, ajax, shortcode, better search, relevance search, relevant search, search by sku, search plugin, shop, store, wordpress search, wp ajax search, wp search, wp search plugin, sidebar, ecommerce, merketing, products, category search, instant-search, search highlight, woocommerce advanced search, woocommerce live search, WooCommerce Plugin, woocommerce product search
5
  Requires at least: 4.0
6
  Tested up to: 5.9
7
- Stable tag: 2.47
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -167,6 +167,13 @@ Yep. This plugin is always compatible with the latest version of Woocommerce?
167
 
168
  == Changelog ==
169
 
 
 
 
 
 
 
 
170
  = 2.47 ( 2022-02-07 ) =
171
  * Update - Do not close AJAX results block when clicking on results item
172
  * Update - Markup for AJAX search results
4
  Tags: widget, plugin, woocommerce, search, product search, woocommerce search, ajax search, live search, custom search, ajax, shortcode, better search, relevance search, relevant search, search by sku, search plugin, shop, store, wordpress search, wp ajax search, wp search, wp search plugin, sidebar, ecommerce, merketing, products, category search, instant-search, search highlight, woocommerce advanced search, woocommerce live search, WooCommerce Plugin, woocommerce product search
5
  Requires at least: 4.0
6
  Tested up to: 5.9
7
+ Stable tag: 2.48
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
167
 
168
  == Changelog ==
169
 
170
+ = 2.48 ( 2022-02-21 ) =
171
+ * Add - New admin notices about integrations
172
+ * Update - Tested with WC 6.2
173
+ * Update - Integration for Woodmart theme
174
+ * Update - Support for WCFM - WooCommerce Multivendor Marketplace plugin
175
+ * Dev - Add aws_seamless_search_form_filter filter
176
+
177
  = 2.47 ( 2022-02-07 ) =
178
  * Update - Do not close AJAX results block when clicking on results item
179
  * Update - Markup for AJAX search results
uninstall.php CHANGED
@@ -29,6 +29,7 @@ if ( ! function_exists( 'aws_is_plugin_installed' ) ) {
29
  delete_option( 'aws_settings' );
30
  delete_option( 'aws_plugin_ver' );
31
  delete_option( 'aws_reindex_version' );
 
32
 
33
  if ( ! aws_is_plugin_installed( 'advanced-woo-search-pro/advanced-woo-search-pro.php' ) ) {
34
  $wpdb->query( "DROP TABLE IF EXISTS " . $wpdb->prefix . "aws_index" );
29
  delete_option( 'aws_settings' );
30
  delete_option( 'aws_plugin_ver' );
31
  delete_option( 'aws_reindex_version' );
32
+ delete_option( 'aws_activation_time' );
33
 
34
  if ( ! aws_is_plugin_installed( 'advanced-woo-search-pro/advanced-woo-search-pro.php' ) ) {
35
  $wpdb->query( "DROP TABLE IF EXISTS " . $wpdb->prefix . "aws_index" );