Yet Another Related Posts Plugin (YARPP) - Version 3.0b5

Version Description

Download this release

Release Info

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

Code changes from version 3.0b4 to 3.0b5

Files changed (24) hide show
  1. {yet-another-related-posts-plugin/i → i}/close.gif +0 -0
  2. {yet-another-related-posts-plugin/i → i}/spin.gif +0 -0
  3. yet-another-related-posts-plugin/includes.php → includes.php +5 -5
  4. install.txt +1 -1
  5. yet-another-related-posts-plugin/intl.php → intl.php +0 -0
  6. yet-another-related-posts-plugin/keywords.php → keywords.php +0 -0
  7. {yet-another-related-posts-plugin/lang → lang}/words-de_DE.php +0 -0
  8. {yet-another-related-posts-plugin/lang → lang}/words-en_US.php +0 -0
  9. {yet-another-related-posts-plugin/lang → lang}/yarpp-de_DE.mo +0 -0
  10. {yet-another-related-posts-plugin/lang → lang}/yarpp-de_DE.po +0 -0
  11. {yet-another-related-posts-plugin/lang → lang}/yarpp-ja.mo +0 -0
  12. {yet-another-related-posts-plugin/lang → lang}/yarpp-ja_JP.po +0 -0
  13. {yet-another-related-posts-plugin/lang → lang}/yarpp-zh_CN.mo +0 -0
  14. {yet-another-related-posts-plugin/lang → lang}/yarpp-zh_CN.po +0 -0
  15. yet-another-related-posts-plugin/magic.php → magic.php +2 -2
  16. yet-another-related-posts-plugin/options.css → options.css +0 -0
  17. yet-another-related-posts-plugin/options.php → options.php +24 -6
  18. readme.txt +1 -1
  19. yet-another-related-posts-plugin/related-functions.php → related-functions.php +0 -0
  20. yet-another-related-posts-plugin/services.php → services.php +0 -0
  21. yet-another-related-posts-plugin/template-builtin.php → template-builtin.php +0 -0
  22. yet-another-related-posts-plugin/template-functions.php → template-functions.php +0 -0
  23. yet-another-related-posts-plugin/template-metabox.php → template-metabox.php +0 -0
  24. yet-another-related-posts-plugin/yarpp.php → yarpp.php +1 -1
{yet-another-related-posts-plugin/i → i}/close.gif RENAMED
File without changes
{yet-another-related-posts-plugin/i → i}/spin.gif RENAMED
File without changes
yet-another-related-posts-plugin/includes.php → includes.php RENAMED
@@ -111,7 +111,7 @@ function yarpp_activate() {
111
  $wpdb->print_error();
112
  echo "-->";
113
  }
114
- if (!$wpdb->query("CREATE TABLE IF NOT EXISTS `wp_yarpp_related_cache` (
115
  `reference_ID` bigint(20) unsigned NOT NULL default '0',
116
  `ID` bigint(20) unsigned NOT NULL default '0',
117
  `score` float unsigned NOT NULL default '0',
@@ -126,8 +126,8 @@ function yarpp_activate() {
126
  return 0;
127
  }
128
  }
129
- add_option('yarpp_version','3.0b4');
130
- update_option('yarpp_version','3.0b4');
131
  return 1;
132
  }
133
 
@@ -178,8 +178,8 @@ function yarpp_upgrade_check($inuse = false) {
178
  $wpdb->query("ALTER TABLE $wpdb->posts ADD FULLTEXT `yarpp_content` ( `post_content`)"); update_option('yarpp_version','2.03');
179
  }
180
 
181
- if (eregi_replace('[a-z].*$','',get_option('yarpp_version')) < 3.0 or get_option('yarpp_version') != '3.0b4') {
182
- update_option('yarpp_version','3.0b4');
183
 
184
  //if (!$inuse)
185
  // 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>';
111
  $wpdb->print_error();
112
  echo "-->";
113
  }
