Search Meter - Version 2.12

Version Description

  • When uninstalled, delete all options and data. (Thanks to Scott Allen)
  • Track searches made via ajax requests. (Thanks to tliebig)
Download this release

Release Info

Developer bennettmcelwee
Plugin Icon 128x128 Search Meter
Version 2.12
Comparing to
See all releases

Code changes from version 2.11 to 2.12

Files changed (3) hide show
  1. readme.txt +5 -2
  2. search-meter.php +10 -5
  3. uninstall.php +15 -0
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: bennettmcelwee
3
  Donate link: http://thunderguy.com/semicolon/donate/
4
  Tags: search, meter, search-meter, statistics, widget, admin, keywords, terms, search terms
5
  Requires at least: 3.2
6
- Tested up to: 4.3
7
- Stable tag: 2.10
8
 
9
  Search Meter tracks what your readers are searching for on your blog. View full details of recent searches or stats for the last day, week or month.
10
 
@@ -78,6 +78,9 @@ The [Search Meter home page](http://thunderguy.com/semicolon/wordpress/search-me
78
  1. The Search Meter administration interface, showing some of the reports available.
79
 
80
  == Changelog ==
 
 
 
81
 
82
  = 2.11 =
83
  * Settings for search history size and recording duplicates can now be altered in filters. See the code for details. (Thanks to Dan Harrison)
3
  Donate link: http://thunderguy.com/semicolon/donate/
4
  Tags: search, meter, search-meter, statistics, widget, admin, keywords, terms, search terms
5
  Requires at least: 3.2
6
+ Tested up to: 4.6
7
+ Stable tag: 2.11
8
 
9
  Search Meter tracks what your readers are searching for on your blog. View full details of recent searches or stats for the last day, week or month.
10
 
78
  1. The Search Meter administration interface, showing some of the reports available.
79
 
80
  == Changelog ==
81
+ = 2.12 =
82
+ * When uninstalled, delete all options and data. (Thanks to Scott Allen)
83
+ * Track searches made via ajax requests. (Thanks to tliebig)
84
 
85
  = 2.11 =
86
  * Settings for search history size and recording duplicates can now be altered in filters. See the code for details. (Thanks to Dan Harrison)
search-meter.php CHANGED
@@ -3,12 +3,12 @@
3
  Plugin Name: Search Meter
4
  Plugin URI: http://thunderguy.com/semicolon/wordpress/search-meter-wordpress-plugin/
5
  Description: Keeps track of what your visitors are searching for. After you have activated this plugin, you can check the Search Meter section in the Dashboard to see what your visitors are searching for on your blog.
6
- Version: 2.11
7
  Author: Bennett McElwee
8
  Author URI: http://thunderguy.com/semicolon/
9
  Donate link: http://thunderguy.com/semicolon/donate/
10
 
11
- $Revision: 1247517 $
12
 
13
 
14
  INSTRUCTIONS
@@ -30,7 +30,7 @@ INSTRUCTIONS
30
  Thanks to everyone who has suggested improvements. It takes a village to build a plugin.
31
 
32
 
33
- Copyright (C) 2005-15 Bennett McElwee (bennett at thunderguy dotcom)
34
 
35
  This program is free software; you can redistribute it and/or
36
  modify it under the terms of version 2 of the GNU General Public
@@ -50,8 +50,13 @@ function tguy_sm_array_value(&$array, $key) {
50
  return (is_array($array) && array_key_exists($key, $array)) ? $array[$key] : null;
51
  }
52
 
 
 
 
 
 
53
 
54
- if (is_admin()) {
55
  require_once dirname(__FILE__) . '/admin.php';
56
  register_activation_hook(__FILE__, 'tguy_sm_init');
57
  }
@@ -267,7 +272,7 @@ function tguy_sm_save_search($posts) {
267
 
268
  if (is_search()
269
  && !is_paged() // not the second or subsequent page of a previously-counted search
270
- && !is_admin() // not using the administration console
271
  && (0 === $tguy_sm_save_count || $record_duplicates)
272
  && (tguy_sm_array_value($_SERVER, 'HTTP_REFERER')) // proper referrer (otherwise could be search engine, cache...)
273
  ) {
3
  Plugin Name: Search Meter
4
  Plugin URI: http://thunderguy.com/semicolon/wordpress/search-meter-wordpress-plugin/
5
  Description: Keeps track of what your visitors are searching for. After you have activated this plugin, you can check the Search Meter section in the Dashboard to see what your visitors are searching for on your blog.
6
+ Version: 2.12
7
  Author: Bennett McElwee
8
  Author URI: http://thunderguy.com/semicolon/
9
  Donate link: http://thunderguy.com/semicolon/donate/
10
 
11
+ $Revision: 1400894 $
12
 
13
 
14
  INSTRUCTIONS
30
  Thanks to everyone who has suggested improvements. It takes a village to build a plugin.
31
 
32
 
33
+ Copyright (C) 2005-16 Bennett McElwee (bennett at thunderguy dotcom)
34
 
35
  This program is free software; you can redistribute it and/or
36
  modify it under the terms of version 2 of the GNU General Public
50
  return (is_array($array) && array_key_exists($key, $array)) ? $array[$key] : null;
51
  }
52
 
53
+ function tguy_is_admin_interface() {
54
+ // ajax requests return true for is_admin(), but they're not part of the admin UI
55
+ return is_admin() && ( ! defined('DOING_AJAX') || ! DOING_AJAX);
56
+ }
57
+
58
 
59
+ if (tguy_is_admin_interface()) {
60
  require_once dirname(__FILE__) . '/admin.php';
61
  register_activation_hook(__FILE__, 'tguy_sm_init');
62
  }
272
 
273
  if (is_search()
274
  && !is_paged() // not the second or subsequent page of a previously-counted search
275
+ && !tguy_is_admin_interface() // not using the administration console
276
  && (0 === $tguy_sm_save_count || $record_duplicates)
277
  && (tguy_sm_array_value($_SERVER, 'HTTP_REFERER')) // proper referrer (otherwise could be search engine, cache...)
278
  ) {
uninstall.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ Search Meter uninstaller
4
+ */
5
+
6
+ if (!defined( 'WP_UNINSTALL_PLUGIN')) {
7
+ exit();
8
+ }
9
+
10
+ delete_option('tguy_search_meter');
11
+ delete_site_option('tguy_search_meter');
12
+
13
+ global $wpdb;
14
+ $wpdb->query("DROP TABLE IF EXISTS {$wpdb->prefix}searchmeter");
15
+ $wpdb->query("DROP TABLE IF EXISTS {$wpdb->prefix}searchmeter_recent");