Advanced Woo Search - Version 1.23

Version Description

  • Add 'Stop-words list' option
Download this release

Release Info

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

Code changes from version 1.22 to 1.23

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.22
7
  Author: ILLID
8
  Author URI: https://advanced-woo-search.com/
9
  Text Domain: aws
@@ -14,7 +14,7 @@ if ( ! defined( 'ABSPATH' ) ) {
14
  exit;
15
  }
16
 
17
- define( 'AWS_VERSION', '1.22' );
18
 
19
 
20
  define( 'AWS_DIR', dirname( __FILE__ ) );
3
  /*
4
  Plugin Name: Advanced Woo Search
5
  Description: Advance ajax WooCommerce product search.
6
+ Version: 1.23
7
  Author: ILLID
8
  Author URI: https://advanced-woo-search.com/
9
  Text Domain: aws
14
  exit;
15
  }
16
 
17
+ define( 'AWS_VERSION', '1.23' );
18
 
19
 
20
  define( 'AWS_DIR', dirname( __FILE__ ) );
assets/js/admin.js CHANGED
@@ -5,10 +5,9 @@ jQuery(document).ready(function ($) {
5
  var $reindexBtn = $('#aws-reindex .button');
6
  var $reindexProgress = $('#aws-reindex .reindex-progress');
7
  var $reindexCount = $('#aws-reindex-count strong');
8
- var syncStatus = 'sync';
9
- var processed = 0;
10
- var toProcess = 0;
11
- var processed = 0;
12
 
13
  var $clearCacheBtn = $('#aws-clear-cache .button');
14
 
@@ -18,7 +17,12 @@ jQuery(document).ready(function ($) {
18
 
19
  e.preventDefault();
20
 
 
 
 
 
21
  $reindexBlock.addClass('loading');
 
22
 
23
  sync();
24
 
5
  var $reindexBtn = $('#aws-reindex .button');
6
  var $reindexProgress = $('#aws-reindex .reindex-progress');
7
  var $reindexCount = $('#aws-reindex-count strong');
8
+ var syncStatus;
9
+ var processed;
10
+ var toProcess;
 
11
 
12
  var $clearCacheBtn = $('#aws-clear-cache .button');
13
 
17
 
18
  e.preventDefault();
19
 
20
+ syncStatus = 'sync';
21
+ toProcess = 0;
22
+ processed = 0;
23
+
24
  $reindexBlock.addClass('loading');
25
+ $reindexProgress.html ( processed + '%' );
26
 
27
  sync();
28
 
includes/class-aws-admin.php CHANGED
@@ -17,6 +17,27 @@ class AWS_Admin {
17
  */
18
  var $page_name = 'aws-options';
19
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20
  /*
21
  * Constructor
22
  */
@@ -183,7 +204,7 @@ class AWS_Admin {
183
  <tr valign="top">
184
  <th scope="row"><?php echo $value['name']; ?></th>
185
  <td>
186
- <textarea id="<?php echo $value['id']; ?>" name="<?php echo $value['id']; ?>" cols="45" rows="3"><?php print stripslashes( $plugin_options[ $value['id'] ] ); ?></textarea>
187
  <br><span class="description"><?php echo $value['desc']; ?></span>
188
  </td>
189
  </tr>
@@ -447,4 +468,4 @@ class AWS_Admin {
447
  endif;
448
 
449
 
450
- new AWS_Admin();
17
  */
18
  var $page_name = 'aws-options';
19
 
20
+ /**
21
+ * @var AWS_Admin The single instance of the class
22
+ */
23
+ protected static $_instance = null;
24
+
25
+
26
+ /**
27
+ * Main AWS_Admin Instance
28
+ *
29
+ * Ensures only one instance of AWS_Admin is loaded or can be loaded.
30
+ *
31
+ * @static
32
+ * @return AWS_Admin - Main instance
33
+ */
34
+ public static function instance() {
35
+ if ( is_null( self::$_instance ) ) {
36
+ self::$_instance = new self();
37
+ }
38
+ return self::$_instance;
39
+ }
40
+
41
  /*
42
  * Constructor
43
  */
204
  <tr valign="top">
205
  <th scope="row"><?php echo $value['name']; ?></th>
206
  <td>
207
+ <textarea id="<?php echo $value['id']; ?>" name="<?php echo $value['id']; ?>" cols="65" rows="4"><?php print stripslashes( $plugin_options[ $value['id'] ] ); ?></textarea>
208
  <br><span class="description"><?php echo $value['desc']; ?></span>
209
  </td>
210
  </tr>
468
  endif;
469
 
470
 
471
+ add_action( 'init', 'AWS_Admin::instance' );
includes/class-aws-table.php CHANGED
@@ -489,6 +489,8 @@ if ( ! class_exists( 'AWS_Table' ) ) :
489
  */
490
  private function extract_terms( $str ) {
491
 
 
 
492
  $str = AWS_Helpers::html2txt( $str );
493
 
494
  // Avoid single A-Z.
@@ -569,6 +571,22 @@ if ( ! class_exists( 'AWS_Table' ) ) :
569
 
570
  $str_array = array_count_values( explode( ' ', $str ) );
571
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
572
  return $str_array;
573
 
574
  }
489
  */
490
  private function extract_terms( $str ) {
491
 
492
+ $stopwords = AWS()->get_settings( 'stopwords' );
493
+
494
  $str = AWS_Helpers::html2txt( $str );
495
 
496
  // Avoid single A-Z.
571
 
572
  $str_array = array_count_values( explode( ' ', $str ) );
573
 
574
+
575
+ if ( $stopwords && $str_array && ! empty( $str_array ) ) {
576
+ $stopwords_array = explode( ',', $stopwords );
577
+ if ( $stopwords_array && ! empty( $stopwords_array ) ) {
578
+ $stopwords_array = array_map( 'trim', $stopwords_array );
579
+
580
+ foreach ( $str_array as $str_word => $str_count ) {
581
+ if ( in_array( $str_word, $stopwords_array ) ) {
582
+ unset( $str_array[$str_word] );
583
+ }
584
+ }
585
+
586
+ }
587
+ }
588
+
589
+
590
  return $str_array;
591
 
592
  }
includes/class-aws-versions.php CHANGED
@@ -47,7 +47,7 @@ if ( ! class_exists( 'AWS_Versions' ) ) :
47
  add_action( 'admin_notices', array( $this, 'admin_notice_no_index' ) );
48
  }
49
 
50
- if ( $reindex_version && version_compare( $reindex_version, '1.16', '<' ) ) {
51
  add_action( 'admin_notices', array( $this, 'admin_notice_reindex' ) );
52
  }
53
 
@@ -92,6 +92,19 @@ if ( ! class_exists( 'AWS_Versions' ) ) :
92
 
93
  }
