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

Version Description

Download this release

Release Info

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

Code changes from version 3.0b5 to 3.0b6

includes.php CHANGED
@@ -126,8 +126,8 @@ function yarpp_activate() {
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,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.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>';
126
  return 0;
127
  }
128
  }
129
+ add_option('yarpp_version','3.0b6');
130
+ update_option('yarpp_version','3.0b6');
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.0b6') {
182
+ update_option('yarpp_version','3.0b6');
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 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
 
4
 
5
  == INSTALLATION ==
6
 
7
+ 1. Copy the folder `yet-another-related-posts-plugin` into the directory `wp-content/plugins/` and the sample templates inside `yarpp-templates` folder into your active theme.
8
 
9
  2. Activate the plugin.
10
 
magic.php CHANGED
@@ -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.'/yarpp-templates/'.$template_file);
284
  $output = ob_get_contents();
285
  ob_end_clean();
286
  } else {
280
  include('template-metabox.php');
281
  } elseif ($use_template) {
282
  ob_start();
283
+ include(TEMPLATEPATH . '/' . $template_file);
284
  $output = ob_get_contents();
285
  ob_end_clean();
286
  } else {
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(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);
@@ -423,7 +423,7 @@ checkbox('auto_display',__("Automatically display related posts?",'yarpp')." <a
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>
@@ -488,7 +488,7 @@ checkbox('rss_excerpt_display',__("Display related posts in the descriptions?",'
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>
@@ -550,13 +550,14 @@ checkbox('rss_excerpt_display',__("Display related posts in the descriptions?",'
550
  <script type='text/javascript'>
551
  //<!--
552
  time=0;i=0;m=0;id=0;
 
553
  function yarppBuildRequest() {
554
  jQuery.ajax({
555
  url:'admin-ajax.php',
556
  type: 'post',
557
  data: {action:'yarpp_build_cache_action',i:i,m:m,id:id},
558
  dataType: 'json',
559
- timeout: 10000,
560
  success: function (json) {
561
  if (json.result == 'success') {
562
  i = json.i;
@@ -586,11 +587,13 @@ checkbox('rss_excerpt_display',__("Display related posts in the descriptions?",'
586
  m = json.m;
587
  id = json.id;
588
  }
 
589
  jQuery('#yarpp-latest').html('<?php echo str_replace('TITLE',"'+json.title+'",__('There was an error while constructing the related posts for TITLE','yarpp'))?>');
590
  jQuery('#build-cache-button').show().val('<?php _e("try to continue");?>');
591
  },
592
  error: function(json) {
593
  jQuery('#yarpp-latest').html('<?php echo str_replace('TITLE',"'+json.title+'",__('There was an error while constructing the related posts for TITLE','yarpp'))?>');
 
594
  jQuery('#build-cache-button').show().val('<?php _e("try to continue");?>');
595
  }
596
  });
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);
423
  <th><?php _e("Template file:",'yarpp');?></th>
424
  <td>
425
  <select name="template_file" id="template_file">
426
+ <?php foreach (glob(TEMPLATEPATH . '/yarpp-template-*.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>
488
  <th><?php _e("Template file:",'yarpp');?></th>
489
  <td>
490
  <select name="rss_template_file" id="rss_template_file">
491
+ <?php foreach (glob(TEMPLATEPATH . '/yarpp-template-*.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>
550
  <script type='text/javascript'>
551
  //<!--
552
  time=0;i=0;m=0;id=0;
553
+ timeout = 10000;
554
  function yarppBuildRequest() {
555
  jQuery.ajax({
556
  url:'admin-ajax.php',
557
  type: 'post',
558
  data: {action:'yarpp_build_cache_action',i:i,m:m,id:id},
559
  dataType: 'json',
560
+ timeout: timeout,
561
  success: function (json) {
562
  if (json.result == 'success') {
563
  i = json.i;
587
  m = json.m;
588
  id = json.id;
589
  }
590
+ timeout += 5000;
591
  jQuery('#yarpp-latest').html('<?php echo str_replace('TITLE',"'+json.title+'",__('There was an error while constructing the related posts for TITLE','yarpp'))?>');
592
  jQuery('#build-cache-button').show().val('<?php _e("try to continue");?>');
593
  },
594
  error: function(json) {
595
  jQuery('#yarpp-latest').html('<?php echo str_replace('TITLE',"'+json.title+'",__('There was an error while constructing the related posts for TITLE','yarpp'))?>');
596
+ timeout += 5000;
597
  jQuery('#build-cache-button').show().val('<?php _e("try to continue");?>');
598
  }
599
  });
yarpp-templates/{template-example.php → yarpp-template-example.php} RENAMED
File without changes
yarpp-templates/{template-list.php → yarpp-template-list.php} RENAMED
File without changes
yarpp-templates/{template-photoblog.php → yarpp-template-photoblog.php} RENAMED
File without changes
yarpp-templates/{template-random.php → yarpp-template-random.php} RENAMED
File without changes
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 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
  */
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.0b6
7
  Author: mitcho (Michael Yoshitaka Erlewine)
8
  Author URI: http://mitcho.com/
9
  */