114
+ if (!$wpdb->query("CREATE TABLE IF NOT EXISTS `{$wpdb->prefix}yarpp_related_cache` (
115
  `reference_ID` bigint(20) unsigned NOT NULL default '0',
116
  `ID` bigint(20) unsigned NOT NULL default '0',
117
  `score` float unsigned NOT NULL default '0',
126
  return 0;
127
  }
128
  }
129
+ add_option('yarpp_version','3.0b5');
130
+ update_option('yarpp_version','3.0b5');
131
  return 1;
132
  }
133
 
178
  $wpdb->query("ALTER TABLE $wpdb->posts ADD FULLTEXT `yarpp_content` ( `post_content`)"); update_option('yarpp_version','2.03');
179
  }
180
 
181
+ if (eregi_replace('[a-z].*$','',get_option('yarpp_version')) < 3.0 or get_option('yarpp_version') != '3.0b5') {
182
+ update_option('yarpp_version','3.0b5');
183
 
184
  //if (!$inuse)
185
  // 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>';
install.txt CHANGED
@@ -4,7 +4,7 @@ Twitter: http://twitter.com/yarpp/
4
 
5
  == INSTALLATION ==
6
 
7
- 1. Copy the folders `yet-another-related-posts-plugin` and `yarpp-templates` into the directory `wp-content/plugins/`.
8
 
9
  2. Activate the plugin.
10
 
4
 
5
  == INSTALLATION ==
6
 
7
+ 1. Copy the folder `yet-another-related-posts-plugin` into the directory `wp-content/plugins/` and the `yarpp-templates` folder into `wp-content/`. **`yarpp-templates` should be a sister of `plugins`.**
8
 
9
  2. Activate the plugin.
10
 
yet-another-related-posts-plugin/intl.php → intl.php RENAMED
File without changes
yet-another-related-posts-plugin/keywords.php → keywords.php RENAMED
File without changes
{yet-another-related-posts-plugin/lang → lang}/words-de_DE.php RENAMED
File without changes
{yet-another-related-posts-plugin/lang → lang}/words-en_US.php RENAMED
File without changes
{yet-another-related-posts-plugin/lang → lang}/yarpp-de_DE.mo RENAMED
File without changes
{yet-another-related-posts-plugin/lang → lang}/yarpp-de_DE.po RENAMED
File without changes
{yet-another-related-posts-plugin/lang → lang}/yarpp-ja.mo RENAMED
File without changes
{yet-another-related-posts-plugin/lang → lang}/yarpp-ja_JP.po RENAMED
File without changes
{yet-another-related-posts-plugin/lang → lang}/yarpp-zh_CN.mo RENAMED
File without changes
{yet-another-related-posts-plugin/lang → lang}/yarpp-zh_CN.po RENAMED
File without changes
yet-another-related-posts-plugin/magic.php → magic.php RENAMED
@@ -27,7 +27,7 @@ function yarpp_where_filter($arg) {
27
  $arg = str_replace("$wpdb->posts.ID = ","yarpp.score > $threshold and yarpp.reference_ID = ",$arg);
28
  if (yarpp_get_option("recent_only"))
29
  $arg .= " and post_date > date_sub(now(), interval ".yarpp_get_option("recent_number")." ".yarpp_get_option("recent_units").") ";
30
- echo "<!--YARPP TEST: $arg-->";
31
  }
32
  return $arg;
33
  }
@@ -280,7 +280,7 @@ function yarpp_related($type,$args,$echo = true,$reference_ID=false,$domain = 'w
280
  include('template-metabox.php');
281
  } elseif ($use_template) {
282
  ob_start();
283
- include(WP_CONTENT_DIR.'/plugins/yarpp-templates/'.$template_file);
284
  $output = ob_get_contents();
285
  ob_end_clean();
286
  } else {
27
  $arg = str_replace("$wpdb->posts.ID = ","yarpp.score > $threshold and yarpp.reference_ID = ",$arg);
28
  if (yarpp_get_option("recent_only"))
29
  $arg .= " and post_date > date_sub(now(), interval ".yarpp_get_option("recent_number")." ".yarpp_get_option("recent_units").") ";
30
+ //echo "<!--YARPP TEST: $arg-->";
31
  }
