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

Version Description

Download this release

Release Info

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

Code changes from version 3.3.3b1 to 3.3.3b2

Files changed (6) hide show
  1. blogglue.php +58 -0
  2. keywords.php +7 -7
  3. options-meta-boxes.php +1 -0
  4. readme.txt +4 -3
  5. star.png +0 -0
  6. yarpp.php +8 -4
blogglue.php ADDED
@@ -0,0 +1,58 @@
1
+ <?php
2
+ function add_yarpp_blogglue_meta_box() {
3
+ class YARPP_Meta_Box_BlogGlue extends YARPP_Meta_Box {
4
+ function display() {
5
+ $pluginurl = plugin_dir_url(__FILE__);
6
+ ?>
7
+ <style type="text/css">
8
+ #blogglue_upsell {
9
+ text-align: center;
10
+ }
11
+ #blogglue_upsell ul {
12
+ list-style-type: disc;
13
+ list-style-position: inside;
14
+ text-align: left;
15
+ margin: 10px 0 10px 15px;
16
+ }
17
+ #blogglue_install_steps {
18
+ text-align: center;
19
+ height: 200px;
20
+ }
21
+ #TB_ajaxContent {
22
+ height: 220px !important;
23
+ }
24
+ ul.install_help {
25
+ list-style-type: disc;
26
+ list-style-position: inside;
27
+ text-align: left;
28
+ margin: 20px 0px;
29
+ }
30
+ </style>
31
+ <div id="blogglue_upsell">
32
+ <img src="http://s3.amazonaws.com/arkayne-media/img/logo-md.png" alt="BlogGlue Logo"/>
33
+ <ul>
34
+ <li>Display related posts from your own site as well as other sites</li>
35
+ <li>Your content linked to from related content on other sites</li>
36
+ <!--<li>Off-server Processing</li>-->
37
+ </ul>
38
+ <a href="#TB_inline?height=300&width=400&inlineId=blogglue_install" class="thickbox"><img src="http://s3.amazonaws.com/arkayne-media/img/email_try.png" alt="Upgrade"/></a><img src="http://www.blogglue.com/cohorts/track/yarpp_sidebar.gif"/>
39
+ </div>
40
+ <div id="blogglue_install" style="display: none;">
41
+ <div id="blogglue_install_steps">
42
+ <img src="http://s3.amazonaws.com/arkayne-media/img/logo.png" alt="BlogGlue Logo"/>
43
+ <ul class="install_help">
44
+ <li>Installing BlogGlue will disable YARPP</li>
45
+ <li>Your YARPP settings will still be saved</li>
46
+ <li>Once the download is complete, activate the BlogGlue plugin</li>
47
+ <li>After the plugin is activated, follow the signup instructions</li>
48
+ </ul>
49
+ <a href="<?php echo wp_nonce_url(self_admin_url('update.php?action=install-plugin&plugin=arkayne-site-to-site-related-content'), 'install-plugin_arkayne-site-to-site-related-content'); ?>"><img src="http://s3.amazonaws.com/arkayne-media/img/start_free_sm.png" width="94" height="30"/></a>
50
+ </div>
51
+ </div>
52
+ <?php
53
+ }
54
+ }
55
+
56
+ add_meta_box('yarpp_display_blogglue', 'Upgrade To BlogGlue', array(new YARPP_Meta_Box_BlogGlue, 'display'), 'settings_page_yarpp', 'side', 'core');
57
+ }
58
+ add_action( 'add_meta_boxes_settings_page_yarpp', 'add_yarpp_blogglue_meta_box' );
keywords.php CHANGED
@@ -40,23 +40,23 @@ function yarpp_extract_keywords($source,$max = 20) {
40
}
41
42
function post_title_keywords($ID,$max = 20) {
43
- return yarpp_extract_keywords(html_entity_strip(get_the_title($ID)),$max);
44
}
45
46
- function html_entity_strip($html) {
47
$html = preg_replace('/&#x[0-9a-f]+;/','',$html);
48
$html = preg_replace('/&#[0-9]+;/','',$html);
49
$html = preg_replace('/&[a-zA-Z]+;/','',$html);
50
return $html;
51
}
52
53
- function post_body_keywords($ID,$max = 20) {
54
- $posts = get_posts(array('p'=>$ID));
55
if (count($posts) != 1)
56
return '';
57
- $content = strip_tags(apply_filters_if_white('the_content',$posts[0]->post_content));
58
- $content = html_entity_strip($content);
59
- return yarpp_extract_keywords($content,$max);
60
}
61
62
/* new in 2.0! apply_filters_if_white (previously apply_filters_without) now has a blacklist. It's defined here. */
40
}
41
42
function post_title_keywords($ID,$max = 20) {
43
+ return yarpp_extract_keywords(yarpp_html_entity_strip(get_the_title($ID)),$max);
44
}
45
46
+ function yarpp_html_entity_strip( $html ) {
47
$html = preg_replace('/&#x[0-9a-f]+;/','',$html);
48
$html = preg_replace('/&#[0-9]+;/','',$html);
49
$html = preg_replace('/&[a-zA-Z]+;/','',$html);
50
return $html;
51
}
52
53
+ function post_body_keywords( $ID, $max = 20 ) {
54
+ $posts = get_posts(array('p'=>$ID,'post_type'=>'any'));
55
if (count($posts) != 1)
56
return '';
57
+ $content = strip_tags( apply_filters_if_white( 'the_content', $posts[0]->post_content ) );
58
+ $content = yarpp_html_entity_strip( $content );
59
+ return yarpp_extract_keywords( $content, $max );
60
}
61
62
/* new in 2.0! apply_filters_if_white (previously apply_filters_without) now has a blacklist. It's defined here. */
options-meta-boxes.php CHANGED
@@ -283,6 +283,7 @@ class YARPP_Meta_Box_Contact extends YARPP_Meta_Box {
283
<li style="background: url(<?php echo $pluginurl . 'wordpress.png'; ?>) no-repeat left bottom;"><a href="http://wordpress.org/tags/yet-another-related-posts-plugin" target="_blank"><?php _e('YARPP Forum', 'yarpp'); ?></a></li>
284
<li style="background: url(<?php echo $pluginurl . 'twitter.png' ; ?>) no-repeat left bottom;"><a href="http://twitter.com/yarpp" target="_blank"><?php _e('YARPP on Twitter', 'yarpp'); ?></a></li>
285
<li style="background: url(<?php echo $pluginurl . 'plugin.png'; ?>) no-repeat left bottom;"><a href="http://yarpp.org" target="_blank"><?php _e('YARPP on the Web', 'yarpp'); ?></a></li>
286
<li style="background: url(<?php echo $pluginurl . 'paypal-icon.png'; ?>) no-repeat left bottom;"><a href='http://tinyurl.com/donatetomitcho' target='_new'><img src="https://www.paypal.com/<?php echo paypal_directory(); ?>i/btn/btn_donate_SM.gif" name="submit" alt="<?php _e('Donate to mitcho (Michael Yoshitaka Erlewine) for this plugin via PayPal');?>" title="<?php _e('Donate to mitcho (Michael Yoshitaka Erlewine) for this plugin via PayPal','yarpp');?>"/></a></li>
287
</ul>
288
<?php
283
<li style="background: url(<?php echo $pluginurl . 'wordpress.png'; ?>) no-repeat left bottom;"><a href="http://wordpress.org/tags/yet-another-related-posts-plugin" target="_blank"><?php _e('YARPP Forum', 'yarpp'); ?></a></li>
284
<li style="background: url(<?php echo $pluginurl . 'twitter.png' ; ?>) no-repeat left bottom;"><a href="http://twitter.com/yarpp" target="_blank"><?php _e('YARPP on Twitter', 'yarpp'); ?></a></li>
285
<li style="background: url(<?php echo $pluginurl . 'plugin.png'; ?>) no-repeat left bottom;"><a href="http://yarpp.org" target="_blank"><?php _e('YARPP on the Web', 'yarpp'); ?></a></li>
286
+ <li style="background: url(<?php echo $pluginurl . 'star.png'; ?>) no-repeat 3px 2px;"><a href="http://wordpress.org/extend/plugins/yet-another-related-posts-plugin/" target="_blank"><?php _e('Rate YARPP on WordPress.org', 'yarpp'); ?></a></li>
287
<li style="background: url(<?php echo $pluginurl . 'paypal-icon.png'; ?>) no-repeat left bottom;"><a href='http://tinyurl.com/donatetomitcho' target='_new'><img src="https://www.paypal.com/<?php echo paypal_directory(); ?>i/btn/btn_donate_SM.gif" name="submit" alt="<?php _e('Donate to mitcho (Michael Yoshitaka Erlewine) for this plugin via PayPal');?>" title="<?php _e('Donate to mitcho (Michael Yoshitaka Erlewine) for this plugin via PayPal','yarpp');?>"/></a></li>
288
</ul>
289
<?php
readme.txt CHANGED
@@ -15,8 +15,8 @@ Display a list of related entries on your site and feeds based on a unique algor
15
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.2!** 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.
@@ -99,7 +99,7 @@ If you are in the process of looking for a hosting provider whose databases will
99
100
= Every page just says "no related posts"! What's up with that? =
101
102
- 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.
103
104
= How do I turn off the match score next to the related posts? =
105
@@ -201,6 +201,7 @@ If you are a bilingual speaker of English and another language and an avid user
201
* Init YARPP on the `init` action, [by request](https://wordpress.org/support/topic/plugin-yet-another-related-posts-plugin-load-sequence-yarpp-starts-before-the-wordpress-init-completes)
202
* Updated Polish and Italian localizations
203
* Added Dutch stopwords by Paul Kessels
204
* Code cleanup:
205
* Minor speedup to unnecessarily slow i18n code
206
* Fixed fatal error in postmeta keyword caching code
15
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. [Learn more](http://wordpress.tv/2011/01/29/michael-%E2%80%9Cmitcho%E2%80%9D-erlewine-the-yet-another-related-posts-plugin-algorithm-explained/)
19
+ 2. **Templating**: 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.2!** 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.
99
100
= Every page just says "no related posts"! What's up with that? =
101
102
+ 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 options to something very low, like 1. (If you don't see the match threshold, you may need to display the "Relatedness" options via the "Screen Options" at the top.) 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.
103
104
= How do I turn off the match score next to the related posts? =
105
201
* Init YARPP on the `init` action, [by request](https://wordpress.org/support/topic/plugin-yet-another-related-posts-plugin-load-sequence-yarpp-starts-before-the-wordpress-init-completes)
202
* Updated Polish and Italian localizations
203
* Added Dutch stopwords by Paul Kessels
204
+ * [Bug fix](http://wordpress.org/support/topic/no-related-posts-1): a fix for keyword computation for pages; may improve relatedness performance
205
* Code cleanup:
206
* Minor speedup to unnecessarily slow i18n code
207
* Fixed fatal error in postmeta keyword caching code
star.png ADDED
Binary file
yarpp.php CHANGED
@@ -3,7 +3,7 @@
3
Plugin Name: Yet Another Related Posts Plugin
4
Plugin URI: http://yarpp.org/
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.3.2b1
7
Author: mitcho (Michael Yoshitaka Erlewine)
8
Author URI: http://mitcho.com/
9
Donate link: http://tinyurl.com/donatetomitcho
@@ -13,7 +13,7 @@ Donate link: http://tinyurl.com/donatetomitcho
13
if (isset($_REQUEST['yarpp_debug']))
14
$yarpp_debug = true;
15
16
- define('YARPP_VERSION','3.3.3b1');
17
define('YARPP_DIR',dirname(__FILE__));
18
19
require_once(YARPP_DIR.'/includes.php');
@@ -49,8 +49,6 @@ function yarpp_init() {
49
add_filter('the_content_rss','yarpp_rss',600);
50
add_filter('the_excerpt_rss','yarpp_rss_excerpt',600);
51
52
- // new in 2.0: add as a widget
53
- add_action('widgets_init', 'widget_yarpp_init');
54
// new in 3.0: add meta box
55
add_action( 'admin_menu', 'yarpp_add_metabox');
56
@@ -67,4 +65,10 @@ function yarpp_init() {
67
68
require_once(YARPP_DIR . '/cache-' . YARPP_CACHE_TYPE . '.php');
69
$yarpp_cache = new $yarpp_storage_class;
70
}
3
Plugin Name: Yet Another Related Posts Plugin
4
Plugin URI: http://yarpp.org/
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.3.3b2
7
Author: mitcho (Michael Yoshitaka Erlewine)
8
Author URI: http://mitcho.com/
9
Donate link: http://tinyurl.com/donatetomitcho
13
if (isset($_REQUEST['yarpp_debug']))
14
$yarpp_debug = true;
15
16
+ define('YARPP_VERSION','3.3.3b2');
17
define('YARPP_DIR',dirname(__FILE__));
18
19
require_once(YARPP_DIR.'/includes.php');
49
add_filter('the_content_rss','yarpp_rss',600);
50
add_filter('the_excerpt_rss','yarpp_rss_excerpt',600);
51
52
// new in 3.0: add meta box
53
add_action( 'admin_menu', 'yarpp_add_metabox');
54
65
66
require_once(YARPP_DIR . '/cache-' . YARPP_CACHE_TYPE . '.php');
67
$yarpp_cache = new $yarpp_storage_class;
68
+
69
+ // new in 3.3: include BlogGlue meta box
70
+ if ( file_exists( YARPP_DIR . '/blogglue.php' ) )
71
+ include_once( YARPP_DIR . '/blogglue.php' );
72
}
73
+ // new in 2.0: add as a widget
74
+ add_action('widgets_init', 'widget_yarpp_init');