Advanced Woo Search - Version 1.38

Version Description

  • Add 'Clear form' buttom for search form on mobile devices
  • Fix bug with not srtiped shortcodes on product description
  • Fix bug with aws_reindex_table action
Download this release

Release Info

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

Code changes from version 1.37 to 1.38

advanced-woo-search.php CHANGED
@@ -3,7 +3,7 @@
3
  /*
4
  Plugin Name: Advanced Woo Search
5
  Description: Advance ajax WooCommerce product search.
6
- Version: 1.37
7
  Author: ILLID
8
  Author URI: https://advanced-woo-search.com/
9
  Text Domain: aws
@@ -16,7 +16,7 @@ if ( ! defined( 'ABSPATH' ) ) {
16
  exit;
17
  }
18
 
19
- define( 'AWS_VERSION', '1.37' );
20
 
21
 
22
  define( 'AWS_DIR', dirname( __FILE__ ) );
3
  /*
4
  Plugin Name: Advanced Woo Search
5
  Description: Advance ajax WooCommerce product search.
6
+ Version: 1.38
7
  Author: ILLID
8
  Author URI: https://advanced-woo-search.com/
9
  Text Domain: aws
16
  exit;
17
  }
18
 
19
+ define( 'AWS_VERSION', '1.38' );
20
 
21
 
22
  define( 'AWS_DIR', dirname( __FILE__ ) );
assets/css/common.css CHANGED
@@ -48,11 +48,48 @@
48
  background-color: #fff;
49
  }
50
 
 
 
 
 
51
  .aws-container .aws-search-field:focus::-webkit-input-placeholder { color:transparent; }
52
  .aws-container .aws-search-field:focus:-moz-placeholder { color:transparent; }
53
  .aws-container .aws-search-field:focus::-moz-placeholder { color:transparent; }
54
  .aws-container .aws-search-field:focus:-ms-input-placeholder { color:transparent; }
55
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
56
  .aws-search-result {
57
  position: absolute;
58
  text-align: left;
48
  background-color: #fff;
49
  }
50
 
51
+ .aws-container .aws-show-clear .aws-search-field {
52
+ padding-right: 40px;
53
+ }
54
+
55
  .aws-container .aws-search-field:focus::-webkit-input-placeholder { color:transparent; }
56
  .aws-container .aws-search-field:focus:-moz-placeholder { color:transparent; }
57
  .aws-container .aws-search-field:focus::-moz-placeholder { color:transparent; }
58
  .aws-container .aws-search-field:focus:-ms-input-placeholder { color:transparent; }
59
 
60
+
61
+ /* Clear button */
62
+ .aws-container .aws-search-clear {
63
+ display: none;
64
+ position: absolute;
65
+ top: 0;
66
+ right: 0;
67
+ z-index: 2;
68
+ cursor: pointer;
69
+ color: #757575;
70
+ height: 100%;
71
+ width: 38px;
72
+ padding-left: 10px;
73
+ }
74
+ .aws-container .aws-search-clear span {
75
+ position: relative;
76
+ display: block;
77
+ font-size: 24px;
78
+ line-height: 24px;
79
+ top: 50%;
80
+ margin-top: -12px;
81
+ }
82
+
83
+ .aws-container .aws-show-clear.aws-form-active .aws-search-clear {
84
+ display: block;
85
+ }
86
+
87
+ .aws-container .aws-form-active.aws-processing .aws-search-clear {
88
+ display: none;
89
+ }
90
+
91
+
92
+
93
  .aws-search-result {
94
  position: absolute;
95
  text-align: left;
assets/js/common.js CHANGED
@@ -17,6 +17,8 @@
17
 
18
  $('body').append('<div id="aws-search-result-' + instance + '" class="aws-search-result" style="display: none;"></div>');
19
 
 
 
20
  setTimeout(function() { methods.resultLayout(); }, 500);
21
 
22
  },
@@ -35,6 +37,7 @@
35
  if ( searchFor === '' ) {
36
  $(d.resultBlock).html('').hide();
37
  methods.hideLoader();
 
38
  return;
39
  }