32
  return $arg;
33
  }
280
  include('template-metabox.php');
281
  } elseif ($use_template) {
282
  ob_start();
283
+ include(WP_CONTENT_DIR.'/yarpp-templates/'.$template_file);
284
  $output = ob_get_contents();
285
  ob_end_clean();
286
  } else {
yet-another-related-posts-plugin/options.css → options.css RENAMED
File without changes
yet-another-related-posts-plugin/options.php → options.php RENAMED
@@ -2,10 +2,28 @@
2
 
3
  global $wpdb, $yarpp_value_options, $yarpp_binary_options, $wp_version;
4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
  if ($_POST['myisam_override']) {
6
  yarpp_set_option('myisam_override',1);
7
  echo "<div class='updated'>"
8
- .__("The MyISAM check has been overridden. You may now use the \"consider titles\" and \"consider bodies\" relatedness criteria.")
9
  ."</div>";
10
  }
11
 
@@ -243,7 +261,6 @@ function load_display_discats() {
243
  </script>
244
 
245
  <div class="wrap">
246
- <a href='https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=66G4DATK4999L&item_name=mitcho%2ecom%2fcode%3a%20donate%20to%20Michael%20Yoshitaka%20Erlewine&no_shipping=1&no_note=1&tax=0&currency_code=USD&lc=US&charset=UTF%2d8' 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');?>" style="float:right" /></a>
247
  <h2>
248
  <?php _e('Yet Another Related Posts Plugin Options','yarpp');?> <small><?php
249
 
@@ -262,6 +279,7 @@ function load_display_discats() {
262
 
263
  <form method="post">
264
 
 
265
 
266
  <p><small><?php _e('by <a href="http://mitcho.com/code/">mitcho (Michael 芳貴 Erlewine)</a>','yarpp');?>. <?php _e('Follow <a href="http://twitter.com/yarpp/">Yet Another Related Posts Plugin on Twitter</a>','yarpp');?>.</small></p>
267
 
@@ -400,12 +418,12 @@ checkbox('auto_display',__("Automatically display related posts?",'yarpp')." <a
400
  ."<div id='display_demo_web' style='overflow:auto;width:350px;max-height:500px;'></div></td>");?>
401
 
402
  <?php textbox('limit',__('Maximum number of related posts:','yarpp'))?>
403
- <?php checkbox('use_template',__("Display using a custom template file",'yarpp')." <span style='color:red;'>NEW!</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 (in the <code>wp-content/plugins/yarpp-templates</code> directory) are written in PHP.",'yarpp')."</span></a>","<tr valign='top'><th colspan='2'>",' class="template" onclick="javascript:template()"'); ?>
404
  <tr valign='top' class='templated'>
405
  <th><?php _e("Template file:",'yarpp');?></th>
406
  <td>
407
  <select name="template_file" id="template_file">
408
- <?php foreach (glob(WP_CONTENT_DIR.'/plugins/yarpp-templates/*.php') as $template): ?>
409
  <option value='<?php echo htmlspecialchars(basename($template))?>'<?php echo (basename($template)==yarpp_get_option('template_file'))?" selected='selected'":'';?>><?php echo htmlspecialchars(basename($template))?></option>
410
  <?php endforeach; ?>
411
  </select>
@@ -465,12 +483,12 @@ checkbox('rss_excerpt_display',__("Display related posts in the descriptions?",'
465
  <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/>'
466
  ."<div id='display_demo_rss' style='overflow:auto;width:350px;max-height:500px;'></div></td>"); ?>
467
  <?php textbox('rss_limit',__('Maximum number of related posts:','yarpp'),2)?>
468
- <?php checkbox('rss_use_template',__("Display using a custom template file",'yarpp')." <span style='color:red;'>NEW!</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 (in the <code>wp-content/plugins/yarpp-templates</code> directory) are written in PHP.",'yarpp')."</span></a>","<tr valign='top'><th colspan='2'>",' class="rss_template" onclick="javascript:rss_template()"'); ?>
469
  <tr valign='top' class='rss_templated'>
470
  <th><?php _e("Template file:",'yarpp');?></th>
471
  <td>
472
  <select name="rss_template_file" id="rss_template_file">
473
- <?php foreach (glob(WP_CONTENT_DIR.'/plugins/yarpp-templates/*.php') as $template): ?>
474
  <option value='<?php echo htmlspecialchars(basename($template))?>'<?php echo (basename($template)==yarpp_get_option('rss_template_file'))?" selected='selected'":'';?>><?php echo htmlspecialchars(basename($template))?></option>
475
  <?php endforeach; ?>
476
  </select>
2
 
3
  global $wpdb, $yarpp_value_options, $yarpp_binary_options, $wp_version;
4
 
5
+ // check to see that templates are in the right place
6
+
7
+ if (!count(glob(WP_CONTENT_DIR.'/yarpp-templates/*.php'))) {
8
+ if (count(glob(WP_CONTENT_DIR.'/plugins/yet-another-related-posts-plugins/yarpp-templates/*.php')))
9
+ echo "<div class='updated'>"
10
+ .__("Please move the YARPP template files into their proper location to complete installation. Simply move the <code>yarpp-templates</code> folder (currently in <code>wp-content/plugins/yet-another-related-posts-plugin/</code>) to the <code>wp-content/</code> directory.",'yarpp')
11
+ ."</div>";
12
+
13
+ else
14
+ echo "<div class='updated'>"
15
+ .__("No YARPP template files were found (in <code>wp-content/yarpp-templates</code>) and so the templating feature has been turned off.",'yarpp')
16
+ ."</div>";
17
+
18
+ yarpp_set_option('use_template',false);
19
+ yarpp_set_option('rss_use_template',false);
20
+
21
+ }
22
+
23
  if ($_POST['myisam_override']) {
24
  yarpp_set_option('myisam_override',1);
25
  echo "<div class='updated'>"
26
+ .__("The MyISAM check has been overridden. You may now use the \"consider titles\" and \"consider bodies\" relatedness criteria.",'yarpp')
27
  ."</div>";
28
  }
29
 
261
  </script>
262
 
263
  <div class="wrap">
 
264
  <h2>
265
  <?php _e('Yet Another Related Posts Plugin Options','yarpp');?> <small><?php
266
 
279
 
280
  <form method="post">
281
 
282
+ <a href='https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=66G4DATK4999L&item_name=mitcho%2ecom%2fcode%3a%20donate%20to%20Michael%20Yoshitaka%20Erlewine&no_shipping=1&no_note=1&tax=0&currency_code=USD&lc=US&charset=UTF%2d8' 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');?>" style="float:right" /></a>
283
 
284
  <p><small><?php _e('by <a href="http://mitcho.com/code/">mitcho (Michael 芳貴 Erlewine)</a>','yarpp');?>. <?php _e('Follow <a href="http://twitter.com/yarpp/">Yet Another Related Posts Plugin on Twitter</a>','yarpp');?>.</small></p>
285
 
418
  ."<div id='display_demo_web' style='overflow:auto;width:350px;max-height:500px;'></div></td>");?>
419
 
420
  <?php textbox('limit',__('Maximum number of related posts:','yarpp'))?>
421
+ <?php checkbox('use_template',__("Display using a custom template file",'yarpp')." <span style='color:red;'>NEW!</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 (in the <code>wp-content/yarpp-templates</code> directory) are written in PHP.",'yarpp')."</span></a>","<tr valign='top'><th colspan='2'>",' class="template" onclick="javascript:template()"'); ?>
422
  <tr valign='top' class='templated'>
