Search Everything - Version 4.2.1

Version Description

Download this release

Release Info

Developer dancameron
Plugin Icon wp plugin Search Everything
Version 4.2.1
Comparing to
See all releases

Code changes from version 4.2 to 4.2.1

Files changed (3) hide show
  1. SE-Admin.php +1 -1
  2. readme.txt +2 -2
  3. search_everything.php +19 -20
SE-Admin.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  Class SearchEverythingAdmin {
4
 
5
- var $version = '4.2';
6
 
7
  function SearchEverythingAdmin() {
8
 
2
 
3
  Class SearchEverythingAdmin {
4
 
5
+ var $version = '4.2.1';
6
 
7
  function SearchEverythingAdmin() {
8
 
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://www.amazon.com/gp/registry/wishlist/3EM84J7FVHE6S/ref=wl_web
4
  Tags: search, comment search, page search, admin, seo
5
  Requires at least: 2.1
6
  Tested up to: 2.3
7
- Stable tag: 4.2
8
 
9
  Increases Wordpress' default search functionality through an options panel. Options include searching pages, excerpts, attachments, drafts, comments and custom fields (metadata).
10
 
@@ -30,7 +30,7 @@ Search Everything increases the ability of the default Wordpress Search, options
30
 
31
  == Update Log ==
32
 
33
- * 4.2 - Full 2.3 Support with Tag Searching and Category Exclusion
34
  * 4.1 - Major Plugin Architecture change, better localization support
35
  * 4.0.3 - Localization pot and Turkish translation (props Baris Unver)
36
  * 4.0.2 - CSS Bug fix - minor
4
  Tags: search, comment search, page search, admin, seo
5
  Requires at least: 2.1
6
  Tested up to: 2.3
7
+ Stable tag: 4.1
8
 
9
  Increases Wordpress' default search functionality through an options panel. Options include searching pages, excerpts, attachments, drafts, comments and custom fields (metadata).
10
 
30
 
31
  == Update Log ==
32
 
33
+ * 4.2 - Full 2.3 Support with Tag Searching and Category Exclusion. Major Performance tweaks for searching tags and comments (4.2.1).
34
  * 4.1 - Major Plugin Architecture change, better localization support
35
  * 4.0.3 - Localization pot and Turkish translation (props Baris Unver)
36
  * 4.0.2 - CSS Bug fix - minor
search_everything.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Search Everything
4
  Plugin URI: http://dancameron.org/wordpress/
5
  Description: Adds search functionality with little setup. Including options to search pages, excerpts, attachments, drafts, comments, tags and custom fields (metadata). Also offers the ability to exclude specific pages and posts. Does not search password-protected content.
6
- Version: 4.2
7
  Author: Dan Cameron
8
  Author URI: http://dancameron.org/
9
  */
@@ -80,12 +80,7 @@ Class SearchEverything {
80
 
81
  if ("true" == $this->options['SE4_exclude_categories']) {
82
  add_filter('posts_where', array(&$this, 'SE4_exclude_categories'));
83
- if ($this->wp_ver23) {
84
- if ("true" != $this->options['SE4_use_tag_search'])
85
- add_filter('posts_join', array(&$this, 'SE4_terms_join'));
86
- }
87
- else
88
- add_filter('posts_join', array(&$this, 'SE4_exclude_categories_join'));
89
  $this->SE4_log("searching excluding categories");
90
  }
91
 
@@ -99,7 +94,7 @@ Class SearchEverything {
99
  if ($this->logging) {
100
  $fp = fopen("logfile.log","a+");
101
  $date = date("Y-m-d H:i:s ");
102
- $source = "search_everythin plugin: ";
103
  fwrite($fp, "\n\n".$date."\n".$source."\n".$msg);
104
  fclose($fp);
105
  }
@@ -214,7 +209,7 @@ Class SearchEverything {
214
  global $wp_query, $wpdb;
215
  if (!empty($wp_query->query_vars['s'])) {
216
  if ($this->wp_ver23)
217
- $where .= " OR ($wpdb->posts.ID = m.post_id AND m.meta_value LIKE '%" . $wpdb->escape($wp_query->query_vars['s']) . "%') ";
218
  else
219
  $where .= " OR meta_value LIKE '%" . $wpdb->escape($wp_query->query_vars['s']) . "%' ";
220
  }
@@ -228,8 +223,8 @@ Class SearchEverything {
228
  function SE4_search_tags($where) {
229
  global $wp_query, $wpdb;
230
  if (!empty($wp_query->query_vars['s'])) {
231
- $where .= " OR ( $wpdb->posts.ID = rel.object_id AND rel.term_taxonomy_id = tax.term_taxonomy_id AND tax.term_id = ter.term_id AND tax.taxonomy = 'post_tag' AND ter.slug LIKE '%" . $wpdb->escape($wp_query->query_vars['s']) . "%') ";
232
- }
233
 
234
  $this->SE4_log("tags where: ".$where);
235
 
@@ -241,12 +236,12 @@ Class SearchEverything {
241
  global $wp_query, $wpdb;
242
  if (!empty($wp_query->query_vars['s'])) {
243
  if (trim($this->options['SE4_exclude_categories_list']) != '') {
244
- $excl_list = implode(',', explode(',', trim($this->options['SE4_exclude_categories_list'])));
245
  $where = str_replace('"', '\'', $where);
246
  $where = 'AND ('.substr($where, strpos($where, 'AND')+3).' )';
247
  if ($this->wp_ver23)
248
- $where .= " AND ( $wpdb->posts.ID = rel.object_id AND rel.term_taxonomy_id = tax.term_taxonomy_id AND tax.taxonomy = 'category' AND (tax.term_id NOT IN ( ".$excl_list." )) OR ($wpdb->posts.ID = rel.object_id AND rel.term_taxonomy_id = tax.term_taxonomy_id AND tax.taxonomy = 'post_tag' )) ";
249
- else
250
  $where .= ' AND (c.category_id NOT IN ( '.$excl_list.' ))';
251
  }
252
  }
@@ -261,7 +256,11 @@ Class SearchEverything {
261
 
262
  if (!empty($wp_query->query_vars['s'])) {
263
 
264
- $join .= "LEFT JOIN $wpdb->post2cat AS c ON $wpdb->posts.ID = c.post_id";
 
 
 
 
265
  }
266
  $this->SE4_log("category join: ".$join);
267
  return $join;
@@ -274,8 +273,8 @@ Class SearchEverything {
274
  if (!empty($wp_query->query_vars['s'])) {
275
 
276
  if ($this->wp_ver23) {
277
- $join .= " ,$wpdb->comments AS c ";
278
- } else {
279
 
280
  if ('true' == $this->options['SE4_approved_comments_only']) {
281
  $comment_approved = " AND comment_approved = '1'";
@@ -299,7 +298,7 @@ Class SearchEverything {
299
  if (!empty($wp_query->query_vars['s'])) {
300
 
301
  if ($this->wp_ver23)
302
- $join .= " ,$wpdb->postmeta AS m ";
303
  else
304
  $join .= "LEFT JOIN $wpdb->postmeta ON $wpdb->posts.ID = $wpdb->postmeta.post_id ";
305
  }
@@ -312,8 +311,8 @@ Class SearchEverything {
312
  global $wp_query, $wpdb;
313
 
314
  if (!empty($wp_query->query_vars['s'])) {
315
- $join .= " , $wpdb->terms AS ter, $wpdb->term_relationships AS rel, $wpdb->term_taxonomy AS tax ";
316
- }
317
 
318
  $this->SE4_log("tags join: ".$join);
319
  return $join;
3
  Plugin Name: Search Everything
4
  Plugin URI: http://dancameron.org/wordpress/
5
  Description: Adds search functionality with little setup. Including options to search pages, excerpts, attachments, drafts, comments, tags and custom fields (metadata). Also offers the ability to exclude specific pages and posts. Does not search password-protected content.
6
+ Version: 4.2.1
7
  Author: Dan Cameron
8
  Author URI: http://dancameron.org/
9
  */
80
 
81
  if ("true" == $this->options['SE4_exclude_categories']) {
82
  add_filter('posts_where', array(&$this, 'SE4_exclude_categories'));
83
+ add_filter('posts_join', array(&$this, 'SE4_exclude_categories_join'));
 
 
 
 
 
84
  $this->SE4_log("searching excluding categories");
85
  }
86
 
94
  if ($this->logging) {
95
  $fp = fopen("logfile.log","a+");
96
  $date = date("Y-m-d H:i:s ");
97
+ $source = "search_everything plugin: ";
98
  fwrite($fp, "\n\n".$date."\n".$source."\n".$msg);
99
  fclose($fp);
100
  }
209
  global $wp_query, $wpdb;
210
  if (!empty($wp_query->query_vars['s'])) {
211
  if ($this->wp_ver23)
212
+ $where .= " OR (m.meta_value LIKE '%" . $wpdb->escape($wp_query->query_vars['s']) . "%') ";
213
  else
214
  $where .= " OR meta_value LIKE '%" . $wpdb->escape($wp_query->query_vars['s']) . "%' ";
215
  }
223
  function SE4_search_tags($where) {
224
  global $wp_query, $wpdb;
225
  if (!empty($wp_query->query_vars['s'])) {
226
+ $where .= " OR ( tter.slug LIKE '%" . $wpdb->escape($wp_query->query_vars['s']) . "%') ";
227
+ }
228
 
229
  $this->SE4_log("tags where: ".$where);
230
 
236
  global $wp_query, $wpdb;
237
  if (!empty($wp_query->query_vars['s'])) {
238
  if (trim($this->options['SE4_exclude_categories_list']) != '') {
239
+ $excl_list = implode("','", explode(',', "'".trim($this->options['SE4_exclude_categories_list'])."'" ));
240
  $where = str_replace('"', '\'', $where);
241
  $where = 'AND ('.substr($where, strpos($where, 'AND')+3).' )';
242
  if ($this->wp_ver23)
243
+ $where .= " AND ( ctax.term_id NOT IN ( ".$excl_list." ))";
244
+ else
245
  $where .= ' AND (c.category_id NOT IN ( '.$excl_list.' ))';
246
  }
247
  }
256
 
257
  if (!empty($wp_query->query_vars['s'])) {
258
 
259
+ if ($this->wp_ver23) {
260
+ $join .= " LEFT JOIN $wpdb->term_relationships AS crel ON ($wpdb->posts.ID = crel.object_id) LEFT JOIN $wpdb->term_taxonomy AS ctax ON (ctax.taxonomy = 'category' AND crel.term_taxonomy_id = ctax.term_taxonomy_id) LEFT JOIN $wpdb->terms AS cter ON (ctax.term_id = cter.term_id) ";
261
+ } else {
262
+ $join .= "LEFT JOIN $wpdb->post2cat AS c ON $wpdb->posts.ID = c.post_id";
263
+ }
264
  }
265
  $this->SE4_log("category join: ".$join);
266
  return $join;
273
  if (!empty($wp_query->query_vars['s'])) {
274
 
275
  if ($this->wp_ver23) {
276
+ $join .= " LEFT JOIN $wpdb->comments AS c ON ( comment_post_ID = ID " . $comment_approved . ") ";
277
+ } else {
278
 
279
  if ('true' == $this->options['SE4_approved_comments_only']) {
280
  $comment_approved = " AND comment_approved = '1'";
298
  if (!empty($wp_query->query_vars['s'])) {
299
 
300
  if ($this->wp_ver23)
301
+ $join .= " LEFT JOIN $wpdb->postmeta AS m ON ($wpdb->posts.ID = m.post_id) ";
302
  else
303
  $join .= "LEFT JOIN $wpdb->postmeta ON $wpdb->posts.ID = $wpdb->postmeta.post_id ";
304
  }
311
  global $wp_query, $wpdb;
312
 
313
  if (!empty($wp_query->query_vars['s'])) {
314
+ $join .= " LEFT JOIN $wpdb->term_relationships AS trel ON ($wpdb->posts.ID = trel.object_id) LEFT JOIN $wpdb->term_taxonomy AS ttax ON (ttax.taxonomy = 'post_tag' AND trel.term_taxonomy_id = ttax.term_taxonomy_id) LEFT JOIN $wpdb->terms AS tter ON (ttax.term_id = tter.term_id) ";
315
+ }
316
 
317
  $this->SE4_log("tags join: ".$join);
318
  return $join;