40
 
@@ -199,7 +202,7 @@
199
 
200
  showResultsBlock: function() {
201
  methods.resultLayout();
202
- $(d.resultBlock).show();
203
  },
204
 
205
  showLoader: function() {
@@ -210,6 +213,16 @@
210
  $searchForm.removeClass('aws-processing');
211
  },
212
 
 
 
 
 
 
 
 
 
 
 
213
  onFocus: function( event ) {
214
  if ( searchFor !== '' ) {
215
  methods.showResultsBlock();
@@ -218,7 +231,7 @@
218
 
219
  hideResults: function( event ) {
220
  if ( ! $(event.target).closest( ".aws-container" ).length ) {
221
- $(d.resultBlock).hide();
222
  }
223
  },
224
 
@@ -267,6 +280,18 @@
267
  catch (error) {
268
  }
269
  }
 
 
 
 
 
 
 
 
 
 
 
 
270
  }
271
 
272
  };
@@ -331,6 +356,15 @@
331
  });
332
 
333
 
 
 
 
 
 
 
 
 
 
334
  $(document).on( 'click', function (e) {
335
  methods.hideResults(e);
336
  });
17
 
18
  $('body').append('<div id="aws-search-result-' + instance + '" class="aws-search-result" style="display: none;"></div>');
19
 
20
+ methods.mobileClasses();
21
+
22
  setTimeout(function() { methods.resultLayout(); }, 500);
23
 
24
  },
37
  if ( searchFor === '' ) {
38
  $(d.resultBlock).html('').hide();
39
  methods.hideLoader();
40
+ methods.resultsHide();
41
  return;
42
  }
43
 
202
 
203
  showResultsBlock: function() {
204
  methods.resultLayout();
205
+ methods.resultsShow();
206
  },
207
 
208
  showLoader: function() {
213
  $searchForm.removeClass('aws-processing');
214
  },
215
 
216
+ resultsShow: function() {
217
+ $(d.resultBlock).show();
218
+ $searchForm.addClass('aws-form-active');
219
+ },
220
+
221
+ resultsHide: function() {
222
+ $(d.resultBlock).hide();
223
+ $searchForm.removeClass('aws-form-active');
224
+ },
225
+
226
  onFocus: function( event ) {
227
  if ( searchFor !== '' ) {
228
  methods.showResultsBlock();
231
 
232
  hideResults: function( event ) {
233
  if ( ! $(event.target).closest( ".aws-container" ).length ) {
234
+ methods.resultsHide();
235
  }
236
  },
237
 
280
  catch (error) {
281
  }
282
  }
283
+ },
284
+
285
+ mobileClasses: function() {
286
+ if ( methods.isMobile() ) {
287
+ $searchForm.addClass('aws-show-clear');
288
+ }
289
+ },
290
+
291
+ isMobile: function() {
292
+ var check = false;
293
+ (function(a){if(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(a.substr(0,4))) check = true;})(navigator.userAgent||navigator.vendor||window.opera);
294
+ return check;
295
  }
296
 
297
  };
356
  });
357
 
358
 
359
+ $searchForm.find('.aws-search-clear').on( 'click', function (e) {
360
+ $searchField.val('');
361
+ $searchField.focus();
362
+ methods.resultsHide();
363
+ $(d.resultBlock).html('');
364
+ searchFor = '';
365
+ });
366
+
367
+
368
  $(document).on( 'click', function (e) {
369
  methods.hideResults(e);
370
  });
includes/class-aws-helpers.php CHANGED
@@ -104,6 +104,14 @@ if ( ! class_exists( 'AWS_Helpers' ) ) :
104
 
105
  }
106
 
 
 
 
 
 
 
 
 
107
  }
108
 
109
  endif;
104
 
105
  }
106
 
107
+ /*
108
+ * Strip shortcodes
109
+ */
110
+ static public function strip_shortcodes( $str ) {
111
+ $str = preg_replace( '#\[[^\]]+\]#', '', $str );
112
+ return $str;
113
+ }
114
+
115
  }
116
 
