Search Everything - Version 8.1

Version Description

  • Fixed link search bug
  • Fixed bug of limiting number of results in Research Everything
  • Improved code robustness
  • Fixed translation system
  • Fixed upgrade bug
  • Renamed methods with too generic names
  • Fixed admin notices - they're only visible to admins now
Download this release

Release Info

Developer sparkica
Plugin Icon wp plugin Search Everything
Version 8.1
Comparing to
See all releases

Code changes from version 8 to 8.1

Files changed (58) hide show
  1. config.php +22 -11
  2. css/admin.css +0 -14
  3. lang/{se-ar_AR.mo → SearchEverything-ar_AR.mo} +0 -0
  4. lang/{se-ar_AR.po → SearchEverything-ar_AR.po} +0 -0
  5. lang/{se-by_BY.mo → SearchEverything-by_BY.mo} +0 -0
  6. lang/{se-by_BY.po → SearchEverything-by_BY.po} +0 -0
  7. lang/{se-da_DK.mo → SearchEverything-da_DK.mo} +0 -0
  8. lang/{se-da_DK.po → SearchEverything-da_DK.po} +0 -0
  9. lang/{se-de_DE.mo → SearchEverything-de_DE.mo} +0 -0
  10. lang/{se-de_DE.po → SearchEverything-de_DE.po} +0 -0
  11. lang/{se-es_ES.mo → SearchEverything-es_ES.mo} +0 -0
  12. lang/{se-es_ES.po → SearchEverything-es_ES.po} +0 -0
  13. lang/{se-fr_FR.mo → SearchEverything-fr_FR.mo} +0 -0
  14. lang/{se-fr_FR.po → SearchEverything-fr_FR.po} +0 -0
  15. lang/{se-hu_HU.mo → SearchEverything-hu_HU.mo} +0 -0
  16. lang/{se-hu_HU.po → SearchEverything-hu_HU.po} +0 -0
  17. lang/{se-it_IT.mo → SearchEverything-it_IT.mo} +0 -0
  18. lang/{se-it_IT.po → SearchEverything-it_IT.po} +0 -0
  19. lang/{se-ja.mo → SearchEverything-ja.mo} +0 -0
  20. lang/{se-ja.po → SearchEverything-ja.po} +0 -0
  21. lang/{se-ko_KR.mo.html → SearchEverything-ko_KR.mo} +0 -0
  22. lang/{se-ko_KR.po.html → SearchEverything-ko_KR.po} +0 -0
  23. lang/{se-lv_LV.mo → SearchEverything-lv_LV.mo} +0 -0
  24. lang/{se-lv_LV.po → SearchEverything-lv_LV.po} +0 -0
  25. lang/{se-nl_NL.mo → SearchEverything-nl_NL.mo} +0 -0
  26. lang/{se-nl.po → SearchEverything-nl_NL.po} +2 -2
  27. lang/{se-nn_NO.mo → SearchEverything-nn_NO.mo} +0 -0
  28. lang/{se-nn_NO.po → SearchEverything-nn_NO.po} +0 -0
  29. lang/{se-no_NO.mo → SearchEverything-no_NO.mo} +0 -0
  30. lang/{se-no_NO.po → SearchEverything-no_NO.po} +0 -0
  31. lang/{se-pl_PL.mo → SearchEverything-pl_PL.mo} +0 -0
  32. lang/{se-pl_PL.po → SearchEverything-pl_PL.po} +0 -0
  33. lang/{se-ro_RO.mo → SearchEverything-ro_RO.mo} +0 -0
  34. lang/{se-ro_RO.po → SearchEverything-ro_RO.po} +0 -0
  35. lang/{se-ru_RU.mo → SearchEverything-ru_RU.mo} +0 -0
  36. lang/{se-ru_RU.po → SearchEverything-ru_RU.po} +0 -0
  37. lang/{se-sv_SE.mo → SearchEverything-sv_SE.mo} +0 -0
  38. lang/{se-sv_SE.po → SearchEverything-sv_SE.po} +0 -0
  39. lang/{se-tr_TR.mo → SearchEverything-tr_TR.mo} +0 -0
  40. lang/{se-tr_TR.po → SearchEverything-tr_TR.po} +0 -0
  41. lang/{se-zh_CN.mo → SearchEverything-zh_CN.mo} +0 -0
  42. lang/{se-zh_CN.po → SearchEverything-zh_CN.po} +0 -0
  43. lang/{se-zh_TW.mo → SearchEverything-zh_TW.mo} +0 -0
  44. lang/{se-zh_TW.po → SearchEverything-zh_TW.po} +0 -0
  45. lang/{se.mo → SearchEverything.mo} +0 -0
  46. lang/{se.pot → SearchEverything.pot} +0 -0
  47. options.php +24 -7
  48. readme.txt +32 -10
  49. screenshot-1.png +0 -0
  50. screenshot-2.png +0 -0
  51. screenshot-3.png +0 -0
  52. search-everything.php +28 -16
  53. static/css/admin.css +1 -1
  54. static/img/search.png +0 -0
  55. static/js/searcheverything.js +268 -14
  56. views/global_head.php +3 -0
  57. views/global_notice.php +1 -1
  58. views/options_page.php +7 -7
config.php CHANGED
@@ -75,16 +75,11 @@ function se_update_options($new_options) {
75
  }
76
 
77
  function se_set_global_notice() {
78
- $url = admin_url( 'options-general.php' );
79
- $url = add_query_arg( array(
80
- 'page' => 'extend_search',
81
- 'se_global_notice' => 0,
82
- ), $url );
83
-
84
  $se_meta = get_option('se_meta', false);
85
  $se_meta['se_global_notice'] = array(
86
- 'title' => 'Search everything has been updated with security fixes!',
87
- 'message' => 'Search Everything has been upgraded with security updates and some exciting new features. Visit <a href="'.$url.'">settings</a> to learn more.'
88
  );
89
  se_update_meta($se_meta);
90
  }
@@ -114,6 +109,24 @@ function se_upgrade() {
114
  }
115
  }