423
  <th><?php _e("Template file:",'yarpp');?></th>
424
  <td>
425
  <select name="template_file" id="template_file">
426
+ <?php foreach (glob(WP_CONTENT_DIR.'/yarpp-templates/*.php') as $template): ?>
427
  <option value='<?php echo htmlspecialchars(basename($template))?>'<?php echo (basename($template)==yarpp_get_option('template_file'))?" selected='selected'":'';?>><?php echo htmlspecialchars(basename($template))?></option>
428
  <?php endforeach; ?>
429
  </select>
483
  <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/>'
484
  ."<div id='display_demo_rss' style='overflow:auto;width:350px;max-height:500px;'></div></td>"); ?>
485
  <?php textbox('rss_limit',__('Maximum number of related posts:','yarpp'),2)?>
486
+ <?php checkbox('rss_use_template',__("Display using a custom template file",'yarpp')." <span style='color:red;'>NEW!</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 (in the <code>wp-content/yarpp-templates</code> directory) are written in PHP.",'yarpp')."</span></a>","<tr valign='top'><th colspan='2'>",' class="rss_template" onclick="javascript:rss_template()"'); ?>
487
  <tr valign='top' class='rss_templated'>
488
  <th><?php _e("Template file:",'yarpp');?></th>
489
  <td>