117
  endif;
includes/class-aws-markup.php CHANGED
@@ -68,7 +68,10 @@ if ( ! class_exists( 'AWS_Markup' ) ) :
68
  }
69
  }
70
 
71
- $markup .= '<div class="aws-search-result" style="display: none;"></div>';
 
 
 
72
  $markup .= '</form>';
73
  $markup .= '</div>';
74
 
68
  }
69
  }
70
 
71
+ $markup .= '<div class="aws-search-clear">';
72
+ $markup .= '<span aria-label="Clear Search">×</span>';
73
+ $markup .= '</div>';
74
+
75
  $markup .= '</form>';
76
  $markup .= '</div>';
77
 
includes/class-aws-search.php CHANGED
@@ -379,6 +379,7 @@ if ( ! class_exists( 'AWS_Search' ) ) :
379
  $excerpt = AWS_Helpers::html2txt( $excerpt );
380
  $excerpt = str_replace('"', "'", $excerpt);
381
  $excerpt = strip_shortcodes( $excerpt );
 
382
  }
383
 
384
  if ( $mark_search_words === 'true' ) {
379
  $excerpt = AWS_Helpers::html2txt( $excerpt );
380
  $excerpt = str_replace('"', "'", $excerpt);
381
  $excerpt = strip_shortcodes( $excerpt );
382
+ $excerpt = AWS_Helpers::strip_shortcodes( $excerpt );
383
  }
384
 