94
 
 
 
 
 
 
 
 
 
 
 
 
 
 
95
  }
96
 
97
  update_option( 'aws_plugin_ver', AWS_VERSION );
47
  add_action( 'admin_notices', array( $this, 'admin_notice_no_index' ) );
48
  }
49
 
50
+ if ( $reindex_version && version_compare( $reindex_version, '1.23', '<' ) ) {
51
  add_action( 'admin_notices', array( $this, 'admin_notice_reindex' ) );
52
  }
53
 
92
 
93
  }
94
 
95
+ if ( version_compare( $current_version, '1.23', '<' ) ) {
96
+
97
+ $settings = get_option( 'aws_settings' );
98
+
99
+ if ( $settings ) {
100
+ if ( ! isset( $settings['stopwords'] ) ) {
101
+ $settings['stopwords'] = 'a, about, above, across, after, afterwards, again, against, all, almost, alone, along, already, also, although, always, am, among, amongst, amoungst, amount, an, and, another, any, anyhow, anyone, anything, anyway, anywhere, are, around, as, at, back, be, became, because, become, becomes, becoming, been, before, beforehand, behind, being, below, beside, besides, between, beyond, bill, both, bottom, but, by, call, can, cannot, cant, co, con, could, couldnt, cry, de, describe, detail, do, done, down, due, during, each, eg, eight, either, eleven, else, elsewhere, empty, enough, etc, even, ever, every, everyone, everything, everywhere, except, few, fifteen, fify, fill, find, fire, first, five, for, former, formerly, forty, found, four, from, front, full, further, get, give, go, had, has, hasnt, have, he, hence, her, here, hereafter, hereby, herein, hereupon, hers, herself, him, himself, his, how, however, hundred, ie, if, in, inc, indeed, interest, into, is, it, its, itself, keep, last, latter, latterly, least, less, ltd, made, many, may, me, meanwhile, might, mill, mine, more, moreover, most, mostly, move, much, must, my, myself, name, namely, neither, never, nevertheless, next, nine, no, nobody, none, noone, nor, not, nothing, now, nowhere, of, off, often, on, once, one, only, onto, or, other, others, otherwise, our, ours, ourselves, out, over, own, part, per, perhaps, please, put, rather, re, same, see, seem, seemed, seeming, seems, serious, several, she, should, show, side, since, sincere, six, sixty, so, some, somehow, someone, something, sometime, sometimes, somewhere, still, such, system, take, ten, than, that, the, their, them, themselves, then, thence, there, thereafter, thereby, therefore, therein, thereupon, these, they, thickv, thin, third, this, those, though, three, through, throughout, thru, thus, to, together, too, top, toward, towards, twelve, twenty, two, un, under, until, up, upon, us, very, via, was, we, well, were, what, whatever, when, whence, whenever, where, whereafter, whereas, whereby, wherein, whereupon, wherever, whether, which, while, whither, who, whoever, whole, whom, whose, why, will, with, within, without, would, yet, you, your, yours, yourself, yourselves';
102
+ update_option( 'aws_settings', $settings );
103
+ }
104
+ }
105
+
106
+ }
107
+
108
  }