490
  <select name="rss_template_file" id="rss_template_file">
491
+ <?php foreach (glob(WP_CONTENT_DIR.'/yarpp-templates/*.php') as $template): ?>
492
  <option value='<?php echo htmlspecialchars(basename($template))?>'<?php echo (basename($template)==yarpp_get_option('rss_template_file'))?" selected='selected'":'';?>><?php echo htmlspecialchars(basename($template))?></option>
493
  <?php endforeach; ?>
494
  </select>
readme.txt CHANGED
@@ -6,7 +6,7 @@ Plugin URI: http://mitcho.com/code/yarpp/
6
  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
7
  Tags: related, posts, post, pages, page, RSS, feed, feeds
8
  Requires at least: 2.3
9
- Tested up to: 2.7
10
  Stable tag: 2.1.6
11
 
12
  Returns a list of the related entries based on a unique algorithm using titles, post bodies, tags, and categories. Now with RSS feed support!
6
  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
7
  Tags: related, posts, post, pages, page, RSS, feed, feeds
8
  Requires at least: 2.3
9
+ Tested up to: 2.7.1
10
  Stable tag: 2.1.6
11
 
12
  Returns a list of the related entries based on a unique algorithm using titles, post bodies, tags, and categories. Now with RSS feed support!
yet-another-related-posts-plugin/related-functions.php → related-functions.php RENAMED
File without changes
yet-another-related-posts-plugin/services.php → services.php RENAMED
File without changes
yet-another-related-posts-plugin/template-builtin.php → template-builtin.php RENAMED
File without changes
yet-another-related-posts-plugin/template-functions.php → template-functions.php RENAMED
File without changes
yet-another-related-posts-plugin/template-metabox.php → template-metabox.php RENAMED
File without changes
yet-another-related-posts-plugin/yarpp.php → yarpp.php RENAMED
@@ -3,7 +3,7 @@
3
  Plugin Name: Yet Another Related Posts Plugin
4
  Plugin URI: http://mitcho.com/code/yarpp/
5
  Description: Returns a list of the related entries based on a unique algorithm using titles, post bodies, tags, and categories. Now with RSS feed support!
6
- Version: 3.0b4
7
  Author: mitcho (Michael Yoshitaka Erlewine)
8
  Author URI: http://mitcho.com/
9
  */
3
  Plugin Name: Yet Another Related Posts Plugin
4
  Plugin URI: http://mitcho.com/code/yarpp/
5
  Description: Returns a list of the related entries based on a unique algorithm using titles, post bodies, tags, and categories. Now with RSS feed support!
6
+ Version: 3.0b5
7
  Author: mitcho (Michael Yoshitaka Erlewine)
8
  Author URI: http://mitcho.com/
9
  */