Yet Another Related Posts Plugin (YARPP) - Version 3.0.2

Version Description

Download this release

Release Info

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

Code changes from version 3.0.1 to 3.0.2

Files changed (5) hide show
  1. includes.php +4 -4
  2. magic.php +5 -2
  3. options.php +5 -5
  4. readme.txt +4 -1
  5. yarpp.php +1 -1
includes.php CHANGED
@@ -126,8 +126,8 @@ function yarpp_activate() {
126
  return 0;
127
  }
128
  }
129
- add_option('yarpp_version','3.01');
130
- update_option('yarpp_version','3.01');
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.01 or get_option('yarpp_version') != '3.01') {
182
- update_option('yarpp_version','3.01');
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>';
126
  return 0;
127
  }
128
  }
129
+ add_option('yarpp_version','3.02');
130
+ update_option('yarpp_version','3.02');
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.02 or get_option('yarpp_version') != '3.02') {
182
+ update_option('yarpp_version','3.02');
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>';
magic.php CHANGED
@@ -295,9 +295,9 @@ function yarpp_related($type,$args,$echo = true,$reference_ID=false,$domain = 'w
295
 
296
  if ($domain == 'metabox') {
297
  include('template-metabox.php');
298
- } elseif ($use_template and file_exists(TEMPLATEPATH . '/' . $template_file)) {
299
  ob_start();
300
- include(TEMPLATEPATH . '/' . $template_file);
301
  $output = ob_get_contents();
302
  ob_end_clean();
303
  } else {
@@ -381,6 +381,9 @@ function yarpp_save_cache($post_ID,$force=true) {
381
  function yarpp_cache_enforce($type=array('post'),$reference_ID,$force=false) {
382
  global $wpdb, $yarpp_debug, $yarpp_caching_queue;
383
 
 
 
 
384
  $timeout = 600;
385
 
386
  if (!$force) {
295
 
296
  if ($domain == 'metabox') {
297
  include('template-metabox.php');
298
+ } elseif ($use_template and file_exists(STYLESHEETPATH . '/' . $template_file)) {
299
  ob_start();
300
+ include(STYLESHEETPATH . '/' . $template_file);
301
  $output = ob_get_contents();
302
  ob_end_clean();
303
  } else {
381
  function yarpp_cache_enforce($type=array('post'),$reference_ID,$force=false) {
382
  global $wpdb, $yarpp_debug, $yarpp_caching_queue;
383
 
384
+ if ($reference_ID === '' || $reference_ID === false)
385
+ return false;
386
+
387
  $timeout = 600;
388
 
389
  if (!$force) {
options.php CHANGED
@@ -4,15 +4,15 @@ 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(TEMPLATEPATH . '/yarpp-template-*.php'))) {
8
  if (count(glob(WP_CONTENT_DIR.'/plugins/yet-another-related-posts-plugin/yarpp-templates/yarpp-template-*.php')))
9
  echo "<div class='updated'>"
10
- .str_replace("TEMPLATEPATH",TEMPLATEPATH,__("Please move the YARPP template files into your theme to complete installation. Simply move the sample template files (currently in <code>wp-content/plugins/yet-another-related-posts-plugin/yarpp-templates/</code>) to the <code>TEMPLATEPATH</code> directory.",'yarpp'))
11
  ."</div>";
12
 
13
  else
14
  echo "<div class='updated'>"
15
- .str_replace('TEMPLATEPATH',TEMPLATEPATH,__("No YARPP template files were found in your theme (<code>TEMPLATEPATH</code>) so the templating feature has been turned off.",'yarpp'))
16
  ."</div>";
17
 
18
  yarpp_set_option('use_template',false);
@@ -412,7 +412,7 @@ checkbox('auto_display',__("Automatically display related posts?",'yarpp')." <a
412
  <th><?php _e("Template file:",'yarpp');?></th>
413
  <td>
414
  <select name="template_file" id="template_file">
415
- <?php foreach (glob(TEMPLATEPATH . '/yarpp-template-*.php') as $template): ?>
416
  <option value='<?php echo htmlspecialchars(basename($template))?>'<?php echo (basename($template)==yarpp_get_option('template_file'))?" selected='selected'":'';?>><?php echo htmlspecialchars(basename($template))?></option>
417
  <?php endforeach; ?>
418
  </select>
@@ -476,7 +476,7 @@ checkbox('rss_excerpt_display',__("Display related posts in the descriptions?",'
476
  <th><?php _e("Template file:",'yarpp');?></th>
477
  <td>
478
  <select name="rss_template_file" id="rss_template_file">
479
- <?php foreach (glob(TEMPLATEPATH . '/yarpp-template-*.php') as $template): ?>
480
  <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>
481
  <?php endforeach; ?>
482
  </select>
4
 
5
  // check to see that templates are in the right place
6
 
7
+ if (!count(glob(STYLESHEETPATH . '/yarpp-template-*.php'))) {
8
  if (count(glob(WP_CONTENT_DIR.'/plugins/yet-another-related-posts-plugin/yarpp-templates/yarpp-template-*.php')))
9
  echo "<div class='updated'>"
10
+ .str_replace("TEMPLATEPATH",STYLESHEETPATH,__("Please move the YARPP template files into your theme to complete installation. Simply move the sample template files (currently in <code>wp-content/plugins/yet-another-related-posts-plugin/yarpp-templates/</code>) to the <code>TEMPLATEPATH</code> directory.",'yarpp'))
11
  ."</div>";
12
 
13
  else
14
  echo "<div class='updated'>"
15
+ .str_replace('TEMPLATEPATH',STYLESHEETPATH,__("No YARPP template files were found in your theme (<code>TEMPLATEPATH</code>) so the templating feature has been turned off.",'yarpp'))
16
  ."</div>";
17
 
18
  yarpp_set_option('use_template',false);
412
  <th><?php _e("Template file:",'yarpp');?></th>
413
  <td>
414
  <select name="template_file" id="template_file">
415
+ <?php foreach (glob(STYLESHEETPATH . '/yarpp-template-*.php') as $template): ?>
416
  <option value='<?php echo htmlspecialchars(basename($template))?>'<?php echo (basename($template)==yarpp_get_option('template_file'))?" selected='selected'":'';?>><?php echo htmlspecialchars(basename($template))?></option>
417
  <?php endforeach; ?>
418
  </select>
476
  <th><?php _e("Template file:",'yarpp');?></th>
477
  <td>
478
  <select name="rss_template_file" id="rss_template_file">
479
+ <?php foreach (glob(STYLESHEETPATH . '/yarpp-template-*.php') as $template): ?>
480
  <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>
481
  <?php endforeach; ?>
482
  </select>
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.3
9
  Tested up to: 2.7.2
10
- Stable tag: 3.0.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
 
@@ -219,3 +219,6 @@ If you are a bilingual speaker of English and another language and an avid user
219
  * New and updated localizations
220
  * 3.0.1
221
  * Bugfix: In some situations before YARPP options were updated, an `include` PHP error was displayed.
 
 
 
7
  Tags: related, posts, post, pages, page, RSS, feed, feeds
8
  Requires at least: 2.3
9
  Tested up to: 2.7.2
10
+ Stable tag: 3.0.2
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
 
219
  * New and updated localizations
220
  * 3.0.1
221
  * Bugfix: In some situations before YARPP options were updated, an `include` PHP error was displayed.
222
+ * 3.0.2
223
+ * Bugfix: [Templating wasn't working with child templates.](http://wordpress.org/support/topic/265515)
224
+ * Bugfix: In some situations, [SQL errors were printed in the AJAX preview displays](http://wordpress.org/support/topic/265728).
yarpp.php CHANGED
@@ -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 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.0.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
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.0.2
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