Yet Another Related Posts Plugin (YARPP) - Version 3.1

Version Description

  • New snazzy options screen
  • Smarter, less confusing caching
    • No more manual caching option"on the fly" caching is always on now.
  • Bugfix: fixed related pages functionality
  • Bugfix: an issue with options saving
  • Bugfix: a slash escaping bug
  • Minor fixes:
    • Fixed yarpp_settings_link dependency when disabled.
    • Breaks (<br />) are now stripped out of titles.
    • Added plugin incompatibility info for Pagebar.
    • Faster post saving.
Download this release

Release Info

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

Code changes from version 3.1b1 to 3.1

Files changed (4) hide show
  1. includes.php +5 -0
  2. options.php +3 -5
  3. readme.txt +13 -10
  4. yarpp.php +14 -2
includes.php CHANGED
@@ -390,6 +390,11 @@ function yarpp_get_option($option,$escapehtml = false) {
390
return $return;
391
}
392
393
function yarpp_microtime_float()
394
{
395
list($usec, $sec) = explode(" ", microtime());
390
return $return;
391
}
392
393
+ function yarpp_clear_cache() {
394
+ global $wpdb;
395
+ return $wpdb->query("truncate table `{$wpdb->prefix}yarpp_related_cache`");
396
+ }
397
+
398
function yarpp_microtime_float()
399
{
400
list($usec, $sec) = explode(" ", microtime());
options.php CHANGED
@@ -96,9 +96,7 @@ if (isset($_POST['update_yarpp'])) {
96
foreach (array_keys($yarpp_binary_options) as $option) {
97
(isset($_POST[$option])) ? yarpp_set_option($option,true) : yarpp_set_option($option,false);
98
}
99
- echo '<div class="updated fade" style="background-color: rgb(207, 235, 247);"><p>'.__('Options saved!','yarpp')
100
- .' '.str_replace('<A>','<a class="thickbox" title="'.__('Related posts cache status','yarpp').'" href="#TB_inline?height=100&width=300&inlineId=yarpp-cache-status">',
101
- __('If you updated the "pool" options or "relatedness" options displayed, please rebuild your cache now from the <A>related posts status pane</a>.','yarpp')).'</p></div>';
102
}
103
104
// check if the cache is complete or not.
@@ -422,7 +420,7 @@ checkbox('auto_display',__("Automatically display related posts?",'yarpp')." <a
422
."<div id='display_demo_web' style='overflow:auto;width:350px;max-height:500px;'></div></td>");?>
423
424
<?php textbox('limit',__('Maximum number of related posts:','yarpp'))?>
425
- <?php checkbox('use_template',__("Display using a custom template file",'yarpp')." <span style='color:red;'>".__('NEW!','yarpp')."</span> <a href='#' class='info'>".__('more&gt;','yarpp')."<span>".__("This advanced option gives you full power to customize how your related posts are displayed. Templates (stored in your theme folder) are written in PHP.",'yarpp')."</span></a>","<tr valign='top'><th colspan='2'>",' class="template" onclick="javascript:template()"'); ?>
426
<tr valign='top' class='templated'>
427
<th><?php _e("Template file:",'yarpp');?></th>
428
<td>
@@ -491,7 +489,7 @@ checkbox('rss_excerpt_display',__("Display related posts in the descriptions?",'
491
<th class='th-full' colspan='2' scope='row'>",'','<td rowspan="9" style="border-left:8px transparent solid;"><b>'.__("RSS display code example",'yarpp').'</b><br /><small>'.__("(Update options to reload.)",'yarpp').'</small><br/>'
492
."<div id='display_demo_rss' style='overflow:auto;width:350px;max-height:500px;'></div></td>"); ?>
493
<?php textbox('rss_limit',__('Maximum number of related posts:','yarpp'),2)?>
494
- <?php checkbox('rss_use_template',__("Display using a custom template file",'yarpp')." <span style='color:red;'>".__('NEW!','yarpp')."</span> <a href='#' class='info'>".__('more&gt;','yarpp')."<span>".__("This advanced option gives you full power to customize how your related posts are displayed. Templates (stored in your theme folder) are written in PHP.",'yarpp')."</span></a>","<tr valign='top'><th colspan='2'>",' class="rss_template" onclick="javascript:rss_template()"'); ?>
495
<tr valign='top' class='rss_templated'>
496
<th><?php _e("Template file:",'yarpp');?></th>
497
<td>
96
foreach (array_keys($yarpp_binary_options) as $option) {
97
(isset($_POST[$option])) ? yarpp_set_option($option,true) : yarpp_set_option($option,false);
98
}
99
+ echo '<div class="updated fade" style="background-color: rgb(207, 235, 247);"><p>'.__('Options saved!','yarpp').'</p></div>';
100
}
101
102
// check if the cache is complete or not.
420
."<div id='display_demo_web' style='overflow:auto;width:350px;max-height:500px;'></div></td>");?>
421
422
<?php textbox('limit',__('Maximum number of related posts:','yarpp'))?>
423
+ <?php checkbox('use_template',__("Display using a custom template file",'yarpp')." <!--<span style='color:red;'>".__('NEW!','yarpp')."</span>--> <a href='#' class='info'>".__('more&gt;','yarpp')."<span>".__("This advanced option gives you full power to customize how your related posts are displayed. Templates (stored in your theme folder) are written in PHP.",'yarpp')."</span></a>","<tr valign='top'><th colspan='2'>",' class="template" onclick="javascript:template()"'); ?>
424
<tr valign='top' class='templated'>
425
<th><?php _e("Template file:",'yarpp');?></th>
426
<td>
489
<th class='th-full' colspan='2' scope='row'>",'','<td rowspan="9" style="border-left:8px transparent solid;"><b>'.__("RSS display code example",'yarpp').'</b><br /><small>'.__("(Update options to reload.)",'yarpp').'</small><br/>'
490
."<div id='display_demo_rss' style='overflow:auto;width:350px;max-height:500px;'></div></td>"); ?>
491
<?php textbox('rss_limit',__('Maximum number of related posts:','yarpp'),2)?>
492
+ <?php checkbox('rss_use_template',__("Display using a custom template file",'yarpp')." <!--<span style='color:red;'>".__('NEW!','yarpp')."</span>--> <a href='#' class='info'>".__('more&gt;','yarpp')."<span>".__("This advanced option gives you full power to customize how your related posts are displayed. Templates (stored in your theme folder) are written in PHP.",'yarpp')."</span></a>","<tr valign='top'><th colspan='2'>",' class="rss_template" onclick="javascript:rss_template()"'); ?>
493
<tr valign='top' class='rss_templated'>
494
<th><?php _e("Template file:",'yarpp');?></th>
495
<td>
readme.txt CHANGED
@@ -7,7 +7,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=66G4D
7
Tags: related, posts, post, pages, page, RSS, feed, feeds
8
Requires at least: 2.8
9
Tested up to: 2.9
10
- Stable tag: 3.0.13
11
12
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.
13
@@ -16,8 +16,8 @@ Returns a list of related entries based on a unique algorithm for display on you
16
Yet Another Related Posts Plugin (YARPP) gives you a list of posts and/or pages related to the current entry, introducing the reader to other relevant content on your site. Key features include:
17
18
1. **An advanced and versatile algorithm**: Using a customizable algorithm considering post titles, content, tags, and categories, YARPP calculates a "match score" for each pair of posts on your blog. You choose the threshold limit for relevance and you get more related posts if there are more related posts and less if there are less.
19
- 2. **Templating**: **New in 3.0!** A new [templating system](http://mitcho.com/blog/projects/yarpp-3-templates/) puts you in charge of how your posts are displayed.
20
- 3. **Caching**: **New in 3.0!** YARPP now caches the related posts for all the posts and thus has significantly improved performance over versions 2.x.
21
4. **Related posts in RSS feeds**: Display related posts in your RSS and Atom feeds with custom display options.
22
5. **Disallowing certain tags or categories**: You can choose certain tags or categories as disallowed, meaning any page or post with such tags or categories will not be served up by the plugin.
23
6. **Related posts and pages**: Puts you in control of pulling up related posts, pages, or both.
@@ -26,7 +26,9 @@ 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
- = Testamonials =
30
31
"As most [sports betting](http://www.betus.com/) fans use our portal, [BetUS.com Sportsbook](http://www.betus.com/sportsbook/) works hard to maintain a high level of quality on their site. Mitcho and his amazing plugins help keep us moving our technology forward. Thank you Mitcho, and the [Wordpress](http://wordpress.org) team for your service and creativity!" - [BetUS.com](http://BetUS.com/)
32
@@ -56,11 +58,11 @@ For advanced users with knowledge of PHP, there is also an [advanced manual inst
56
57
== Frequently Asked Questions ==
58
59
- If your question isn't here, ask your own question at [the Wordpress.org forums](http://wordpress.org/tags/yet-another-related-posts-plugin?forum_id=10#postform).
60
61
= Every page just says "no related posts"! What's up with that? =
62
63
- Most likely you have "no related posts" right now as the default "match threshold" is too high. Here's what I recommend to find an appropriate match threshold: first, lower your match threshold in the YARPP prefs to something ridiculously low, like 1 or 0.5. Most likely the really low threshold will pull up many posts that aren't actually related (false positives), so look at some of your posts' related posts and their match scores. This will help you find an appropriate threshold. You want it lower than what you have now, but high enough so it doesn't have many false positives.
64
65
= How do I turn off the match score next to the related posts? =
66
@@ -76,7 +78,7 @@ However, YARPP does have difficulty with languages that don't place spaces betwe
76
77
= Does YARPP slow down my blog/server? =
78
79
- A little bit, yes. YARPP 3.0 introduced a new caching mechanism which greatly reduces the hit of the computationally intensive relatedness computation. In addition, *I highly recommend all YARPP users use a page-caching plugin, such as [WP-SuperCache](http://ocaoimh.ie/wp-super-cache/).*
80
81
= I use DISQUS for comments. I can't access the YARPP options page! =
82
@@ -104,7 +106,7 @@ Please submit similar bugs by starting a new thread on [the Wordpress.org forums
104
105
= Things are weird after I upgraded. =
106
107
- I highly recommend you disactivate YARPP, replace it with the new one, and then reactivate it. If you continue to have trouble, please find
108
109
== Localizations ==
110
@@ -148,11 +150,12 @@ If you are a bilingual speaker of English and another language and an avid user
148
149
= 3.1 =
150
* New snazzy options screen
151
- * Bugfix: Fixed related pages functionality
152
* Bugfix: [an issue with options saving](http://wordpress.org/support/topic/312637)
153
* Bugfix: [a slash escaping bug](http://wordpress.org/support/topic/315560)
154
* Minor fixes:
155
- * Removing the confusing "on the fly caching" setting... it is always on now.
156
* Fixed `yarpp_settings_link` dependency when disabled.
157
* Breaks (&lt;br /&gt;) are now stripped out of titles.
158
* Added plugin incompatibility info for Pagebar.
7
Tags: related, posts, post, pages, page, RSS, feed, feeds
8
Requires at least: 2.8
9
Tested up to: 2.9
10
+ Stable tag: 3.1
11
12
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.
13
16
Yet Another Related Posts Plugin (YARPP) gives you a list of posts and/or pages related to the current entry, introducing the reader to other relevant content on your site. Key features include:
17
18
1. **An advanced and versatile algorithm**: Using a customizable algorithm considering post titles, content, tags, and categories, YARPP calculates a "match score" for each pair of posts on your blog. You choose the threshold limit for relevance and you get more related posts if there are more related posts and less if there are less.
19
+ 2. **Templating**: **New in 3.0!** The [YARPP templating system](http://mitcho.com/blog/projects/yarpp-3-templates/) puts you in charge of how your posts are displayed.
20
+ 3. **Caching**: **Improved in 3.1!** YARPP organically caches the related posts data as your site is visited, greatly improving performance.
21
4. **Related posts in RSS feeds**: Display related posts in your RSS and Atom feeds with custom display options.
22
5. **Disallowing certain tags or categories**: You can choose certain tags or categories as disallowed, meaning any page or post with such tags or categories will not be served up by the plugin.
23
6. **Related posts and pages**: Puts you in control of pulling up related posts, pages, or both.
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
+
31
+ "One of my favorite [plugin]s I just activated on my blog is called Yet Another Related Posts Plugin... I've been blogging seven or eight years now so I have a lot of archives, and it actually surprises me sometimes when I blog about something and I visit the permalink to see I've written about it before... and it also increases the traffic on your blog because when they come in just to one entry, they'll see this other stuff going on." - Matt Mullenwegg, WordPress creator
32
33
"As most [sports betting](http://www.betus.com/) fans use our portal, [BetUS.com Sportsbook](http://www.betus.com/sportsbook/) works hard to maintain a high level of quality on their site. Mitcho and his amazing plugins help keep us moving our technology forward. Thank you Mitcho, and the [Wordpress](http://wordpress.org) team for your service and creativity!" - [BetUS.com](http://BetUS.com/)
34
58
59
== Frequently Asked Questions ==
60
61
+ If your question isn't here, ask your own question at [the Wordpress.org forums](http://wordpress.org/tags/yet-another-related-posts-plugin?forum_id=10#postform). *Please do not email or tweet with questions.*
62
63
= Every page just says "no related posts"! What's up with that? =
64
65
+ Most likely you have "no related posts" right now as the default "match threshold" is too high. Here's what I recommend to find an appropriate match threshold: first, lower your match threshold in the YARPP prefs to something very low, like 1. Most likely the really low threshold will pull up many posts that aren't actually related (false positives), so look at some of your posts' related posts and their match scores. This will help you find an appropriate threshold. You want it lower than what you have now, but high enough so it doesn't have many false positives.
66
67
= How do I turn off the match score next to the related posts? =
68
78
79
= Does YARPP slow down my blog/server? =
80
81
+ A little bit, yes. However, YARPP 3.0 introduced a new caching mechanism which greatly reduces the hit of the computationally intensive relatedness computation. In addition, *I highly recommend all YARPP users use a page-caching plugin, such as [WP-SuperCache](http://ocaoimh.ie/wp-super-cache/).*
82
83
= I use DISQUS for comments. I can't access the YARPP options page! =
84
106
107
= Things are weird after I upgraded. =
108
109
+ I highly recommend you disactivate YARPP, replace it with the new one, and then reactivate it.
110
111
== Localizations ==
112
150
151
= 3.1 =
152
* New snazzy options screen
153
+ * Smarter, less confusing caching
154
+ * No more manual caching option—"on the fly" caching is always on now.
155
+ * Bugfix: [fixed related pages functionality](http://wordpress.org/support/topic/273008)
156
* Bugfix: [an issue with options saving](http://wordpress.org/support/topic/312637)
157
* Bugfix: [a slash escaping bug](http://wordpress.org/support/topic/315560)
158
* Minor fixes:
159
* Fixed `yarpp_settings_link` dependency when disabled.
160
* Breaks (&lt;br /&gt;) are now stripped out of titles.
161
* Added plugin incompatibility info for Pagebar.
yarpp.php CHANGED
@@ -3,13 +3,13 @@
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.1b1
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.1b1');
13
14
require_once('includes.php');
15
require_once('related-functions.php');
@@ -22,6 +22,18 @@ add_filter('the_content_rss','yarpp_rss',600);
22
add_filter('the_excerpt_rss','yarpp_rss_excerpt',600);
23
register_activation_hook(__FILE__,'yarpp_activate');
24
25
load_plugin_textdomain('yarpp', PLUGINDIR.'/'.dirname(plugin_basename(__FILE__)), dirname(plugin_basename(__FILE__)).'/lang',dirname(plugin_basename(__FILE__)).'/lang');
26
27
// new in 2.0: add as a widget
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
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');
13
14
require_once('includes.php');
15
require_once('related-functions.php');
22
add_filter('the_excerpt_rss','yarpp_rss_excerpt',600);
23
register_activation_hook(__FILE__,'yarpp_activate');
24
25
+ // new in 3.1: clear cache when updating certain settings.
26
+ add_action('update_option_yarpp_distags','yarpp_clear_cache');
27
+ add_action('update_option_yarpp_discats','yarpp_clear_cache');
28
+ add_action('update_option_yarpp_show_pass_post','yarpp_clear_cache');
29
+ add_action('update_option_yarpp_recent_only','yarpp_clear_cache');
30
+ add_action('update_option_yarpp_threshold','yarpp_clear_cache');
31
+ add_action('update_option_yarpp_title','yarpp_clear_cache');
32
+ add_action('update_option_yarpp_body','yarpp_clear_cache');
33
+ add_action('update_option_yarpp_categories','yarpp_clear_cache');
34
+ add_action('update_option_yarpp_tags','yarpp_clear_cache');
35
+ add_action('update_option_yarpp_tags','yarpp_clear_cache');
36
+
37
load_plugin_textdomain('yarpp', PLUGINDIR.'/'.dirname(plugin_basename(__FILE__)), dirname(plugin_basename(__FILE__)).'/lang',dirname(plugin_basename(__FILE__)).'/lang');
38
39
// new in 2.0: add as a widget