109
 
110
  update_option( 'aws_plugin_ver', AWS_VERSION );
includes/options.php CHANGED
@@ -38,6 +38,14 @@ $options['general'][] = array(
38
  )
39
  );
40
 
 
 
 
 
 
 
 
 
41
  $options['general'][] = array(
42
  "name" => __( "Use Google Analytics", "aws" ),
43
  "desc" => __( "Use google analytics to track searches. You need google analytics to be installed on your site.", "aws" ) . '<br>' . __( "Will send event with category - 'AWS search', action - 'AWS Search Term' and label of value of search term.", "aws" ),
38
  )
39
  );
40
 
41
+ $options['general'][] = array(
42
+ "name" => __( "Stop words list", "aws" ),
43
+ "desc" => __( "Comma separated list of words that will be excluded from search.", "aws" ) . '<br>' . __( "Re-index required on change.", "aws" ),
44
+ "id" => "stopwords",
45
+ "value" => "a, about, above, across, after, afterwards, again, against, all, almost, alone, along, already, also, although, always, am, among, amongst, amoungst, amount, an, and, another, any, anyhow, anyone, anything, anyway, anywhere, are, around, as, at, back, be, became, because, become, becomes, becoming, been, before, beforehand, behind, being, below, beside, besides, between, beyond, bill, both, bottom, but, by, call, can, cannot, cant, co, con, could, couldnt, cry, de, describe, detail, do, done, down, due, during, each, eg, eight, either, eleven, else, elsewhere, empty, enough, etc, even, ever, every, everyone, everything, everywhere, except, few, fifteen, fify, fill, find, fire, first, five, for, former, formerly, forty, found, four, from, front, full, further, get, give, go, had, has, hasnt, have, he, hence, her, here, hereafter, hereby, herein, hereupon, hers, herself, him, himself, his, how, however, hundred, ie, if, in, inc, indeed, interest, into, is, it, its, itself, keep, last, latter, latterly, least, less, ltd, made, many, may, me, meanwhile, might, mill, mine, more, moreover, most, mostly, move, much, must, my, myself, name, namely, neither, never, nevertheless, next, nine, no, nobody, none, noone, nor, not, nothing, now, nowhere, of, off, often, on, once, one, only, onto, or, other, others, otherwise, our, ours, ourselves, out, over, own, part, per, perhaps, please, put, rather, re, same, see, seem, seemed, seeming, seems, serious, several, she, should, show, side, since, sincere, six, sixty, so, some, somehow, someone, something, sometime, sometimes, somewhere, still, such, system, take, ten, than, that, the, their, them, themselves, then, thence, there, thereafter, thereby, therefore, therein, thereupon, these, they, thickv, thin, third, this, those, though, three, through, throughout, thru, thus, to, together, too, top, toward, towards, twelve, twenty, two, un, under, until, up, upon, us, very, via, was, we, well, were, what, whatever, when, whence, whenever, where, whereafter, whereas, whereby, wherein, whereupon, wherever, whether, which, while, whither, who, whoever, whole, whom, whose, why, will, with, within, without, would, yet, you, your, yours, yourself, yourselves",
46
+ "type" => "textarea"
47
+ );
48
+
49
  $options['general'][] = array(
50
  "name" => __( "Use Google Analytics", "aws" ),
51
  "desc" => __( "Use google analytics to track searches. You need google analytics to be installed on your site.", "aws" ) . '<br>' . __( "Will send event with category - 'AWS search', action - 'AWS Search Term' and label of value of search term.", "aws" ),
languages/aws.pot CHANGED
@@ -295,6 +295,15 @@ msgstr ""
295
  msgid "Show out-of-stock products in search"
296
  msgstr ""
297
 
 
 
 
 
 
 
 
 
 
298
  #: includes/options.php:42
299
  msgid "Use Google Analytics"
300
  msgstr ""
295
  msgid "Show out-of-stock products in search"
296
  msgstr ""
297
 
298
+ msgid "Stop words list"
299
+ msgstr ""
300
+
301
+ msgid "Comma separated list of words that will be excluded from search."
302
+ msgstr ""
303
+
304
+ msgid "Re-index required on change."
305
+ msgstr ""
306
+
307
  #: includes/options.php:42
308
  msgid "Use Google Analytics"
309
  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: 4.8.1
7
- Stable tag: 1.22
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -74,6 +74,9 @@ Yep. This plugin is always compatible with the latest version of Woocommerce?
74
 
75
  == Changelog ==
76
 
 
 
 
77
  = 1.22 =
78
  * Fix reindex bug
79
  * Hide empty taxonomies from 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: 4.8.1
7
+ Stable tag: 1.23
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
74
 
75
  == Changelog ==
76
 
77
+ = 1.23 =
78
+ * Add 'Stop-words list' option
79
+
80
  = 1.22 =
81
  * Fix reindex bug
82
  * Hide empty taxonomies from search results