Yet Another Related Posts Plugin (YARPP) - Version 3.5b4

Version Description

Download this release

Release Info

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

Code changes from version 3.4.4b4 to 3.5b4

Files changed (5) hide show
  1. class-core.php +6 -6
  2. class-widget.php +2 -2
  3. readme.txt +3 -2
  4. related-functions.php +48 -27
  5. yarpp.php +3 -3
class-core.php CHANGED
@@ -63,7 +63,7 @@ class YARPP {
63
'threshold' => 5,
64
'limit' => 5,
65
'excerpt_length' => 10,
66
- 'recent' => false, // new in 3.4.4
67
'before_title' => '<li>',
68
'after_title' => '</li>',
69
'before_post' => ' <small>',
@@ -85,8 +85,8 @@ class YARPP {
85
'past_only' => true,
86
'show_excerpt' => false,
87
'rss_show_excerpt' => false,
88
- 'template' => false, // new in 3.4.4
89
- 'rss_template' => false, // new in 3.4.4
90
'show_pass_post' => false,
91
'cross_relate' => false,
92
'auto_display' => true,
@@ -95,8 +95,8 @@ class YARPP {
95
'promote_yarpp' => false,
96
'rss_promote_yarpp' => false,
97
'myisam_override' => false,
98
- 'exclude' => '', // conslidated YARPP 3.4 and further in 3.4.4
99
- 'weight' => array( // consolidated in YARPP 3.4, format changed in 3.4.4
100
'title' => 1,
101
'body' => 1,
102
'tax' => array(
@@ -104,7 +104,7 @@ class YARPP {
104
'post_tag' => 1
105
)
106
),
107
- 'require_tax' => array() // new in 3.4.4
108
);
109
}
110
63
'threshold' => 5,
64
'limit' => 5,
65
'excerpt_length' => 10,
66
+ 'recent' => false, // new in 3.5
67
'before_title' => '<li>',
68
'after_title' => '</li>',
69
'before_post' => ' <small>',
85
'past_only' => true,
86
'show_excerpt' => false,
87
'rss_show_excerpt' => false,
88
+ 'template' => false, // new in 3.5
89
+ 'rss_template' => false, // new in 3.5
90
'show_pass_post' => false,
91
'cross_relate' => false,
92
'auto_display' => true,
95
'promote_yarpp' => false,
96
'rss_promote_yarpp' => false,
97
'myisam_override' => false,
98
+ 'exclude' => '', // conslidated YARPP 3.4 and further in 3.5
99
+ 'weight' => array( // consolidated in YARPP 3.4, format changed in 3.5
100
'title' => 1,
101
'body' => 1,
102
'tax' => array(
104
'post_tag' => 1
105
)
106
),
107
+ 'require_tax' => array() // new in 3.5
108
);
109
}
110
class-widget.php CHANGED
@@ -14,7 +14,7 @@ class YARPP_Widget extends WP_Widget {
14
15
extract($args);
16
17
- // compatibility with pre-3.4.4 settings:
18
if ( isset($instance['use_template']) )
19
$instance['template'] = $instance['use_template'] ? $instance['template_file'] : false;
20
@@ -58,7 +58,7 @@ class YARPP_Widget extends WP_Widget {
58
'promote_yarpp' => false
59
) );
60
61
- // compatibility with pre-3.4.4 settings:
62
if ( isset($instance['use_template']) )
63
$instance['template'] = $instance['template_file'];
64
14
15
extract($args);
16
17
+ // compatibility with pre-3.5 settings:
18
if ( isset($instance['use_template']) )
19
$instance['template'] = $instance['use_template'] ? $instance['template_file'] : false;
20
58
'promote_yarpp' => false
59
) );
60
61
+ // compatibility with pre-3.5 settings:
62
if ( isset($instance['use_template']) )
63
$instance['template'] = $instance['template_file'];
64
readme.txt CHANGED
@@ -6,7 +6,7 @@ Plugin URI: http://yarpp.org/
6
Donate link: http://tinyurl.com/donatetomitcho
7
Tags: related, posts, post, pages, page, RSS, feed, feeds
8
Requires at least: 3.0
9
- Tested up to: 3.3
10
Stable tag: 3.4.3
11
12
Display a list of related entries on your site and feeds based on a unique algorithm. Templating allows customization of the display.
@@ -222,13 +222,14 @@ If you are a bilingual speaker of English and another language and an avid user
222
223
== Changelog ==
224
225
- = 3.4.4 =
226
* New public YARPP query API
227
* Documentation in the "other notes" section of the readme
228
* Changed format of `weight`, `template`, `recent` parameters in options and in optional args
229
* Further main query optimization:
230
* What's cooler than joining four tables? Joining two.
231
* Exclude now simply uses `term_taxonomy_id`s instead of `term_id`s
232
* Added "consider with extra weight" to taxonomy criteria as well
233
* Code cleanup:
234
* Don't clear the cache when it's already empty
6
Donate link: http://tinyurl.com/donatetomitcho
7
Tags: related, posts, post, pages, page, RSS, feed, feeds
8
Requires at least: 3.0
9
+ Tested up to: 3.3.1
10
Stable tag: 3.4.3
11
12
Display a list of related entries on your site and feeds based on a unique algorithm. Templating allows customization of the display.
222
223
== Changelog ==
224
225
+ = 3.5 =
226
* New public YARPP query API
227
* Documentation in the "other notes" section of the readme
228
* Changed format of `weight`, `template`, `recent` parameters in options and in optional args
229
* Further main query optimization:
230
* What's cooler than joining four tables? Joining two.
231
* Exclude now simply uses `term_taxonomy_id`s instead of `term_id`s
232
+ * Changes to the `related_*()` and `yarpp_related()` function signatures.
233
* Added "consider with extra weight" to taxonomy criteria as well
234
* Code cleanup:
235
* Don't clear the cache when it's already empty
related-functions.php CHANGED
@@ -1,69 +1,90 @@
1
<?php
2
3
- function yarpp_related($reference_ID = false, $args = array(), $echo = true) {
4
global $yarpp;
5
6
if ( is_array($reference_ID) ) {
7
- _doing_it_wrong( __FUNCTION__, "YARPP's (internal) related function signature now takes the \$reference_ID first.", '3.4');
8
return;
9
}
10
11
return $yarpp->display_related($reference_ID, $args, $echo);
12
}
13
14
- function yarpp_related_exist($reference_ID = false, $args = array()) {
15
global $yarpp;
16
17
if ( is_array($reference_ID) ) {
18
- _doing_it_wrong( __FUNCTION__, "YARPP's (internal) related function signature now takes the \$reference_ID first.", '3.4');
19
return;
20
}
21
22
return $yarpp->related_exist($reference_ID, $args, $echo);
23
}
24
25
- function yarpp_get_related($reference_ID = false, $args = array()) {
26
global $yarpp;
27
return $yarpp->get_related($reference_ID, $args);
28
}
29
30
// Here are the related_WHATEVER functions, as introduced in 1.1
31
- // Since YARPP 2.1, these functions receive (optionally) one array argument. See the documentation for instructions on how to customize their output.
32
33
- function related_posts($args = array(),$echo=true,$reference_ID=false) {
34
$args['post_type'] = array('post');
35
- if ( yarpp_get_option('cross_relate') )
36
- $args['post_type'] = array('post', 'page');
37
- return yarpp_related($reference_ID, $args, $echo);
38
}
39
40
- function related_pages($args = array(),$echo=true,$reference_ID=false) {
41
$args['post_type'] = array('page');
42
- if ( yarpp_get_option('cross_relate') )
43
- $args['post_type'] = array('post', 'page');
44
- return yarpp_related($reference_ID, $args, $echo);
45
}
46
47
- function related_entries($args = array(),$echo=true,$reference_ID=false) {
48
- $args['post_type'] = array('post', 'page');
49
- return yarpp_related($reference_ID, $args, $echo);
50
}
51
52
- function related_posts_exist($args = array(),$reference_ID=false) {
53
$args['post_type'] = array('post');
54
- if ( yarpp_get_option('cross_relate') )
55
- $args['post_type'] = array('post', 'page');
56
- return yarpp_related_exist($reference_ID, $args);
57
}
58
59
- function related_pages_exist($args = array(),$reference_ID=false) {
60
$args['post_type'] = array('page');
61
- if ( yarpp_get_option('cross_relate') )
62
- $args['post_type'] = array('post', 'page');
63
- return yarpp_related_exist($reference_ID, $args);
64
}
65
66
function related_entries_exist($args = array(),$reference_ID=false) {
67
- $args['post_type'] = array('post', 'page');
68
- return yarpp_related_exist($reference_ID, $args);
69
}
1
<?php
2
3
+ function yarpp_related($args = array(), $reference_ID = false, $echo = true) {
4
global $yarpp;
5
6
if ( is_array($reference_ID) ) {
7
+ _doing_it_wrong( __FUNCTION__, "This YARPP function now takes \$args first and \$reference_ID second.", '3.5');
8
return;
9
}
10
11
return $yarpp->display_related($reference_ID, $args, $echo);
12
}
13
14
+ function yarpp_related_exist($args = array(), $reference_ID = false) {
15
global $yarpp;
16
17
if ( is_array($reference_ID) ) {
18
+ _doing_it_wrong( __FUNCTION__, "This YARPP function now takes \$args first and \$reference_ID second.", '3.5');
19
return;
20
}
21
22
return $yarpp->related_exist($reference_ID, $args, $echo);
23
}
24
25
+ function yarpp_get_related($args = array(), $reference_ID = false) {
26
global $yarpp;
27
return $yarpp->get_related($reference_ID, $args);
28
}
29
30
// Here are the related_WHATEVER functions, as introduced in 1.1
31
+ // Since YARPP 2.1, these functions receive (optionally) one array argument.
32
33
+ function related_posts($args = array(), $reference_ID=false, $echo=true) {
34
+ if ( false !== $reference_ID && is_bool($reference_ID) ) {
35
+ _doing_it_wrong( __FUNCTION__, "This YARPP function now takes \$args first and \$reference_ID second.", '3.5');
36
+ return;
37
+ }
38
+
39
+ global $yarpp;
40
$args['post_type'] = array('post');
41
+ if ( $yarpp->get_option('cross_relate') )
42
+ $args['post_type'] = $yarpp->get_post_types();
43
+ return yarpp_related( $args, $reference_ID, $echo );
44
}
45
46
+ function related_pages($args = array(), $reference_ID=false, $echo=true) {
47
+ if ( false !== $reference_ID && is_bool($reference_ID) ) {
48
+ _doing_it_wrong( __FUNCTION__, "This YARPP function now takes \$args first and \$reference_ID second.", '3.5');
49
+ return;
50
+ }
51
+
52
+ global $yarpp;
53
$args['post_type'] = array('page');
54
+ if ( $yarpp->get_option('cross_relate') )
55
+ $args['post_type'] = $yarpp->get_post_types();
56
+ return yarpp_related( $args, $reference_ID, $echo );
57
}
58
59
+ function related_entries($args = array(), $reference_ID=false, $echo=true ) {
60
+ if ( false !== $reference_ID && is_bool($reference_ID) ) {
61
+ _doing_it_wrong( __FUNCTION__, "This YARPP function now takes \$args first and \$reference_ID second.", '3.5');
62
+ return;
63
+ }
64
+
65
+ global $yarpp;
66
+ $args['post_type'] = $yarpp->get_post_types();
67
+ return yarpp_related( $args, $reference_ID, $echo );
68
}
69
70
+ function related_posts_exist($args = array(), $reference_ID=false) {
71
+ global $yarpp;
72
$args['post_type'] = array('post');
73
+ if ( $yarpp->get_option('cross_relate') )
74
+ $args['post_type'] = $yarpp->get_post_types();
75
+ return yarpp_related_exist( $args, $reference_ID );
76
}
77
78
+ function related_pages_exist($args = array(), $reference_ID=false) {
79
+ global $yarpp;
80
$args['post_type'] = array('page');
81
+ if ( $yarpp->get_option('cross_relate') )
82
+ $args['post_type'] = $yarpp->get_post_types();
83
+ return yarpp_related_exist( $args, $reference_ID );
84
}
85
86
function related_entries_exist($args = array(),$reference_ID=false) {
87
+ global $yarpp;
88
+ $args['post_type'] = $yarpp->get_post_types();
89
+ return yarpp_related_exist( $args, $reference_ID );
90
}
yarpp.php CHANGED
@@ -3,13 +3,13 @@
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.4.4b4
7
Author: mitcho (Michael Yoshitaka Erlewine)
8
Author URI: http://mitcho.com/
9
Donate link: http://tinyurl.com/donatetomitcho
10
*/
11
12
- define('YARPP_VERSION', '3.4.4b4');
13
define('YARPP_DIR', dirname(__FILE__));
14
define('YARPP_NO_RELATED', ':(');
15
define('YARPP_RELATED', ':)');
@@ -33,7 +33,7 @@ if ( !defined('WP_CONTENT_DIR') )
33
if (!defined('YARPP_CACHE_TYPE'))
34
define('YARPP_CACHE_TYPE', 'tables');
35
36
- // New in 3.4.4: YARPP extra weight multiplier
37
if ( !defined('YARPP_EXTRA_WEIGHT') )
38
define( 'YARPP_EXTRA_WEIGHT', 3 );
39
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.5b4
7
Author: mitcho (Michael Yoshitaka Erlewine)
8
Author URI: http://mitcho.com/
9
Donate link: http://tinyurl.com/donatetomitcho
10
*/
11
12
+ define('YARPP_VERSION', '3.5b4');
13
define('YARPP_DIR', dirname(__FILE__));
14
define('YARPP_NO_RELATED', ':(');
15
define('YARPP_RELATED', ':)');
33
if (!defined('YARPP_CACHE_TYPE'))
34
define('YARPP_CACHE_TYPE', 'tables');
35
36
+ // New in 3.5: YARPP extra weight multiplier
37
if ( !defined('YARPP_EXTRA_WEIGHT') )
38
define( 'YARPP_EXTRA_WEIGHT', 3 );
39