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

Version Description

Download this release

Release Info

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

Code changes from version 3.2b1 to 3.2b2

Files changed (3) hide show
  1. includes.php +7 -3
  2. magic.php +2 -6
  3. yarpp.php +2 -14
includes.php CHANGED
@@ -56,6 +56,7 @@ $yarpp_binary_options = array('past_only' => true,
56
'rss_excerpt_display' => true,
57
'promote_yarpp' => false,
58
'rss_promote_yarpp' => false);
59
60
function yarpp_enabled() {
61
global $wpdb;
@@ -418,16 +419,19 @@ function yarpp_excerpt($content,$length) {
418
}
419
420
function yarpp_set_option($option,$value) {
421
- global $yarpp_value_options;
422
- if (array_search($option,array_keys($yarpp_value_options)) === true)
423
update_option("yarpp_$option",$value.' ');
424
else
425
update_option("yarpp_$option",$value);
426
}
427
428
function yarpp_get_option($option,$escapehtml = false) {
429
global $yarpp_value_options;
430
- if (!(array_search($option,array_keys($yarpp_value_options)) === false))
431
$return = chop(get_option("yarpp_$option"));
432
else
433
$return = get_option("yarpp_$option");
56
'rss_excerpt_display' => true,
57
'promote_yarpp' => false,
58
'rss_promote_yarpp' => false);
59
+ $yarpp_clear_cache_options = array('distags','discats','show_pass_post','recent_only','threshold','title','body','categories','tags');
60
61
function yarpp_enabled() {
62
global $wpdb;
419
}
420
421
function yarpp_set_option($option,$value) {
422
+ global $yarpp_value_options, $yarpp_clear_cache_options;
423
+ if (array_search($option,array_keys($yarpp_value_options)) !== false)
424
update_option("yarpp_$option",$value.' ');
425
else
426
update_option("yarpp_$option",$value);
427
+ // new in 3.1: clear cache when updating certain settings.
428
+ if (array_search($option,yarpp_clear_cache_options) !== false)
429
+ yarpp_clear_cache();
430
}
431
432
function yarpp_get_option($option,$escapehtml = false) {
433
global $yarpp_value_options;
434
+ if (array_search($option,array_keys($yarpp_value_options)) !== false)
435
$return = chop(get_option("yarpp_$option"));
436
else
437
$return = get_option("yarpp_$option");
magic.php CHANGED
@@ -49,7 +49,7 @@ function yarpp_limit_filter($arg) {
49
50
function yarpp_fields_filter($arg) {
51
global $wpdb, $yarpp_time, $wpdb, $yarpp_related_postdata;
52
- if ($yarpp_time) {
53
$scores = array();
54
foreach ($yarpp_related_postdata as $related_entry) {
55
$scores[] = " WHEN {$related_entry['ID']} THEN {$related_entry['score']}";
@@ -233,10 +233,6 @@ function yarpp_sql($type,$args,$giveresults = true,$reference_ID=false,$domain='
233
function yarpp_related($type,$args,$echo = true,$reference_ID=false,$domain = 'website') {
234
global $wpdb, $post, $userdata, $yarpp_time, $yarpp_demo_time, $wp_query, $id, $page, $pages, $authordata, $day, $currentmonth, $multipage, $more, $numpages, $yarpp_related_postdata, $yarpp_related_IDs;
235
236
- if ($yarpp_debug) {
237
- echo "rar!";
238
- }
239
-
240
if ($domain != 'demo_web' and $domain != 'demo_rss') {
241
if ($yarpp_time) // if we're already in a YARPP loop, stop now.
242
return false;
@@ -283,7 +279,7 @@ function yarpp_related($type,$args,$echo = true,$reference_ID=false,$domain = 'w
283
// get the related posts from postdata, and also construct the relate_IDs array
284
$yarpp_related_postdata = get_post_meta($reference_ID,YARPP_POSTMETA_RELATED_KEY,true);
285
$yarpp_related_IDs = array();
286
- if ($yarpp_related_postdata)
287
$yarpp_related_IDs = array_map(create_function('$x','return $x["ID"];'), $yarpp_related_postdata);
288
} else
289
$yarpp_demo_time = true;
49
50
function yarpp_fields_filter($arg) {
51
global $wpdb, $yarpp_time, $wpdb, $yarpp_related_postdata;
52
+ if ($yarpp_time && is_array($yarpp_related_postdata)) {
53
$scores = array();
54
foreach ($yarpp_related_postdata as $related_entry) {
55
$scores[] = " WHEN {$related_entry['ID']} THEN {$related_entry['score']}";
233
function yarpp_related($type,$args,$echo = true,$reference_ID=false,$domain = 'website') {
234
global $wpdb, $post, $userdata, $yarpp_time, $yarpp_demo_time, $wp_query, $id, $page, $pages, $authordata, $day, $currentmonth, $multipage, $more, $numpages, $yarpp_related_postdata, $yarpp_related_IDs;
235
236
if ($domain != 'demo_web' and $domain != 'demo_rss') {
237
if ($yarpp_time) // if we're already in a YARPP loop, stop now.
238
return false;
279
// get the related posts from postdata, and also construct the relate_IDs array
280
$yarpp_related_postdata = get_post_meta($reference_ID,YARPP_POSTMETA_RELATED_KEY,true);
281
$yarpp_related_IDs = array();
282
+ if ($yarpp_related_postdata && is_array($yarpp_related_postdata))
283
$yarpp_related_IDs = array_map(create_function('$x','return $x["ID"];'), $yarpp_related_postdata);
284
} else
285
$yarpp_demo_time = true;
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.2b1
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
@@ -11,7 +11,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_donations&business=66G4D
11
if (isset($_REQUEST['yarpp_debug']))
12
$yarpp_debug = true;
13
14
- define('YARPP_VERSION','3.2b1');
15
define('YARPP_DIR',dirname(__FILE__));
16
17
define('YARPP_POSTMETA_TITLE_KEYWORDS_KEY','_yarpp_title_keywords');
@@ -30,18 +30,6 @@ add_filter('the_content_rss','yarpp_rss',600);
30
add_filter('the_excerpt_rss','yarpp_rss_excerpt',600);
31
register_activation_hook(__FILE__,'yarpp_activate');
32
33
- // new in 3.1: clear cache when updating certain settings.
34
- add_action('update_option_yarpp_distags','yarpp_clear_cache');
35
- add_action('update_option_yarpp_discats','yarpp_clear_cache');
36
- add_action('update_option_yarpp_show_pass_post','yarpp_clear_cache');
37
- add_action('update_option_yarpp_recent_only','yarpp_clear_cache');
38
- add_action('update_option_yarpp_threshold','yarpp_clear_cache');
39
- add_action('update_option_yarpp_title','yarpp_clear_cache');
40
- add_action('update_option_yarpp_body','yarpp_clear_cache');
41
- add_action('update_option_yarpp_categories','yarpp_clear_cache');
42
- add_action('update_option_yarpp_tags','yarpp_clear_cache');
43
- add_action('update_option_yarpp_tags','yarpp_clear_cache');
44
-
45
load_plugin_textdomain('yarpp', PLUGINDIR.'/'.dirname(plugin_basename(__FILE__)), dirname(plugin_basename(__FILE__)).'/lang',dirname(plugin_basename(__FILE__)).'/lang');
46
47
// 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.2b2
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
11
if (isset($_REQUEST['yarpp_debug']))
12
$yarpp_debug = true;
13
14
+ define('YARPP_VERSION','3.2b2');
15
define('YARPP_DIR',dirname(__FILE__));
16
17
define('YARPP_POSTMETA_TITLE_KEYWORDS_KEY','_yarpp_title_keywords');
30
add_filter('the_excerpt_rss','yarpp_rss_excerpt',600);
31
register_activation_hook(__FILE__,'yarpp_activate');
32
33
load_plugin_textdomain('yarpp', PLUGINDIR.'/'.dirname(plugin_basename(__FILE__)), dirname(plugin_basename(__FILE__)).'/lang',dirname(plugin_basename(__FILE__)).'/lang');
34
35
// new in 2.0: add as a widget