Yet Another Related Posts Plugin (YARPP) - Version 3.1.3b2

Version Description

Download this release

Release Info

Developer mitchoyoshitaka
Plugin Icon 128x128 Yet Another Related Posts Plugin (YARPP)
Version 3.1.3b2
Comparing to
See all releases

Code changes from version 3.1.3b1 to 3.1.3b2

Files changed (5) hide show
  1. includes.php +16 -23
  2. intl.php +1 -1
  3. magic.php +2 -2
  4. readme.txt +6 -2
  5. yarpp.php +6 -5
includes.php CHANGED
@@ -1,9 +1,9 @@
1
  <?php
2
 
3
- require_once('magic.php');
4
- require_once('keywords.php');
5
- require_once('intl.php');
6
- require_once('services.php');
7
 
8
  if ( !defined('WP_CONTENT_URL') )
9
  define('WP_CONTENT_URL', get_option('siteurl') . '/wp-content');
@@ -115,7 +115,7 @@ function yarpp_activate() {
115
  `ID` bigint(20) unsigned NOT NULL default '0',
116
  `score` float unsigned NOT NULL default '0',
117
  `date` timestamp NOT NULL default CURRENT_TIMESTAMP,
118
- PRIMARY KEY (`reference_ID`,`ID`)
119
  ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;")) {
120
  echo "<!--".__('MySQL error on creating yarpp_related_cache table','yarpp').": ";
121
  $wpdb->print_error();
@@ -160,7 +160,7 @@ function yarpp_upgrade_check($inuse = false) {
160
  update_option('yarpp_version','1.5');
161
  }
162
 
163
- if (eregi_replace('[a-z].*$','',get_option('yarpp_version')) < 2) {
164
  foreach (array_keys($yarpp_value_options) as $option) {
165
  if (!get_option("yarpp_$option"))
166
  add_option("yarpp_$option",$yarpp_value_options[$option].' ');
@@ -169,7 +169,6 @@ function yarpp_upgrade_check($inuse = false) {
169
  if (!get_option("yarpp_$option"))
170
  add_option("yarpp_$option",$yarpp_binary_options[$option]);
171
  }
172
-
173
  }
174
 
175
  if (version_compare('2.03',get_option('yarpp_version')) > 0) {
@@ -177,13 +176,13 @@ function yarpp_upgrade_check($inuse = false) {
177
  $wpdb->query("ALTER TABLE $wpdb->posts ADD FULLTEXT `yarpp_content` ( `post_content`)"); update_option('yarpp_version','2.03');
178
  }
179
 
180
- if (version_compare(YARPP_VERSION,get_option('yarpp_version')) > 0) {
181
- update_option('yarpp_version',YARPP_VERSION);
182
-
183
- //if (!$inuse)
184
- // echo '<div id="message" class="updated fade" style="background-color: rgb(207, 235, 247);">'.__('<h3>An important message from YARPP:</h3><p>Thank you for upgrading to YARPP 2. YARPP 2.0 adds the much requested ability to limit related entry results by certain tags or categories. 2.0 also brings more fine tuned control of the magic algorithm, letting you specify how the algorithm should consider or not consider entry content, titles, tags, and categories. Make sure to adjust the new settings to your liking and perhaps readjust your threshold.</p><p>For more information, check out the <a href="http://mitcho.com/code/yarpp/">YARPP documentation</a>. (This message will not be displayed again.)</p>','yarpp').'</div>';
185
  }
186
 
 
 
187
  // just in case, try to add the index one more time.
188
  if (!yarpp_enabled()) {
189
  $wpdb->query("ALTER TABLE $wpdb->posts ADD FULLTEXT `yarpp_title` ( `post_title`)");
@@ -216,7 +215,7 @@ function yarpp_load_thickbox() {
216
  }
217
 
218
  function yarpp_options_page() {
219
- require(str_replace('includes.php','options.php',__FILE__));
220
  }
221
 
222
  // This function was written by @tyok
@@ -402,16 +401,10 @@ function yarpp_microtime_float()
402
  }
403
 
404
  function yarpp_check_version_json($version) {
405
- include_once(ABSPATH . WPINC . '/class-snoopy.php');
406
- if (class_exists('Snoopy')) {
407
- $snoopy = new Snoopy;
408
- $snoopy->referer = get_bloginfo('siteurl');
409
- $result = $snoopy->fetch("http://mitcho.com/code/yarpp/checkversion.php?version=$version");
410
- if ($result) {
411
- return $snoopy->results;
412
- }
413
- }
414
- return '{}';
415
  }
416
 
417
  function yarpp_add_metabox() {
1
  <?php
2
 
3
+ require_once(YARPP_DIR.'/magic.php');
4
+ require_once(YARPP_DIR.'/keywords.php');
5
+ require_once(YARPP_DIR.'/intl.php');
6
+ require_once(YARPP_DIR.'/services.php');
7
 
8
  if ( !defined('WP_CONTENT_URL') )
9
  define('WP_CONTENT_URL', get_option('siteurl') . '/wp-content');
115
  `ID` bigint(20) unsigned NOT NULL default '0',
116
  `score` float unsigned NOT NULL default '0',
117
  `date` timestamp NOT NULL default CURRENT_TIMESTAMP,
118
+ PRIMARY KEY ( `score` , `date` , `reference_ID` , `ID` )
119
  ) ENGINE=MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;")) {
120
  echo "<!--".__('MySQL error on creating yarpp_related_cache table','yarpp').": ";
121
  $wpdb->print_error();
160
  update_option('yarpp_version','1.5');
161
  }
162
 
163
+ if (version_compare('2',get_option('yarpp_version'),'>') > 0) {
164
  foreach (array_keys($yarpp_value_options) as $option) {
165
  if (!get_option("yarpp_$option"))
166
  add_option("yarpp_$option",$yarpp_value_options[$option].' ');
169
  if (!get_option("yarpp_$option"))
170
  add_option("yarpp_$option",$yarpp_binary_options[$option]);
171
  }
 
172
  }
173
 
174
  if (version_compare('2.03',get_option('yarpp_version')) > 0) {
176
  $wpdb->query("ALTER TABLE $wpdb->posts ADD FULLTEXT `yarpp_content` ( `post_content`)"); update_option('yarpp_version','2.03');
177
  }
178
 
179
+ if (version_compare('3.1.3',get_option('yarpp_version')) > 0) {
180
+ $wpdb->query("ALTER TABLE {$wpdb->prefix}yarpp_related_cache DROP PRIMARY KEY ,
181
+ ADD PRIMARY KEY ( score , date , reference_ID , ID )");
 
 
182
  }
183
 
184
+ update_option('yarpp_version',YARPP_VERSION);
185
+
186
  // just in case, try to add the index one more time.
187
  if (!yarpp_enabled()) {
188
  $wpdb->query("ALTER TABLE $wpdb->posts ADD FULLTEXT `yarpp_title` ( `post_title`)");
215
  }
216
 
217
  function yarpp_options_page() {
218
+ require(YARPP_DIR.'/options.php');
219
  }
220
 
221
  // This function was written by @tyok
401
  }
402
 
403
  function yarpp_check_version_json($version) {
404
+ $remote = wp_remote_post("http://mitcho.com/code/yarpp/checkversion.php?version=$version");
405
+ if (is_wp_error($remote))
406
+ return '{}';
407
+ return $remote['body'];
 
 
 
 
 
 
408
  }
409
 
410
  function yarpp_add_metabox() {
intl.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
 
3
- include('lang/words-'.word_file_lang().'.php');
4
 
5
  function word_file_lang() {
6
  if (!defined('WPLANG'))
1
  <?php
2
 
3
+ include(YARPP_DIR.'/lang/words-'.word_file_lang().'.php');
4
 
5
  function word_file_lang() {
6
  if (!defined('WPLANG'))
magic.php CHANGED
@@ -307,14 +307,14 @@ function yarpp_related($type,$args,$echo = true,$reference_ID=false,$domain = 'w
307
  $wp_query->is_single = false;
308
 
309
  if ($domain == 'metabox') {
310
- include('template-metabox.php');
311
  } elseif ($use_template and file_exists(STYLESHEETPATH . '/' . $template_file) and $template_file != '') {
312
  ob_start();
313
  include(STYLESHEETPATH . '/' . $template_file);
314
  $output = ob_get_contents();
315
  ob_end_clean();
316
  } else {
317
- include('template-builtin.php');
318
  }
319
 
320
  unset($related_query);
307
  $wp_query->is_single = false;
308
 
309
  if ($domain == 'metabox') {
310
+ include(YARPP_DIR.'/template-metabox.php');
311
  } elseif ($use_template and file_exists(STYLESHEETPATH . '/' . $template_file) and $template_file != '') {
312
  ob_start();
313
  include(STYLESHEETPATH . '/' . $template_file);
314
  $output = ob_get_contents();
315
  ob_end_clean();
316
  } else {
317
+ include(YARPP_DIR.'/template-builtin.php');
318
  }
319
 
320
  unset($related_query);
readme.txt CHANGED
@@ -24,7 +24,7 @@ Yet Another Related Posts Plugin (YARPP) gives you a list of posts and/or pages
24
 
25
  This plugin requires that your database run on MySQL 4.1 or greater.
26
 
27
- **Other plugins by mitcho**: [HookPress](http://wordpress.org/extend/plugins/hookpress/), [Markdown for WordPress and bbPress](http://wordpress.org/extend/plugins/markdown-for-wordpress-and-bbpress/), [WP-Smartdate](http://wordpress.org/extend/plugins/wp-smartdate/).
28
 
29
  = Testimonials =
30
 
@@ -149,9 +149,13 @@ If you are a bilingual speaker of English and another language and an avid user
149
  == Changelog ==
150
 
151
  = 3.1.3 =
152
- * Turning off cache expiration, made possible by smarter caching system of 3.1—should improve database performance over time
 
 
153
  * Code cleanup
 
154
  * Bugfix: [`yearpp_clear_cache` bug on empty input](http://wordpress.org/support/topic/343001)
 
155
  = 3.1.2 =
156
  * Bugfix: [saving posts would sometimes timeout](http://wordpress.org/support/topic/343001)
157
  = 3.1.1 =
24
 
25
  This plugin requires that your database run on MySQL 4.1 or greater.
26
 
27
+ **Other plugins by mitcho**: [HookPress](http://wordpress.org/extend/plugins/hookpress/), [Plugin Beta Tester](http://wordpress.org/extend/plugins/plugin-beta-tester/), [Markdown for WordPress and bbPress](http://wordpress.org/extend/plugins/markdown-for-wordpress-and-bbpress/), [WP-Smartdate](http://wordpress.org/extend/plugins/wp-smartdate/).
28
 
29
  = Testimonials =
30
 
149
  == Changelog ==
150
 
151
  = 3.1.3 =
152
+ * Performance improvements:
153
+ * Turning off cache expiration, made possible by smarter caching system of 3.1 - should improve caching database performance over time.
154
+ * [updated primary key for cache](http://wordpress.org/support/topic/345070) by Pinoy.ca - improves client-side pageload times.
155
  * Code cleanup
156
+ * Rewrote `include` and `require` paths
157
  * Bugfix: [`yearpp_clear_cache` bug on empty input](http://wordpress.org/support/topic/343001)
158
+ * Version checking code no longer uses Snoopy.
159
  = 3.1.2 =
160
  * Bugfix: [saving posts would sometimes timeout](http://wordpress.org/support/topic/343001)
161
  = 3.1.1 =
yarpp.php CHANGED
@@ -3,17 +3,18 @@
3
  Plugin Name: Yet Another Related Posts Plugin
4
  Plugin URI: http://mitcho.com/code/yarpp/
5
  Description: Returns a list of related entries based on a unique algorithm for display on your blog and RSS feeds. A templating feature allows customization of the display.
6
- Version: 3.1.3b1
7
  Author: mitcho (Michael Yoshitaka Erlewine)
8
  Author URI: http://mitcho.com/
9
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=66G4DATK4999L&item_name=mitcho%2ecom%2fcode%3a%20donate%20to%20Michael%20Yoshitaka%20Erlewine&no_shipping=0&no_note=1&tax=0&currency_code=USD&lc=US&charset=UTF%2d8
10
  */
11
 
12
- define('YARPP_VERSION','3.1.3b1');
 
13
 
14
- require_once('includes.php');
15
- require_once('related-functions.php');
16
- require_once('template-functions.php');
17
 
18
  add_action('admin_menu','yarpp_admin_menu');
19
  add_action('admin_print_scripts','yarpp_upgrade_check');
3
  Plugin Name: Yet Another Related Posts Plugin
4
  Plugin URI: http://mitcho.com/code/yarpp/
5
  Description: Returns a list of related entries based on a unique algorithm for display on your blog and RSS feeds. A templating feature allows customization of the display.
6
+ Version: 3.1.3b2
7
  Author: mitcho (Michael Yoshitaka Erlewine)
8
  Author URI: http://mitcho.com/
9
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=66G4DATK4999L&item_name=mitcho%2ecom%2fcode%3a%20donate%20to%20Michael%20Yoshitaka%20Erlewine&no_shipping=0&no_note=1&tax=0&currency_code=USD&lc=US&charset=UTF%2d8
10
  */
11
 
12
+ define('YARPP_VERSION','3.1.3b2');
13
+ define('YARPP_DIR',dirname(__FILE__));
14
 
15
+ require_once(YARPP_DIR.'/includes.php');
16
+ require_once(YARPP_DIR.'/related-functions.php');
17
+ require_once(YARPP_DIR.'/template-functions.php');
18
 
19
  add_action('admin_menu','yarpp_admin_menu');
20
  add_action('admin_print_scripts','yarpp_upgrade_check');