385
  if ( $mark_search_words === 'true' ) {
includes/class-aws-table.php CHANGED
@@ -50,11 +50,11 @@ if ( ! class_exists( 'AWS_Table' ) ) :
50
  /*
51
  * Reindex plugin table
52
  */
53
- public function reindex_table( $return = false ) {
54
 
55
  global $wpdb;
56
 
57
- $index_meta = $_POST['data'];
58
  $status = false;
59
 
60
  // No current index going on. Let's start over
@@ -132,7 +132,7 @@ if ( ! class_exists( 'AWS_Table' ) ) :
132
 
133
  }
134
 
135
- if ( $return ) {
136
  return $index_meta;
137
  } else {
138
  wp_send_json_success( $index_meta );
@@ -145,8 +145,10 @@ if ( ! class_exists( 'AWS_Table' ) ) :
145
  */
146
  public function reindex_table_job() {
147
 
 
 
148
  do {
149
- $meta = $this->reindex_table( true );
150
  $offset = (int) isset( $meta['offset'] ) ? $meta['offset'] : 0;
151
  $start = (int) isset( $meta['start'] ) ? $meta['start'] : 0;
152
  } while ( !( $offset === 0 && ! $start ) );
@@ -321,8 +323,8 @@ if ( ! class_exists( 'AWS_Table' ) ) :
321
  $content = wp_encode_emoji( $content );
322
  }
323
 
324
- $content = $this->strip_shortcodes( $content );
325
- $excerpt = $this->strip_shortcodes( $excerpt );
326
 
327
  /**
328
  * Filters product title before it will be indexed.
@@ -391,8 +393,8 @@ if ( ! class_exists( 'AWS_Table' ) ) :
391
  $translated_content = apply_filters( 'the_content', get_post_field( 'post_content', $translated_post->ID ) );
392
  $translated_excerpt = get_post_field( 'post_excerpt', $translated_post->ID );
393
 
394
- $translated_content = $this->strip_shortcodes( $translated_content );
395
- $translated_excerpt = $this->strip_shortcodes( $translated_excerpt );
396
 
397
  $translated_post_data['terms']['title'] = $this->extract_terms( $translated_title );
398
  $translated_post_data['terms']['content'] = $this->extract_terms( $translated_content );
@@ -439,8 +441,8 @@ if ( ! class_exists( 'AWS_Table' ) ) :
439
  $translated_content = qtranxf_use( $current_lang, $product->get_description(), true, true );
440
  $translated_excerpt = qtranxf_use( $current_lang, $product->get_short_description(), true, true );
441
 
442
- $translated_content = $this->strip_shortcodes( $translated_content );
443
- $translated_excerpt = $this->strip_shortcodes( $translated_excerpt );
444
 
445
  $translated_post_data['terms']['title'] = $this->extract_terms( $translated_title );
446
  $translated_post_data['terms']['content'] = $this->extract_terms( $translated_content );
@@ -616,14 +618,6 @@ if ( ! class_exists( 'AWS_Table' ) ) :
616
 
617
  }
618
 
619
- /*
620
- * Strip shortcodes
621
- */
622
- private function strip_shortcodes( $content ) {
623
- $content = preg_replace( '#\[[^\]]+\]#', '', $content );
624
- return $content;
625
- }
626
-
627
  /*
628
  * Extract terms from content
629
  */
50
  /*
51
  * Reindex plugin table
52
  */
53
+ public function reindex_table( $data = false ) {
54
 
55
  global $wpdb;
56
 
57
+ $index_meta = $data ? $data : $_POST['data'];
58
  $status = false;
59
 
60
  // No current index going on. Let's start over
132
 
133
  }
134
 
135
+ if ( $data ) {
136
  return $index_meta;
137
  } else {
138
  wp_send_json_success( $index_meta );
145
  */
146
  public function reindex_table_job() {
147
 
148
+ $meta = 'start';
149
+
150
  do {
151
+ $meta = $this->reindex_table( $meta );
152
  $offset = (int) isset( $meta['offset'] ) ? $meta['offset'] : 0;
153
  $start = (int) isset( $meta['start'] ) ? $meta['start'] : 0;
154
  } while ( !( $offset === 0 && ! $start ) );
323
  $content = wp_encode_emoji( $content );
324
  }
325
 
326
+ $content = AWS_Helpers::strip_shortcodes( $content );
327
+ $excerpt = AWS_Helpers::strip_shortcodes( $excerpt );
328
 
329
  /**
330
  * Filters product title before it will be indexed.
393
  $translated_content = apply_filters( 'the_content', get_post_field( 'post_content', $translated_post->ID ) );
394
  $translated_excerpt = get_post_field( 'post_excerpt', $translated_post->ID );
395
 
396
+ $translated_content = AWS_Helpers::strip_shortcodes( $translated_content );
397
+ $translated_excerpt = AWS_Helpers::strip_shortcodes( $translated_excerpt );
398
 
399
  $translated_post_data['terms']['title'] = $this->extract_terms( $translated_title );
400
  $translated_post_data['terms']['content'] = $this->extract_terms( $translated_content );
441
  $translated_content = qtranxf_use( $current_lang, $product->get_description(), true, true );
442
  $translated_excerpt = qtranxf_use( $current_lang, $product->get_short_description(), true, true );
443
 
444
+ $translated_content = AWS_Helpers::strip_shortcodes( $translated_content );
445
+ $translated_excerpt = AWS_Helpers::strip_shortcodes( $translated_excerpt );
446
 
447
  $translated_post_data['terms']['title'] = $this->extract_terms( $translated_title );
448
  $translated_post_data['terms']['content'] = $this->extract_terms( $translated_content );
618
 
619
  }
620
 
 
 
 
 
 
 
 
 
621
  /*
622
  * Extract terms from content
623
  */
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: 4.9.4
7
- Stable tag: 1.37
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -77,6 +77,11 @@ Yep. This plugin is always compatible with the latest version of Woocommerce?
77
 
78
  == Changelog ==
79
 
 
 
 
 
 
80
  = 1.37 =
81
  * Add 'aws_indexed_content', 'aws_indexed_title', 'aws_indexed_excerpt' filters
82
 
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: 4.9.4
7
+ Stable tag: 1.38
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
77
 
78
  == Changelog ==
79
 
80
+ = 1.38 =
81
+ * Add 'Clear form' buttom for search form on mobile devices
82
+ * Fix bug with not srtiped shortcodes on product description
83
+ * Fix bug with aws_reindex_table action
84
+
85
  = 1.37 =
86
  * Add 'aws_indexed_content', 'aws_indexed_title', 'aws_indexed_excerpt' filters
87