116
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
117
  function se_migrate_7_0_4() {
118
  $se_meta = get_option('se_meta', false);
119
 
@@ -125,7 +138,7 @@ function se_migrate_7_0_4() {
125
  $se_options = get_option('se_options', false);
126
 
127
  //enable external search
128
- $se_options['se_research_widget'] = array (
129
  'visible_on_compose' => true,
130
  'external_search_enabled' => false,
131
  'notice_visible' => true,
@@ -134,8 +147,6 @@ function se_migrate_7_0_4() {
134
 
135
  update_option('se_meta',$se_meta);
136
  update_option('se_options',$se_options);
137
-
138
- se_set_global_notice();
139
  }
140
 
141
  function se_migrate_7_0_3() {
75
  }
76
 
77
  function se_set_global_notice() {
78
+ $url = 'http://zem.si/1l7q5KS';
 
 
 
 
 
79
  $se_meta = get_option('se_meta', false);
80
  $se_meta['se_global_notice'] = array(
81
+ 'title' => 'Searching for your car keys?',
82
+ 'message' => 'Well, there are some things our plugin can\'t search for - your car keys, your wallet, a soulmate and <strong>unregistered custom post types</strong> :) <br> It searches for almost everything else, but it also does some other amazing stuff, like ... research. <a href="'.$url.'" target="_blank">Check it out!</a>'
83
  );
84
  se_update_meta($se_meta);
85
  }
109
  }
110
  }
111
 
112
+ function se_migrate_8_0() {
113
+ $se_meta = get_option('se_meta', false);
114
+ $se_meta['version'] = '8.1';
115
+ update_option('se_meta', $se_meta);
116
+
117
+ $se_options = get_option('se_options', false);
118
+ if (empty($se_options['se_research_metabox'])) {
119
+ $se_options['se_research_metabox'] = array (
120
+ 'visible_on_compose' => true,
121
+ 'external_search_enabled' => false,
122
+ 'notice_visible' => true,
123
+ );
124
+ }
125
+ update_option('se_options',$se_options);
126
+
127
+ se_set_global_notice();
128
+ }
129
+
130
  function se_migrate_7_0_4() {
131
  $se_meta = get_option('se_meta', false);
132
 
138
  $se_options = get_option('se_options', false);
139
 
140
  //enable external search
141
+ $se_options['se_research_metabox'] = array (
142
  'visible_on_compose' => true,
143
  'external_search_enabled' => false,
144
  'notice_visible' => true,
147
 
148
  update_option('se_meta',$se_meta);
149
  update_option('se_options',$se_options);
 
 
150
  }
151
 
152
  function se_migrate_7_0_3() {
css/admin.css DELETED
@@ -1,14 +0,0 @@
1
- .thanks {width:400px; }
2
- .thanks p {padding-left:20px; padding-right:20px;}
3
- .info { background: #FFFFCC; border: 1px dotted #D8D2A9; padding: 10px; color: #333; }
4
- .info a { color: #333; text-decoration: none; border-bottom: 1px dotted #333 }
5
- .info a:hover { color: #666; border-bottom: 1px dotted #666; }
6
-
7
- #se-basic-settings,#se-advanced-settings, #se-test-search, #se-info {margin-top: 20px;}
8
- #se-basic-settings .manage-column, #se-advanced-settings .manage-column {font-weight:bold;}
9
- #se-basic-settings.widefat, #se-advanced-settings.widefat,#se-test-search.widefat, #se-info.widefat {width:80%;}
10
- .se-col {width:350px;}
11
- .se-suboption label { font-size: smaller;margin-left:10px; color:#666;}
12
-
13
- #se-top-notice {width:80%; position:relative;}
14
- #se-top-notice .updated {margin:0;}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
lang/{se-ar_AR.mo → SearchEverything-ar_AR.mo} RENAMED
File without changes
lang/{se-ar_AR.po → SearchEverything-ar_AR.po} RENAMED
File without changes
lang/{se-by_BY.mo → SearchEverything-by_BY.mo} RENAMED
File without changes
lang/{se-by_BY.po → SearchEverything-by_BY.po} RENAMED
File without changes
lang/{se-da_DK.mo → SearchEverything-da_DK.mo} RENAMED
File without changes
lang/{se-da_DK.po → SearchEverything-da_DK.po} RENAMED
File without changes
lang/{se-de_DE.mo → SearchEverything-de_DE.mo} RENAMED
File without changes
lang/{se-de_DE.po → SearchEverything-de_DE.po} RENAMED
File without changes
lang/{se-es_ES.mo → SearchEverything-es_ES.mo} RENAMED
File without changes
lang/{se-es_ES.po → SearchEverything-es_ES.po} RENAMED
File without changes
lang/{se-fr_FR.mo → SearchEverything-fr_FR.mo} RENAMED
File without changes
lang/{se-fr_FR.po → SearchEverything-fr_FR.po} RENAMED
File without changes
lang/{se-hu_HU.mo → SearchEverything-hu_HU.mo} RENAMED
File without changes
lang/{se-hu_HU.po → SearchEverything-hu_HU.po} RENAMED
File without changes
lang/{se-it_IT.mo → SearchEverything-it_IT.mo} RENAMED
File without changes
lang/{se-it_IT.po → SearchEverything-it_IT.po} RENAMED
File without changes
lang/{se-ja.mo → SearchEverything-ja.mo} RENAMED
File without changes
lang/{se-ja.po → SearchEverything-ja.po} RENAMED
File without changes
lang/{se-ko_KR.mo.html → SearchEverything-ko_KR.mo} RENAMED
File without changes
lang/{se-ko_KR.po.html → SearchEverything-ko_KR.po} RENAMED
File without changes
lang/{se-lv_LV.mo → SearchEverything-lv_LV.mo} RENAMED
File without changes
lang/{se-lv_LV.po → SearchEverything-lv_LV.po} RENAMED
File without changes
lang/{se-nl_NL.mo → SearchEverything-nl_NL.mo} RENAMED
File without changes
lang/{se-nl.po → SearchEverything-nl_NL.po} RENAMED
@@ -3,8 +3,8 @@ msgstr ""
3
  "Project-Id-Version: Search Everything\n"
4
  "POT-Creation-Date: \n"
5
  "PO-Revision-Date: 2008-07-16 17:36+0100\n"
6
- "Last-Translator: Joeke-Remkus de Vries <jr@de-fries.nl>\n"
7
- "Language-Team: I-Dimensie <7@idimensie.nl>\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=UTF-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
3
  "Project-Id-Version: Search Everything\n"
4
  "POT-Creation-Date: \n"
5
  "PO-Revision-Date: 2008-07-16 17:36+0100\n"
6
+ "Last-Translator: Remkus de Vries <remkus@forsitemedia.nl>\n"
7
+ "Language-Team: Forsite Media <remkus@forsitemedia.nl>\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=UTF-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
lang/{se-nn_NO.mo → SearchEverything-nn_NO.mo} RENAMED
File without changes
lang/{se-nn_NO.po → SearchEverything-nn_NO.po} RENAMED
File without changes
lang/{se-no_NO.mo → SearchEverything-no_NO.mo} RENAMED
File without changes
lang/{se-no_NO.po → SearchEverything-no_NO.po} RENAMED
File without changes
lang/{se-pl_PL.mo → SearchEverything-pl_PL.mo} RENAMED
File without changes
lang/{se-pl_PL.po → SearchEverything-pl_PL.po} RENAMED
File without changes
lang/{se-ro_RO.mo → SearchEverything-ro_RO.mo} RENAMED
File without changes
lang/{se-ro_RO.po → SearchEverything-ro_RO.po} RENAMED
File without changes
lang/{se-ru_RU.mo → SearchEverything-ru_RU.mo} RENAMED
File without changes
lang/{se-ru_RU.po → SearchEverything-ru_RU.po} RENAMED
File without changes
lang/{se-sv_SE.mo → SearchEverything-sv_SE.mo} RENAMED
File without changes
lang/{se-sv_SE.po → SearchEverything-sv_SE.po} RENAMED
File without changes
lang/{se-tr_TR.mo → SearchEverything-tr_TR.mo} RENAMED
File without changes
lang/{se-tr_TR.po → SearchEverything-tr_TR.po} RENAMED
File without changes
lang/{se-zh_CN.mo → SearchEverything-zh_CN.mo} RENAMED
File without changes
lang/{se-zh_CN.po → SearchEverything-zh_CN.po} RENAMED
File without changes
lang/{se-zh_TW.mo → SearchEverything-zh_TW.mo} RENAMED
File without changes
lang/{se-zh_TW.po → SearchEverything-zh_TW.po} RENAMED
File without changes
lang/{se.mo → SearchEverything.mo} RENAMED
File without changes
lang/{se.pot → SearchEverything.pot} RENAMED
File without changes
options.php CHANGED
@@ -1,14 +1,20 @@
1
  <?php
2
 
3
  Class se_admin {
 
 
 
 
4
 
5
  function se_admin() {
6
  // Load language file
7
  $locale = get_locale();
8
  $meta = se_get_meta();
9
  $options = se_get_options();
10
- if ( !empty($locale) )
11
- load_textdomain('SearchEverything', SE_PLUGIN_DIR .'lang/se-'.$locale.'.mo');
 
 
12
 
13
  add_action( 'admin_enqueue_scripts', array(&$this,'se_register_plugin_scripts_and_styles'));
14
  add_action( 'admin_menu', array(&$this, 'se_add_options_panel'));
@@ -92,7 +98,6 @@ Class se_admin {
92
  //build admin interface
93
  function se_option_page() {
94
  global $wpdb, $table_prefix, $wp_version;
95
-
96
  $new_options = array(
97
  'se_exclude_categories' => (isset($_POST['exclude_categories']) && !empty($_POST['exclude_categories'])) ? $_POST['exclude_categories'] : '',
98
  'se_exclude_categories_list' => (isset($_POST['exclude_categories_list']) && !empty($_POST['exclude_categories_list'])) ? $_POST['exclude_categories_list'] : '',
@@ -140,6 +145,9 @@ Class se_admin {
140
  $meta['api_key'] = $api_key;
141
  se_update_meta($meta);
142
  }
 
 
 
143
 
144
  $response_messages = se_get_response_messages();
145
  $external_message = "";
@@ -180,7 +188,7 @@ Class se_admin {
180
  */
181
  function fetch_api_key()
182
  {
183
- $response = api(array(
184
  'method' => 'zemanta.auth.create_user',
185
  'partner_id' => 'wordpress-se'
186
  ));
@@ -205,15 +213,15 @@ function fetch_api_key()
205
  *
206
  * @param array $arguments Arguments to pass to the API
207
  */
208
- function api($arguments)
209
  {
210
  $meta = se_get_meta();
211
 
212
  $api_key = $meta['api_key'] ? $meta['api_key'] : '';
213
-
214
  $arguments = array_merge($arguments, array(
215
  'api_key'=> $api_key
216
- ));
217
 
218
  if (!isset($arguments['format']))
219
  {
@@ -241,4 +249,13 @@ function get_sfid() {
241
  }
242
  }
243
  return array(null, $response_state);
 
 
 
 
 
 
 
 
 
244
  }
1
  <?php
2
 
3
  Class se_admin {
4
+
5
+ function se_localization() {
6
+ load_plugin_textdomain('SearchEverything', false, dirname(plugin_basename( __FILE__ )) . '/lang/');
7
+ }
8
 
9
  function se_admin() {
10
  // Load language file
11
  $locale = get_locale();
12
  $meta = se_get_meta();
13
  $options = se_get_options();
14
+
15
+ if ( !empty($locale) ) {
16
+ add_action('admin_init', array(&$this, 'se_localization'));
17
+ }
18
 
19
  add_action( 'admin_enqueue_scripts', array(&$this,'se_register_plugin_scripts_and_styles'));
20
  add_action( 'admin_menu', array(&$this, 'se_add_options_panel'));
98
  //build admin interface
99
  function se_option_page() {
100
  global $wpdb, $table_prefix, $wp_version;
 
101
  $new_options = array(
102
  'se_exclude_categories' => (isset($_POST['exclude_categories']) && !empty($_POST['exclude_categories'])) ? $_POST['exclude_categories'] : '',
103
  'se_exclude_categories_list' => (isset($_POST['exclude_categories_list']) && !empty($_POST['exclude_categories_list'])) ? $_POST['exclude_categories_list'] : '',
145
  $meta['api_key'] = $api_key;
146
  se_update_meta($meta);
147
  }
148
+ if ($options['se_research_metabox']['external_search_enabled'] && !empty($meta['api_key'])) {
149
+ se_get_prefs();
150
+ }
151
 
152
  $response_messages = se_get_response_messages();
153
  $external_message = "";
188
  */
189
  function fetch_api_key()
190
  {
191
+ $response = se_api(array(
192
  'method' => 'zemanta.auth.create_user',
193
  'partner_id' => 'wordpress-se'
194
  ));
213
  *
214
  * @param array $arguments Arguments to pass to the API
215
  */
216
+ function se_api($arguments)
217
  {
218
  $meta = se_get_meta();
219
 
220
  $api_key = $meta['api_key'] ? $meta['api_key'] : '';
221
+
222
  $arguments = array_merge($arguments, array(
223
  'api_key'=> $api_key
224
+ ));
225
 
226
  if (!isset($arguments['format']))
227
  {
249
  }
250
  }
251
  return array(null, $response_state);
252
+ }
253
+
254
+ function se_get_prefs() {
255
+ $meta = se_get_meta();
256
+ $zemanta_response = se_api(array(
257
+ 'method' => 'zemanta.preferences',
258
+ 'format' => 'json',
259
+ 'interface' => 'wordpress-se'
260
+ ));
261
  }
readme.txt CHANGED
@@ -1,9 +1,9 @@
1
  === Plugin Name ===
2
  Contributors: zemanta
3
- Tags: search, search highlight, tag search, category search, category exclusion, comment search, page search, admin, seo, post filter
4
- Requires at least: 3
5
- Tested up to: 3.8.1
6
- Stable tag: 8.0
7
 
8
  Search Everything increases WordPress' default search functionality in three easy steps.
9
 
@@ -16,7 +16,7 @@ From Jan 24, 2014 Search Everything originaly developed by dancameron, sproutven
16
 
17
  Search Everything improves WordPress default search functionality without modifying any of the template pages. You can configure it to search pages, excerpts, attachments, drafts, comments, tags and custom fields (metadata) and you can specify your own search highlight style. It also offers the ability to exclude specific pages and posts. It does not search password-protected content. Simply install, configure... and search.
18
 
19
- **NEW:*** Search Everything plugin now includes a writing helper called Research Everything which let’s you search for your posts and link to them while writing. You can also enable Power Search to research posts from the wider web.
20
 
21
  = Better WordPress search in three steps =
22
 
@@ -38,7 +38,7 @@ Search Everything increases the ability of the default Wordpress Search, options
38
  * Search only approved comments
39
  * Search Every Draft
40
  * Search Every Excerpt
41
- * Search Every Attachment (post type)
42
  * Search Every Custom Field (metadata)
43
  * Exclude Posts from search
44
  * Exclude Categories from search
@@ -51,21 +51,33 @@ Installation Instructions:
51
  2. Put the 'search-everything' directory into your wp-content/plugins/ directory.
52
  3. Go to the Plugins page in your WordPress Administration area and click 'Activate' next to Search Everything.
53
  4. Go to the Options > Search Everything and configure your settings.
54
- 5. That's it. You can search now.
55
 
56
 
57
  == Frequently Asked Questions ==
58
 
 
 
 
 
 
59
  = It doesn't work =
60
 
61
  Read the installation guide.
62
 
63
- = It *still* doesn't work (and you're certain there's a bug) =
 
 
 
 
 
 
64
 
65
- Please open a new issue at [github Issues](https://github.com/zemanta/search-everything-wordpress-plugin/issues "Github Issues")
66
 
67
  = What Translations are included? =
68
 
 
 
69
  * Arabic
70
  * Belarusian
71
  * China / Chinese
@@ -89,11 +101,21 @@ Please open a new issue at [github Issues](https://github.com/zemanta/search-eve
89
  == Screenshots ==
90
 
91
  1. Screenshot of the options panel
92
-
 
93
 
94
 
95
  == Changelog ==
96
 
 
 
 
 
 
 
 
 
 
97
  = 8.0 =
98
  * Added research widget on compose screen
99
  * Reorganized settings
1
  === Plugin Name ===
2
  Contributors: zemanta
3
+ Tags: search, search highlight, tag search, category search, category exclusion, comment search, page search, admin, seo, post filter, research
4
+ Requires at least: 3.6
5
+ Tested up to: 3.9
6
+ Stable tag: 8.1
7
 
8
  Search Everything increases WordPress' default search functionality in three easy steps.
9
 
16
 
17
  Search Everything improves WordPress default search functionality without modifying any of the template pages. You can configure it to search pages, excerpts, attachments, drafts, comments, tags and custom fields (metadata) and you can specify your own search highlight style. It also offers the ability to exclude specific pages and posts. It does not search password-protected content. Simply install, configure... and search.
18
 
19
+ Search Everything plugin now includes a writing helper called Research Everything that lets you search for your posts and link to them while writing. You can also enable Power Search to research posts from the wider web (for WP3.7 and above).
20
 
21
  = Better WordPress search in three steps =
22
 
38
  * Search only approved comments
39
  * Search Every Draft
40
  * Search Every Excerpt
41
+ * Search Every Attachment (post type, not the content itself - check FAQ)
42
  * Search Every Custom Field (metadata)
43
  * Exclude Posts from search
44
  * Exclude Categories from search
51
  2. Put the 'search-everything' directory into your wp-content/plugins/ directory.
52
  3. Go to the Plugins page in your WordPress Administration area and click 'Activate' next to Search Everything.
53
  4. Go to the Options > Search Everything and configure your settings.
54
+ 5. That's it. Enjoy searching.
55
 
56
 
57
  == Frequently Asked Questions ==
58
 
59
+ = It doesn't search in my PDF/Word/Excel attachments =
60
+
61
+ We know, this is not a bug. It's not that easy to search through binary files.
62
+ Anyway, if there's a will, there's a way. Just ask us for a workaround and we'll gladly help.
63
+
64
  = It doesn't work =
65
 
66
  Read the installation guide.
67
 
68
+ = It *still* doesn't work =
69
+
70
+ Please open a new support topic at our [Support page](http://wordpress.org/support/plugin/search-everything)
71
+
72
+ = I don't get any results in research tool =
73
+
74
+ Are you using WordPress 3.6? Sorry, but research tool requires at least version 3.7.
75
 
 
76
 
77
  = What Translations are included? =
78
 
79
+ Note: We changed some labels in settings, old translations might not work and need to be updated.
80
+
81
  * Arabic
82
  * Belarusian
83
  * China / Chinese
101
  == Screenshots ==
102
 
103
  1. Screenshot of the options panel
104
+ 2. Screenshot of the writing helper Research Everything
105
+ 3. Screenshot of a post with search results from the Research Everything writing helper
106
 
107
 
108
  == Changelog ==
109
 
110
+ = 8.1 =
111
+ * Fixed link search bug
112
+ * Fixed bug of limiting number of results in Research Everything
113
+ * Improved code robustness
114
+ * Fixed translation system
115
+ * Fixed upgrade bug
116
+ * Renamed methods with too generic names
117
+ * Fixed admin notices - they're only visible to admins now
118
+
119
  = 8.0 =
120
  * Added research widget on compose screen
121
  * Reorganized settings
screenshot-1.png CHANGED
Binary file
screenshot-2.png CHANGED
Binary file
screenshot-3.png CHANGED
Binary file
search-everything.php CHANGED
@@ -1,14 +1,14 @@
1
  <?php
2
  /*
3
  Plugin Name: Search Everything
4
- Plugin URI: https://github.com/Zemanta/search-everything-wordpress-plugin/
5
  Description: Adds search functionality without modifying any template pages: Activate, Configure and Search. Options Include: search highlight, 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: 8.0
7
  Author: Zemanta
8
  Author URI: http://www.zemanta.com
9
  */
10
 
11
- define('SE_VERSION', '8.0');
12
 
13
  if (!defined('SE_PLUGIN_FILE'))
14
  define('SE_PLUGIN_FILE', plugin_basename(__FILE__));
@@ -20,7 +20,7 @@ if (!defined('SE_PLUGIN_DIR'))
20
  define('SE_PLUGIN_DIR', WP_PLUGIN_DIR . '/' . SE_PLUGIN_NAME);
21
 
22
  if (!defined('SE_PLUGIN_URL'))
23
- define('SE_PLUGIN_URL', WP_PLUGIN_URL . '/' . SE_PLUGIN_NAME);
24
 
25
  if (!defined('SE_ZEMANTA_API_GATEWAY'))
26
  define('SE_ZEMANTA_API_GATEWAY', 'http://api.zemanta.com/services/rest/0.0/');
@@ -64,11 +64,18 @@ function se_admin_head() {
64
  $se_metabox = $se_options['se_research_metabox'];
65
  include(se_get_view('admin_head'));
66
  }
67
-
68
  add_action('admin_head', 'se_admin_head');
69
 
 
 
 
 
 
70
  function se_global_notice() {
71
  global $pagenow, $se_global_notice_pages;
 
 
 
72
 
73
  $se_meta = se_get_meta();
74
 
@@ -119,11 +126,13 @@ class SearchEverything {
119
  function init() {
120
  if ( current_user_can('manage_options') ) {
121
  $SEAdmin = new se_admin();
122
- // Disable Search-Everything, because posts_join is not working properly in Wordpress-backend's Ajax functions
123
- if (basename( $_SERVER["SCRIPT_NAME"] ) == "admin-ajax.php") {
124
- return true;
125
- }
126
  }
 
 
 
 
 
 
127
 
128
  $this->search_hooks();
129
 
@@ -137,6 +146,7 @@ class SearchEverything {
137
 
138
  function search_hooks() {
139
  //add filters based upon option settings
 
140
  if ( $this->options['se_use_tag_search'] || $this->options['se_use_category_search'] || $this->options['se_use_tax_search'] ) {
141
  add_filter( 'posts_join', array( &$this, 'se_terms_join' ) );
142
  if ( $this->options['se_use_tag_search'] ) {
@@ -787,7 +797,6 @@ class SearchEverything {
787
  }
788
  // build our final string
789
  $on = ' ( ' . implode( ' OR ', $on ) . ' ) ';
790
-
791
  $join .= " LEFT JOIN $wpdb->term_relationships AS trel ON ($wpdb->posts.ID = trel.object_id) LEFT JOIN $wpdb->term_taxonomy AS ttax ON ( " . $on . " AND trel.term_taxonomy_id = ttax.term_taxonomy_id) LEFT JOIN $wpdb->terms AS tter ON (ttax.term_id = tter.term_id) ";
792
  }
793
  $this->se_log( "tags join: ".$join );
@@ -848,7 +857,7 @@ function search_everything_callback() {
848
  's' => $_GET['s']
849
  );
850
 
851
- $zemanta_response = api(array(
852
  'method' => 'zemanta.suggest',
853
  'return_images' => 0,
854
  'return_rich_objects' => 0,
@@ -867,12 +876,13 @@ function search_everything_callback() {
867
  $result['external'] = json_decode($zemanta_response['body'])->articles;
868
  }
869
 
 
870
  $SE = new SearchEverything(true);
871
 
872
  if (!empty($_GET['exact'])) {
873
  $params['exact'] = true;
874
  }
875
-
876
  $post_query = new WP_query($params);
877
 
878
  while ( $post_query->have_posts() ) {
@@ -897,10 +907,10 @@ add_action('wp_enqueue_scripts', 'se_enqueue_styles');
897
 
898
  function se_post_publish_ping($post_id) {
899
  //should happen only on first publish
 
900
  if( ( $_POST['post_status'] == 'publish' ) && ( $_POST['original_post_status'] != 'publish' ) ) {
901
  $permalink = get_permalink($post_id);
902
-
903
- $zemanta_response = api(array(
904
  'method' => 'zemanta.post_published_ping',
905
  'current_url' => $permalink,
906
  'post_url' => $permalink,
@@ -909,9 +919,11 @@ function se_post_publish_ping($post_id) {
909
  'deployment' => 'search-everything',
910
  'format' => 'json'
911
  ));
912
-
913
- $status = json_decode($zemanta_response['body'])->status;
 
914
  }
 
915
  }
916
 
917
  add_action( 'publish_post', 'se_post_publish_ping' );
1
  <?php
2
  /*
3
  Plugin Name: Search Everything
4
+ Plugin URI: http://wordpress.org/plugins/search-everything/
5
  Description: Adds search functionality without modifying any template pages: Activate, Configure and Search. Options Include: search highlight, 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: 8.1
7
  Author: Zemanta
8
  Author URI: http://www.zemanta.com
9
  */
10
 
11
+ define('SE_VERSION', '8.1');
12
 
13
  if (!defined('SE_PLUGIN_FILE'))
14
  define('SE_PLUGIN_FILE', plugin_basename(__FILE__));
20
  define('SE_PLUGIN_DIR', WP_PLUGIN_DIR . '/' . SE_PLUGIN_NAME);
21
 
22
  if (!defined('SE_PLUGIN_URL'))
23
+ define('SE_PLUGIN_URL', plugins_url() . '/' . SE_PLUGIN_NAME);
24
 
25
  if (!defined('SE_ZEMANTA_API_GATEWAY'))
26
  define('SE_ZEMANTA_API_GATEWAY', 'http://api.zemanta.com/services/rest/0.0/');
64
  $se_metabox = $se_options['se_research_metabox'];
65
  include(se_get_view('admin_head'));
66
  }
 
67
  add_action('admin_head', 'se_admin_head');
68
 
69
+ function se_global_head() {
70
+ include(se_get_view('global_head'));
71
+ }
72
+ add_action('wp_head', 'se_global_head');
73
+
74
  function se_global_notice() {
75
  global $pagenow, $se_global_notice_pages;
76
+ if (!current_user_can('manage_options')) {
77
+ return;
78
+ }
79
 
80
  $se_meta = se_get_meta();
81
 
126
  function init() {
127
  if ( current_user_can('manage_options') ) {
128
  $SEAdmin = new se_admin();
 
 
 
 
129
  }
130
+ // Disable Search-Everything, because posts_join is not working properly in Wordpress-backend's Ajax functions
131
+ //(for example in wp_link_query from compose screen (article search when inserting links))
132
+ if (basename( $_SERVER["SCRIPT_NAME"] ) == "admin-ajax.php") {
133
+ return true;
134
+ }
135
+
136
 
137
  $this->search_hooks();
138
 
146
 
147
  function search_hooks() {
148
  //add filters based upon option settings
149
+
150
  if ( $this->options['se_use_tag_search'] || $this->options['se_use_category_search'] || $this->options['se_use_tax_search'] ) {
151
  add_filter( 'posts_join', array( &$this, 'se_terms_join' ) );
152
  if ( $this->options['se_use_tag_search'] ) {
797
  }
798
  // build our final string
799
  $on = ' ( ' . implode( ' OR ', $on ) . ' ) ';
 
800
  $join .= " LEFT JOIN $wpdb->term_relationships AS trel ON ($wpdb->posts.ID = trel.object_id) LEFT JOIN $wpdb->term_taxonomy AS ttax ON ( " . $on . " AND trel.term_taxonomy_id = ttax.term_taxonomy_id) LEFT JOIN $wpdb->terms AS tter ON (ttax.term_id = tter.term_id) ";
801
  }
802
  $this->se_log( "tags join: ".$join );
857
  's' => $_GET['s']
858
  );
859
 
860
+ $zemanta_response = se_api(array(
861
  'method' => 'zemanta.suggest',
862
  'return_images' => 0,
863
  'return_rich_objects' => 0,
876
  $result['external'] = json_decode($zemanta_response['body'])->articles;
877
  }
878
 
879
+
880
  $SE = new SearchEverything(true);
881
 
882
  if (!empty($_GET['exact'])) {
883
  $params['exact'] = true;
884
  }
885
+ $params["showposts"] = 5;
886
  $post_query = new WP_query($params);
887
 
888
  while ( $post_query->have_posts() ) {
907
 
908
  function se_post_publish_ping($post_id) {
909
  //should happen only on first publish
910
+ $status = false;
911
  if( ( $_POST['post_status'] == 'publish' ) && ( $_POST['original_post_status'] != 'publish' ) ) {
912
  $permalink = get_permalink($post_id);
913
+ $zemanta_response = se_api(array(
 
914
  'method' => 'zemanta.post_published_ping',
915
  'current_url' => $permalink,
916
  'post_url' => $permalink,
919
  'deployment' => 'search-everything',
920
  'format' => 'json'
921
  ));
922
+ if (!is_wp_error($zemanta_response)) {
923
+ $status = json_decode($zemanta_response['body'])->status;
924
+ }
925
  }
926
+ return $status;
927
  }
928
 
929
  add_action( 'publish_post', 'se_post_publish_ping' );
static/css/admin.css CHANGED
@@ -7,7 +7,7 @@
7
  #se-description,#se-basic-settings,#se-advanced-settings, #se-test-search, #se-info, #se-research-settings, .se-submit {margin-top: 20px;}
8
  #se-basic-settings .manage-column, #se-advanced-settings .manage-column, #se-research-settings .manage-column {font-weight:bold;}
9
  #se-description,#se-basic-settings.widefat, #se-advanced-settings.widefat,#se-test-search.widefat, #se-info.widefat, #se-research-settings, .se-submit {width:80%;}
10
- .se-submit {text-align: right;}
11
  .se-col {width:350px;}
12
  .se-suboption label { font-size: smaller;margin-left:10px; color:#666;}
13
  p span.se-thank-you {font-size: large; font-weight: bold;}
7
  #se-description,#se-basic-settings,#se-advanced-settings, #se-test-search, #se-info, #se-research-settings, .se-submit {margin-top: 20px;}
8
  #se-basic-settings .manage-column, #se-advanced-settings .manage-column, #se-research-settings .manage-column {font-weight:bold;}
9
  #se-description,#se-basic-settings.widefat, #se-advanced-settings.widefat,#se-test-search.widefat, #se-info.widefat, #se-research-settings, .se-submit {width:80%;}
10
+ .se-submit {text-align: left;}
11
  .se-col {width:350px;}
12
  .se-suboption label { font-size: smaller;margin-left:10px; color:#666;}
13
  p span.se-thank-you {font-size: large; font-weight: bold;}
static/img/search.png CHANGED
Binary file
static/js/searcheverything.js CHANGED
@@ -1,14 +1,268 @@
1
- var SearchEverything=function(a){var g={months:"Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(" "),resizeSearchInput:function(){var b=a("#se-metabox-text");b.css({width:b.closest("div").outerWidth(!0)-b.next("a").outerWidth(!0)})},handleWindowResize:function(){a(window).resize(g.resizeSearchInput)},handleMetaboxActions:function(){a(".meta-box-sortables").on("sortstop",function(a,e){e.item&&(e.item.length&&"se-metabox"===e.item[0].id)&&g.resizeSearchInput()});a(".postbox h3, .postbox .handlediv").on("click",
2
- function(){var b=a(this).closest(".postbox");setTimeout(function(){b.hasClass("closed")||g.resizeSearchInput()},1)})},displayOwnResults:function(b,e){var d=0;a.each(e,function(e,c){var f=a('<li><div title="Click to insert link into post."><h6></h6><a href="" target="_blank"></a><p></p></div></li>');4<e||(d+=1,f.data(c),f.find("h6").text(c.post_title||"Title missing"),f.find("p").text(g.extractText(f,"post_content")),f.find("a").text(g.urlDomain(c.guid)).prop("title",c.title||"Title missing").prop("href",
3
- c.guid),b.append(f))});return d},extractText:function(b,e){var d=a("<div>"+b.data(e)+"</div>").text();!d||0===d.length?d="No Excerpt":100<d.length&&(d=d.substring(0,100)+"\u2026");return d},displayExternalResults:function(b,e){var d=0;a.each(e,function(e,c){var f=a('<li><div title="Click to insert link into post."><h6></h6><a href="" target="_blank"></a><p></p></div></li>');4<e||(d+=1,f.data(c),f.find("h6").text(c.title||"Title missing"),f.find("p").text(g.extractText(f,"text_preview")),f.find("a").text(g.urlDomain(c.url)).prop("title",
4
- c.title||"Title missing").prop("href",c.url),b.append(f))});return d},performSearch:function(){var b=a("#se-metabox-text"),e=a('<div id="se-metabox-results"><div id="se-metabox-external-results" class="se-metabox-results-list se-hidden"><h4>Results from around the web</h4><p class="se-instructions">Click to insert link into post.</p><ul></ul></div><div id="se-metabox-own-results" class="se-metabox-results-list"><h4>Results from your blog</h4><p class="se-instructions">Click to insert link into post.</p><ul></ul></div><div class="se-spinner"></div></div>'),
5
- d=0;a("#se-metabox-results").remove();b.closest("div").after(e);a.ajax({url:b.data("ajaxurl"),method:"get",dataType:"json",data:{action:"search_everything",text:tinyMCE&&tinyMCE.activeEditor.getContent()||"",s:b.prop("value")||""},success:function(e){var c=a("#se-metabox-own-results"),f=c.find("ul"),h=a("#se-metabox-external-results"),i=h.find("ul");a(".se-spinner, .se-no-results").remove();window.externalSearchEnabled?0===e.external.length?a("#se-metabox-results").append('<p class="se-no-results">We haven\'t found any external resources for you.</p>'):
6
- (h.show(),d=g.displayExternalResults(i,e.external),h.find("h4").text(h.find("h4").text()+" ("+d+")")):(c.before('<div id="se-metabox-own-powersearch" class="se-metabox-results-list"><h4>Results from around the web</h4><p>If you want to use external search, you need to enable it in your <a class="se-settings-link" href="options-general.php?page=extend_search" target="_blank"><strong>settings</strong></strong></a>.</p></div>'),a("#se-metabox-own-powersearch").show());0===e.own.length?(a("#se-metabox-results").append('<p class="se-no-results">It seems we haven\'t found any results for search term <strong>'+
7
- b.prop("value")+" on your blog</strong>.</p>"),h.removeClass("se-hidden")):(c.show(),d=g.displayOwnResults(f,e.own),c.find("h4").text(c.find("h4").text()+" ("+d+")"))},error:function(){a(".se-spinner, .se-no-results").remove();a("#se-metabox-results").append('<p class="se-no-results">There was something wrong with the search. Please try again. If this happens a lot, please check out our <a href="http://wordpress.org/support/plugin/search-everything" target="_blank">Support forum</a>.</p>')}});e.on("click",
8
- ".se-settings-link",function(){a(this).parent().text("Thanks. Please refresh this page.")})},urlDomain:function(a){var e=document.createElement("a");e.href=a;return e.hostname},handleSearch:function(){var b=a("#se-metabox-text");b.on("keypress",function(e){13===e.which&&(e.preventDefault(),""!==a.trim(b.prop("value"))&&g.performSearch())});a("#se-metabox-search").on("click",function(e){e.preventDefault();""!==a.trim(b.prop("value"))&&g.performSearch()})},initResultBehaviour:function(){var b=a("#se-metabox");
9
- b.on("click","#se-metabox-own-results li",function(e){var d=a('<div id="se-just-a-wrapper"><p><a target="_blank" class="se-box se-article"><span class="se-box-heading"><span class="se-box-heading-title"></span></span><span class="se-box-text"></span><span class="se-box-date"></span><span class="se-box-domain"></span></a></p></div>'),b=a(this),c;c=b.data("post_date").split(" ")[0].split("-");c=new Date(c[0],c[1]-1,c[2]);c=g.months[c.getMonth()]+" "+c.getDate()+" "+c.getFullYear();var f=a('a.se-box[href="'+
10
- b.data("guid")+'"]',tinyMCE&&tinyMCE.activeEditor.contentWindow.document||document);"A"!==a(e.target).prop("tagName")&&(f.length?"P"===f.parent().prop("tagName")?f.closest("p").remove():f.remove():(d.find(".se-box-heading-title").text(b.data("post_title")||"Title missing".substring(0,50)),d.find(".se-box-heading-domain").text("("+g.urlDomain(b.data("guid"))+")"),d.find(".se-box-text").text(g.extractText(b,"post_content")),d.find(".se-box-date").text(c),d.find(".se-box-domain").text(g.urlDomain(b.data("guid"))),
11
- d.find(".se-box").attr("href",b.data("guid")),send_to_editor&&send_to_editor(d.html())))});b.on("click","#se-metabox-external-results li",function(e){var d=a('<div id="se-just-a-wrapper"><p><a target="_blank" class="se-box se-article"><span class="se-box-heading"><span class="se-box-heading-title"></span></span><span class="se-box-text"></span><span class="se-box-date"></span><span class="se-box-domain"></span></a></p></div>'),b=a(this),c;c=b.data("published_datetime").split("T")[0].split("-");c=
12
- new Date(c[0],parseInt(c[1],10)-1,parseInt(c[2],10));c=g.months[c.getMonth()]+" "+c.getDate()+" "+c.getFullYear();var f=a('a.se-box[href="'+b.data("url")+'"]',tinyMCE&&tinyMCE.activeEditor.contentWindow.document||document);"A"!==a(e.target).prop("tagName")&&(f.length?"P"===f.parent().prop("tagName")?f.closest("p").remove():f.remove():(d.find(".se-box-heading-title").text(b.data("title")||"Title missing".substring(0,50)),d.find(".se-box-heading-domain").text("("+g.urlDomain(b.data("article_id"))+")"),
13
- d.find(".se-box-text").text(g.extractText(b,"text_preview")),d.find(".se-box-date").text(c),d.find(".se-box-domain").text(g.urlDomain(b.data("url"))),d.find(".se-box").attr("href",b.data("url")),send_to_editor&&send_to_editor(d.html())))});b.on("click",".se-metabox-results-list h4",function(){a(this).closest(".se-metabox-results-list").toggleClass("se-hidden")})}};return{initialize:function(){g.resizeSearchInput();g.handleWindowResize();g.handleMetaboxActions();g.handleSearch();g.initResultBehaviour();
14
- return this}}}(jQuery);jQuery(function(){SearchEverything.initialize()});
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ var SearchEverything = (function ($) {
2
+ var r = {
3
+ months: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
4
+ resizeSearchInput: function () {
5
+ var input = $('#se-metabox-text');
6
+
7
+ input.css({
8
+ 'width': input.closest('div').outerWidth(true) - input.next('a').outerWidth(true)
9
+ });
10
+ },
11
+ handleWindowResize: function () {
12
+ $(window).resize(r.resizeSearchInput);
13
+ },
14
+ handleMetaboxActions: function () {
15
+ $('.meta-box-sortables').on('sortstop', function (event, ui) {
16
+ if (ui.item && ui.item.length && ui.item[0].id === 'se-metabox') {
17
+ r.resizeSearchInput();
18
+ }
19
+ });
20
+ $('.postbox h3, .postbox .handlediv').on('click', function (ev) {
21
+ var postbox = $(this).closest('.postbox');
22
+
23
+ setTimeout(function () {
24
+ if (!postbox.hasClass('closed')) {
25
+ r.resizeSearchInput();
26
+ }
27
+ }, 1); // Delay till WP finishes its own thing and then we can kick in
28
+ })
29
+ },
30
+ displayOwnResults: function (holder, data) {
31
+ var count = 0;
32
+
33
+ $.each(data, function (i, result) {
34
+ var listItem = $('<li><div title="Click to insert link into post."><h6></h6><a href="" target="_blank"></a><p></p></div></li>');
35
+ if (i > 4) {
36
+ return;
37
+ }
38
+ count += 1;
39
+ listItem.data(result);
40
+
41
+ listItem.find('h6').text(result.post_title || 'Title missing');
42
+ listItem.find('p').text(r.extractText(listItem, 'post_content'));
43
+ listItem.find('a').text(r.urlDomain(result.guid)).prop('title', result.title || 'Title missing').prop('href', result.guid);
44
+
45
+ holder.append(listItem);
46
+ });
47
+
48
+ return count;
49
+ },
50
+ extractText: function (listItem, dataField) {
51
+ var temp = $('<div>' + listItem.data(dataField) + '</div>').text();
52
+
53
+ if (!temp || temp.length === 0) {
54
+ temp = 'No Excerpt';
55
+ } else if (temp.length > 100) {
56
+ temp = temp.substring(0, 100) + '…';
57
+ }
58
+ return temp;
59
+ },
60
+ displayExternalResults: function (holder, data) {
61
+ var count = 0;
62
+
63
+ $.each(data, function (i, result) {
64
+ var listItem = $('<li><div title="Click to insert link into post."><h6></h6><a href="" target="_blank"></a><p></p></div></li>');
65
+ if (i > 4) {
66
+ return;
67
+ }
68
+ count += 1;
69
+ listItem.data(result);
70
+
71
+ listItem.find('h6').text(result.title || 'Title missing');
72
+ listItem.find('p').text(r.extractText(listItem, 'text_preview'));
73
+ listItem.find('a').text(r.urlDomain(result.url)).prop('title', result.title || 'Title missing').prop('href', result.url);
74
+
75
+ holder.append(listItem);
76
+ });
77
+
78
+ return count;
79
+ },
80
+ performSearch: function () {
81
+ var input = $('#se-metabox-text'),
82
+ results = $('<div id="se-metabox-results"><div id="se-metabox-external-results" class="se-metabox-results-list se-hidden"><h4>Results from around the web</h4><p class="se-instructions">Click to insert link into post.</p><ul></ul></div><div id="se-metabox-own-results" class="se-metabox-results-list"><h4>Results from your blog</h4><p class="se-instructions">Click to insert link into post.</p><ul></ul></div><div class="se-spinner"></div></div>'),
83
+ count = 0;
84
+
85
+ $('#se-metabox-results').remove();
86
+ input.closest('div').after(results);
87
+
88
+ $.ajax({
89
+ url: input.data('ajaxurl'),
90
+ method: 'get',
91
+ dataType: "json",
92
+ data: {
93
+ action: 'search_everything',
94
+ text: tinyMCE && tinyMCE.activeEditor.getContent() || '',
95
+ s: input.prop('value') || ''
96
+ },
97
+ success: function (data) {
98
+ var ownResults = $('#se-metabox-own-results'),
99
+ ownResultsList = ownResults.find('ul'),
100
+ externalResults = $('#se-metabox-external-results'),
101
+ externalResultsList = externalResults.find('ul');
102
+
103
+ $('.se-spinner, .se-no-results').remove();
104
+ if (!window.externalSearchEnabled) {
105
+ ownResults.before('<div id="se-metabox-own-powersearch" class="se-metabox-results-list"><h4>Results from around the web</h4><p>If you want to use external search, you need to enable it in your <a class="se-settings-link" href="options-general.php?page=extend_search" target="_blank"><strong>settings</strong></strong></a>.</p></div>');
106
+ $('#se-metabox-own-powersearch').show();
107
+ } else {
108
+ if (data.external.length === 0) {
109
+ $('#se-metabox-results').append('<p class="se-no-results">We haven\'t found any external resources for you.</p>');
110
+ } else {
111
+ externalResults.show();
112
+ count = r.displayExternalResults(externalResultsList, data.external);
113
+ externalResults.find('h4').text(externalResults.find('h4').text() + ' (' + count + ')');
114
+ }
115
+ }
116
+ if (data.own.length === 0) {
117
+ $('#se-metabox-results').append('<p class="se-no-results">It seems we haven\'t found any results for search term <strong>' + input.prop('value') + ' on your blog</strong>.</p>');
118
+ externalResults.removeClass('se-hidden');
119
+ } else {
120
+ ownResults.show();
121
+ count = r.displayOwnResults(ownResultsList, data.own);
122
+ ownResults.find('h4').text(ownResults.find('h4').text() + ' (' + count + ')');
123
+ }
124
+ },
125
+ error: function (xhr) {
126
+ $('.se-spinner, .se-no-results').remove();
127
+ $('#se-metabox-results').append('<p class="se-no-results">There was something wrong with the search. Please try again. If this happens a lot, please check out our <a href="http://wordpress.org/support/plugin/search-everything" target="_blank">Support forum</a>.</p>');
128
+
129
+ }
130
+ });
131
+
132
+ results.on('click', '.se-settings-link', function () {
133
+ $(this).parent().text('Thanks. Please refresh this page.');
134
+ });
135
+ },
136
+ urlDomain: function (url) { // http://stackoverflow.com/a/8498668
137
+ var a = document.createElement('a');
138
+ a.href = url;
139
+ return a.hostname;
140
+ },
141
+ handleSearch: function () {
142
+ var input = $('#se-metabox-text');
143
+ input.on('keypress', function (ev) {
144
+ if (13 === ev.which) {
145
+ ev.preventDefault(); // Don't actually post... that would be silly
146
+ if ($.trim(input.prop('value')) !== '') {
147
+ r.performSearch();
148
+ }
149
+ }
150
+ });
151
+
152
+ $('#se-metabox-search').on('click', function (ev) {
153
+ ev.preventDefault(); // Don't actually go to another page... that would be destructive
154
+ if ($.trim(input.prop('value')) !== '') {
155
+ r.performSearch();
156
+ }
157
+ });
158
+ },
159
+ initResultBehaviour: function () {
160
+ var html = '<div id="se-just-a-wrapper">' +
161
+ '<p>' +
162
+ '<a target="_blank" class="se-box se-article">' +
163
+ '<span class="se-box-heading">' +
164
+ '<span class="se-box-heading-title"></span>' +
165
+ '</span>' +
166
+ '<span class="se-box-text"></span>' +
167
+ '<span class="se-box-date"></span>' +
168
+ '<span class="se-box-domain"></span>' +
169
+ '</a>' +
170
+ '</p>' +
171
+ '</div>',
172
+ metabox = $('#se-metabox');
173
+
174
+ metabox.on('click', '#se-metabox-own-results li', function (ev) {
175
+ var insertHtml = $(html),
176
+ listItem = $(this),
177
+ date = (function () {
178
+ var datePart = listItem.data('post_date').split(' ')[0].split('-'),
179
+ actualDate = new Date(datePart[0], datePart[1] - 1, datePart[2]);
180
+
181
+ return r.months[actualDate.getMonth()] + ' ' + actualDate.getDate() + ' ' + actualDate.getFullYear();
182
+ }()),
183
+ inserted = $('a.se-box[href="' + listItem.data('guid') + '"]', tinyMCE && tinyMCE.activeEditor.contentWindow.document || document);
184
+
185
+ if ($(ev.target).prop('tagName') === 'A') {
186
+ return;
187
+ }
188
+
189
+ if (inserted.length) {
190
+ if (inserted.parent().prop("tagName") === 'P') {
191
+ inserted.closest('p').remove();
192
+ } else {
193
+ inserted.remove();
194
+ }
195
+ } else {
196
+ insertHtml.find('.se-box-heading-title').text(listItem.data('post_title') || 'Title missing'.substring(0, 50));
197
+ insertHtml.find('.se-box-heading-domain').text('(' + r.urlDomain(listItem.data('guid')) + ')');
198
+ insertHtml.find('.se-box-text').text(r.extractText(listItem, 'post_content'));
199
+ insertHtml.find('.se-box-date').text(date);
200
+ insertHtml.find('.se-box-domain').text(r.urlDomain(listItem.data('guid')));
201
+ insertHtml.find('.se-box').attr('href', listItem.data('guid'));
202
+
203
+ if (send_to_editor) {
204
+ send_to_editor(insertHtml.html());
205
+ } else {
206
+ // Dunno yet
207
+ }
208
+ }
209
+ });
210
+ metabox.on('click', '#se-metabox-external-results li', function (ev) {
211
+ var insertHtml = $(html),
212
+ listItem = $(this),
213
+ date = (function () {
214
+ var datePart = listItem.data('published_datetime').split('T')[0].split('-'),
215
+ actualDate = new Date(datePart[0], parseInt(datePart[1], 10) - 1, parseInt(datePart[2], 10));
216
+
217
+ return r.months[actualDate.getMonth()] + ' ' + actualDate.getDate() + ' ' + actualDate.getFullYear();
218
+ }()),
219
+ inserted = $('a.se-box[href="' + listItem.data('url') + '"]', tinyMCE && tinyMCE.activeEditor.contentWindow.document || document);
220
+
221
+ if ($(ev.target).prop('tagName') === 'A') {
222
+ return;
223
+ }
224
+
225
+ if (inserted.length) {
226
+ if (inserted.parent().prop("tagName") === 'P') {
227
+ inserted.closest('p').remove();
228
+ } else {
229
+ inserted.remove();
230
+ }
231
+ } else {
232
+ insertHtml.find('.se-box-heading-title').text(listItem.data('title') || 'Title missing'.substring(0, 50));
233
+ insertHtml.find('.se-box-heading-domain').text('(' + r.urlDomain(listItem.data('article_id')) + ')');
234
+ insertHtml.find('.se-box-text').text(r.extractText(listItem, 'text_preview'));
235
+ insertHtml.find('.se-box-date').text(date);
236
+ insertHtml.find('.se-box-domain').text(r.urlDomain(listItem.data('url')));
237
+ insertHtml.find('.se-box').attr('href', listItem.data('url'));
238
+
239
+ if (send_to_editor) {
240
+ send_to_editor(insertHtml.html());
241
+ } else {
242
+ // Dunno yet
243
+ }
244
+ }
245
+ });
246
+
247
+ metabox.on('click', '.se-metabox-results-list h4', function () {
248
+ $(this).closest('.se-metabox-results-list').toggleClass('se-hidden');
249
+ });
250
+ }
251
+ },
252
+ u = {
253
+ initialize: function () {
254
+ r.resizeSearchInput();
255
+ r.handleWindowResize();
256
+ r.handleMetaboxActions();
257
+ r.handleSearch();
258
+ r.initResultBehaviour();
259
+
260
+ return this;
261
+ }
262
+ };
263
+ return u;
264
+ }(jQuery));
265
+
266
+ jQuery(function () {
267
+ SearchEverything.initialize();
268
+ });
views/global_head.php ADDED
@@ -0,0 +1,3 @@
 
 
 
1
+ <script type="text/javascript">
2
+ window._se_plugin_version = '<?php echo SE_VERSION; ?>';
3
+ </script>
views/global_notice.php CHANGED
@@ -1,5 +1,5 @@
1
  <div class="updated se-updated" id="se-top-global-notice" >
2
- <div class="se-dismiss"><a href="<?php echo $close_url; ?>">Dismiss</a></div>
3
  <h3><?php echo $notice['title']; ?></h3>
4
  <p class="se-about-description"><?php echo $notice['message']; ?></p>
5
  </div>
1
  <div class="updated se-updated" id="se-top-global-notice" >
2
+ <div class="se-dismiss"><a href="<?php echo $close_url; ?>">Dismiss and go to settings</a></div>
3
  <h3><?php echo $notice['title']; ?></h3>
4
  <p class="se-about-description"><?php echo $notice['message']; ?></p>
5
  </div>
views/options_page.php CHANGED
@@ -1,8 +1,8 @@
1
  <div class="wrap">
2
- <h2><?php _e('Search Everything', 'SearchEverything'); ?> <?php _e('options','SearchEverything');?> (<?php _e('current version','SearchEverything') ?> <?php echo $meta['version']; ?>)</h2>
3
  <div id="se-description" class="widefat">
4
- <p><span class="se-name"><?php _e('Search Everything', 'SearchEverything'); ?> </span><?php _e('is the most reliable and efficient search plugin for WordPress.
5
- It improves the search results for your readers and comes with the','SearchEverything')?> <span class="se-name"><?php _e('Research Everything','SearchEverything') ?></span> <?php _e('compose-screen widget to help you write better.
6
  On this page you can customize each of these two features.','SearchEverything') ?></p>
7
  </div>
8
  <form method="post">
@@ -58,7 +58,7 @@
58
  <td>
59
  <input type="checkbox" id="appvd_pages" name="appvd_pages" value="yes" <?php checked($options['se_approved_pages_only']); ?> />
60
  </td>
61
- </tr><?php endif; ?> <?php
62
  // Show tags only for WP 2.3+
63
  if ($wp_version >= '2.3') : ?>
64
  <tr valign="middle">
@@ -68,7 +68,7 @@
68
  <td>
69
  <input type="checkbox" id="search_tags" name="search_tags" value="yes" <?php checked($options['se_use_tag_search']); ?> />
70
  </td>
71
- </tr><?php endif; ?> <?php
72
  // Show taxonomies only for WP 2.3+
73
  if ($wp_version >= '2.3') : ?>
74
  <tr valign="middle">
@@ -88,7 +88,7 @@
88
  </label>
89
  </th>
90
  <td>
91
- <input type="checkbox" id="search_categories" name="search_categories" value="yes" <?php checked($options['se_use_category_search']); ?> />
92
  </td>
93
  </tr><?php endif; ?>
94
  <tr valign="middle">
@@ -291,7 +291,7 @@ The <span class="se-name">Search Everything</span> writing helper enables you to
291
  <li><a href="http://www.alohastone.com" target="blank">alohastone (DE)</a></li>
292
  <li><a href="http://gidibao.net/" target="blank">Gianni Diurno (ES)</a></li>
293
  <li><a href="#">János Csárdi-Braunstein (HU)</a></li>
294
- <li><a href="http://idimensie.nl" target="blank">Joeke-Remkus de Vries (NL)</a></li>
295
  <li><a href="#">Silver Ghost (RU)</a></li>
296
  <li><a href="http://mishkin.se" target="blank">Mikael Jorhult (RU)</a></li>
297
  <li><a href="#">Baris Unver (TR)</a></li>
1
  <div class="wrap">
2
+ <h2><?php _e('Search Everything', 'SearchEverything'); ?> <?php _e('options','SearchEverything');?> (<?php _e('current version','SearchEverything') ?> <?php echo SE_VERSION; ?>)</h2>
3
  <div id="se-description" class="widefat">
4
+ <p><span class="se-name"><?php _e('Search Everything', 'SearchEverything'); ?> </span><?php _e('is the most reliable and efficient search plugin for WordPress.
5
+ It improves the search results for your readers and comes with the','SearchEverything')?> <span class="se-name"><?php _e('Research Everything','SearchEverything') ?></span> <?php _e('compose-screen widget to help you write better.
6
  On this page you can customize each of these two features.','SearchEverything') ?></p>
7
  </div>
8
  <form method="post">
58
  <td>
59
  <input type="checkbox" id="appvd_pages" name="appvd_pages" value="yes" <?php checked($options['se_approved_pages_only']); ?> />
60
  </td>
61
+ </tr><?php endif; ?> <?php
62
  // Show tags only for WP 2.3+
63
  if ($wp_version >= '2.3') : ?>
64
  <tr valign="middle">
68
  <td>
69
  <input type="checkbox" id="search_tags" name="search_tags" value="yes" <?php checked($options['se_use_tag_search']); ?> />
70
  </td>
71
+ </tr><?php endif; ?> <?php
72
  // Show taxonomies only for WP 2.3+
73
  if ($wp_version >= '2.3') : ?>
74
  <tr valign="middle">
88
  </label>
89
  </th>
90
  <td>
91
+ <input type="checkbox" id="search_categories" name="search_categories" value="yes" <?php checked($options['se_use_category_search']); ?> />
92
  </td>
93
  </tr><?php endif; ?>
94
  <tr valign="middle">
291
  <li><a href="http://www.alohastone.com" target="blank">alohastone (DE)</a></li>
292
  <li><a href="http://gidibao.net/" target="blank">Gianni Diurno (ES)</a></li>
293
  <li><a href="#">János Csárdi-Braunstein (HU)</a></li>
294
+ <li><a href="http://www.forsitemedia.nl" target="blank">Remkus de Vries (nl_NL)</a></li>
295
  <li><a href="#">Silver Ghost (RU)</a></li>
296
  <li><a href="http://mishkin.se" target="blank">Mikael Jorhult (RU)</a></li>
297
  <li><a href="#">Baris Unver (TR)</a></li>