Version Description
Download this release
Release Info
Developer | mitchoyoshitaka |
Plugin | Yet Another Related Posts Plugin (YARPP) |
Version | 2.0.5 |
Comparing to | |
See all releases |
Code changes from version 2.0.4 to 2.0.5
- includes.php +62 -23
- magic.php +50 -53
- options.php +52 -45
- readme.txt +15 -4
- yarpp.php +1 -1
includes.php
CHANGED
@@ -6,7 +6,7 @@ $yarpp_value_options = array('threshold' => 5,
|
|
6 |
'excerpt_length' => 10,
|
7 |
'before_title' => '<li>',
|
8 |
'after_title' => '</li>',
|
9 |
-
'before_post' => '<small>',
|
10 |
'after_post' => '</small>',
|
11 |
'before_related' => '<p>Related posts:<ol>',
|
12 |
'after_related' => '</ol></p>',
|
@@ -36,43 +36,62 @@ function yarpp_enabled() {
|
|
36 |
return 0;
|
37 |
}
|
38 |
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
function yarpp_activate() {
|
40 |
global $yarpp_version, $wpdb, $yarpp_binary_options, $yarpp_value_options;
|
41 |
-
|
42 |
-
|
43 |
-
add_option(
|
|
|
|
|
|
|
|
|
44 |
}
|
45 |
if (!yarpp_enabled()) {
|
46 |
// $wpdb->query("ALTER TABLE `wp_posts` DROP INDEX `yarpp_cache`");
|
47 |
$wpdb->query("ALTER TABLE $wpdb->posts ADD FULLTEXT `yarpp_title` ( `post_title`)");
|
48 |
$wpdb->query("ALTER TABLE $wpdb->posts ADD FULLTEXT `yarpp_content` ( `post_content`)");
|
49 |
}
|
50 |
-
add_option('yarpp_version','2.
|
51 |
-
update_option('yarpp_version','2.
|
52 |
return 1;
|
53 |
}
|
54 |
|
55 |
-
function yarpp_upgrade_check() {
|
56 |
global $wpdb, $yarpp_value_options, $yarpp_binary_options;
|
57 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
58 |
if (get_option('threshold') and get_option('limit') and get_option('len')) {
|
59 |
-
yarpp_activate();
|
60 |
-
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 1.5. YARPP 1.5 adds "simple installation" which automagically prints a simple related posts display at the end of each single entry (permalink) page without tinkering with any theme files. As a previous YARPP user, you probably have already edited your theme files to your liking, so this "automatic display" feature has been turned off.</p><p>If you would like to use "automatic display," remove <code>related_posts</code> from your <code>single.php</code> file and turn on automatic display in the YARPP options. Make sure to adjust the new prefix and suffix preferences to your liking as well.</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></div>';
|
61 |
yarpp_upgrade_one_five();
|
62 |
update_option('yarpp_version','1.5');
|
63 |
}
|
64 |
|
65 |
if (get_option('yarpp_version') < 2) {
|
66 |
foreach (array_keys($yarpp_value_options) as $option) {
|
67 |
-
if (!get_option(
|
68 |
-
add_option(
|
69 |
}
|
70 |
foreach (array_keys($yarpp_binary_options) as $option) {
|
71 |
-
if (!get_option(
|
72 |
-
add_option(
|
73 |
}
|
74 |
|
75 |
-
|
|
|
76 |
update_option('yarpp_version','2.0');
|
77 |
}
|
78 |
|
@@ -80,15 +99,16 @@ function yarpp_upgrade_check() {
|
|
80 |
update_option('yarpp_version','2.02');
|
81 |
}
|
82 |
|
83 |
-
if (get_option('yarpp_version') < 2.03) {
|
84 |
$wpdb->query("ALTER TABLE $wpdb->posts ADD FULLTEXT `yarpp_title` ( `post_title`)");
|
85 |
$wpdb->query("ALTER TABLE $wpdb->posts ADD FULLTEXT `yarpp_content` ( `post_content`)"); update_option('yarpp_version','2.03');
|
86 |
}
|
87 |
|
88 |
-
if (get_option('yarpp_version') < 2.
|
89 |
-
update_option('yarpp_version','2.
|
90 |
}
|
91 |
|
|
|
92 |
// just in case, try to add the index one more time.
|
93 |
if (!yarpp_enabled()) {
|
94 |
$wpdb->query("ALTER TABLE $wpdb->posts ADD FULLTEXT `yarpp_title` ( `post_title`)");
|
@@ -115,11 +135,11 @@ function widget_yarpp_init() {
|
|
115 |
function widget_yarpp($args) {
|
116 |
extract($args);
|
117 |
global $wpdb, $post, $user_level;
|
118 |
-
if (
|
119 |
-
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
}
|
124 |
}
|
125 |
register_sidebar_widget(__('YARPP'), 'widget_yarpp');
|
@@ -212,7 +232,7 @@ function yarpp_upgrade_one_five() {
|
|
212 |
$migrate_options = array('past_only','show_score','show_excerpt','show_pass_post','cross_relate','limit','threshold','before_title','after_title','before_post','after_post');
|
213 |
foreach ($migrate_options as $option) {
|
214 |
if (get_option($option)) {
|
215 |
-
update_option(
|
216 |
delete_option($option);
|
217 |
}
|
218 |
}
|
@@ -239,4 +259,23 @@ function yarpp_excerpt($content,$length) {
|
|
239 |
return implode(' ',array_slice(preg_split('/\s+/',$content),0,$length)).'...';
|
240 |
}
|
241 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
242 |
?>
|
6 |
'excerpt_length' => 10,
|
7 |
'before_title' => '<li>',
|
8 |
'after_title' => '</li>',
|
9 |
+
'before_post' => ' <small>',
|
10 |
'after_post' => '</small>',
|
11 |
'before_related' => '<p>Related posts:<ol>',
|
12 |
'after_related' => '</ol></p>',
|
36 |
return 0;
|
37 |
}
|
38 |
|
39 |
+
function yarpp_reinforce() {
|
40 |
+
if (!get_option('yarpp_version'))
|
41 |
+
yarpp_activate();
|
42 |
+
yarpp_upgrade_check(true);
|
43 |
+
}
|
44 |
+
|
45 |
function yarpp_activate() {
|
46 |
global $yarpp_version, $wpdb, $yarpp_binary_options, $yarpp_value_options;
|
47 |
+
foreach (array_keys($yarpp_value_options) as $option) {
|
48 |
+
if (!get_option("yarpp_$option") or get_option("yarpp_$option") == '')
|
49 |
+
add_option("yarpp_$option",$yarpp_value_options[$option]);
|
50 |
+
}
|
51 |
+
foreach (array_keys($yarpp_binary_options) as $option) {
|
52 |
+
if (!get_option("yarpp_$option") or get_option("yarpp_$option") == '')
|
53 |
+
add_option("yarpp_$option",$yarpp_binary_options[$option]." ");
|
54 |
}
|
55 |
if (!yarpp_enabled()) {
|
56 |
// $wpdb->query("ALTER TABLE `wp_posts` DROP INDEX `yarpp_cache`");
|
57 |
$wpdb->query("ALTER TABLE $wpdb->posts ADD FULLTEXT `yarpp_title` ( `post_title`)");
|
58 |
$wpdb->query("ALTER TABLE $wpdb->posts ADD FULLTEXT `yarpp_content` ( `post_content`)");
|
59 |
}
|
60 |
+
add_option('yarpp_version','2.05');
|
61 |
+
update_option('yarpp_version','2.05');
|
62 |
return 1;
|
63 |
}
|
64 |
|
65 |
+
function yarpp_upgrade_check($inuse = false) {
|
66 |
global $wpdb, $yarpp_value_options, $yarpp_binary_options;
|
67 |
|
68 |
+
foreach (array_keys($yarpp_value_options) as $option) {
|
69 |
+
if (!get_option("yarpp_$option") or get_option("yarpp_$option") == '')
|
70 |
+
add_option("yarpp_$option",$yarpp_value_options[$option].' ');
|
71 |
+
}
|
72 |
+
foreach (array_keys($yarpp_binary_options) as $option) {
|
73 |
+
if (!get_option("yarpp_$option") or get_option("yarpp_$option") == '')
|
74 |
+
add_option("yarpp_$option",$yarpp_binary_options[$option]." ");
|
75 |
+
}
|
76 |
+
|
77 |
if (get_option('threshold') and get_option('limit') and get_option('len')) {
|
78 |
+
yarpp_activate();
|
|
|
79 |
yarpp_upgrade_one_five();
|
80 |
update_option('yarpp_version','1.5');
|
81 |
}
|
82 |
|
83 |
if (get_option('yarpp_version') < 2) {
|
84 |
foreach (array_keys($yarpp_value_options) as $option) {
|
85 |
+
if (!get_option("yarpp_$option"))
|
86 |
+
add_option("yarpp_$option",$yarpp_value_options[$option].' ');
|
87 |
}
|
88 |
foreach (array_keys($yarpp_binary_options) as $option) {
|
89 |
+
if (!get_option("yarpp_$option"))
|
90 |
+
add_option("yarpp_$option",$yarpp_binary_options[$option]);
|
91 |
}
|
92 |
|
93 |
+
if (!$inuse)
|
94 |
+
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.0. 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></div>';
|
95 |
update_option('yarpp_version','2.0');
|
96 |
}
|
97 |
|
99 |
update_option('yarpp_version','2.02');
|
100 |
}
|
101 |
|
102 |
+
if (get_option('yarpp_version') < 2.03) {
|
103 |
$wpdb->query("ALTER TABLE $wpdb->posts ADD FULLTEXT `yarpp_title` ( `post_title`)");
|
104 |
$wpdb->query("ALTER TABLE $wpdb->posts ADD FULLTEXT `yarpp_content` ( `post_content`)"); update_option('yarpp_version','2.03');
|
105 |
}
|
106 |
|
107 |
+
if (get_option('yarpp_version') < 2.05) {
|
108 |
+
update_option('yarpp_version','2.05');
|
109 |
}
|
110 |
|
111 |
+
|
112 |
// just in case, try to add the index one more time.
|
113 |
if (!yarpp_enabled()) {
|
114 |
$wpdb->query("ALTER TABLE $wpdb->posts ADD FULLTEXT `yarpp_title` ( `post_title`)");
|
135 |
function widget_yarpp($args) {
|
136 |
extract($args);
|
137 |
global $wpdb, $post, $user_level;
|
138 |
+
if (is_single()) {
|
139 |
+
echo $before_widget;
|
140 |
+
echo $before_title . 'Related Posts' . $after_title;
|
141 |
+
echo yarpp_related(array('post'),array());
|
142 |
+
echo $after_widget;
|
143 |
}
|
144 |
}
|
145 |
register_sidebar_widget(__('YARPP'), 'widget_yarpp');
|
232 |
$migrate_options = array('past_only','show_score','show_excerpt','show_pass_post','cross_relate','limit','threshold','before_title','after_title','before_post','after_post');
|
233 |
foreach ($migrate_options as $option) {
|
234 |
if (get_option($option)) {
|
235 |
+
update_option("yarpp_$option",get_option($option));
|
236 |
delete_option($option);
|
237 |
}
|
238 |
}
|
259 |
return implode(' ',array_slice(preg_split('/\s+/',$content),0,$length)).'...';
|
260 |
}
|
261 |
|
262 |
+
function yarpp_set_option($option,$value) {
|
263 |
+
global $yarpp_value_options;
|
264 |
+
if (array_search($option,array_keys($yarpp_value_options)) === true)
|
265 |
+
update_option("yarpp_$option",$value.' ');
|
266 |
+
else
|
267 |
+
update_option("yarpp_$option",$value);
|
268 |
+
}
|
269 |
+
|
270 |
+
function yarpp_get_option($option,$escapehtml = false) {
|
271 |
+
global $yarpp_value_options;
|
272 |
+
if (!(array_search($option,array_keys($yarpp_value_options)) === false))
|
273 |
+
$return = chop(get_option("yarpp_$option"));
|
274 |
+
else
|
275 |
+
$return = get_option("yarpp_$option");
|
276 |
+
if ($escapehtml)
|
277 |
+
$return = htmlspecialchars(stripslashes($return));
|
278 |
+
return $return;
|
279 |
+
}
|
280 |
+
|
281 |
?>
|
magic.php
CHANGED
@@ -63,7 +63,7 @@ function yarpp_sql($options_array,$giveresults = true) {
|
|
63 |
extract($options_array);
|
64 |
|
65 |
// if cross_relate is set, override the type argument and make sure both matches are accepted in the sql query
|
66 |
-
if (
|
67 |
|
68 |
// Fetch keywords
|
69 |
$body_terms = post_body_keywords();
|
@@ -75,10 +75,10 @@ function yarpp_sql($options_array,$giveresults = true) {
|
|
75 |
|
76 |
// get weights
|
77 |
|
78 |
-
$bodyweight = ((
|
79 |
-
$titleweight = ((
|
80 |
-
$tagweight = ((
|
81 |
-
$catweight = ((
|
82 |
|
83 |
$totalweight = $bodyweight + $titleweight + $tagweight + $catweight;
|
84 |
|
@@ -86,55 +86,52 @@ function yarpp_sql($options_array,$giveresults = true) {
|
|
86 |
|
87 |
// get disallowed categories and tags
|
88 |
|
89 |
-
$disterms = implode(',', array_filter(array_merge(explode(',',
|
90 |
-
|
91 |
-
$
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
.
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
"
|
118 |
-
|
119 |
-
|
120 |
-
$
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
.((
|
125 |
-
." order by ".((get_option('yarpp_order')?get_option('yarpp_order'):"score desc"))." limit $limit";
|
126 |
-
|
127 |
-
//echo $sql;
|
128 |
|
129 |
if (!$giveresults) {
|
130 |
-
$sql =
|
131 |
}
|
132 |
|
133 |
-
return $
|
134 |
}
|
135 |
|
136 |
function yarpp_related($type,$args,$echo = true) {
|
137 |
-
global $wpdb, $post, $
|
138 |
get_currentuserinfo();
|
139 |
|
140 |
// get options
|
@@ -144,7 +141,7 @@ function yarpp_related($type,$args,$echo = true) {
|
|
144 |
if (isset($args[$index+1])) {
|
145 |
$optvals[$options[$index]] = stripslashes($args[$index+1]);
|
146 |
} else {
|
147 |
-
$optvals[$options[$index]] = stripslashes(stripslashes(
|
148 |
}
|
149 |
}
|
150 |
extract($optvals);
|
@@ -160,18 +157,18 @@ function yarpp_related($type,$args,$echo = true) {
|
|
160 |
$permalink = get_permalink($result->ID);
|
161 |
$post_content = strip_tags($result->post_content);
|
162 |
$post_content = stripslashes($post_content);
|
163 |
-
$output .= $before_title
|
164 |
if ($show_excerpt) {
|
165 |
$output .= $before_post . yarpp_excerpt($post_content,$excerpt_length) . $after_post;
|
166 |
}
|
167 |
$output .= $after_title;
|
168 |
}
|
169 |
-
$output = stripslashes(stripslashes(
|
170 |
-
if (
|
171 |
$output .= "\n<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>";
|
172 |
|
173 |
} else {
|
174 |
-
$output =
|
175 |
}
|
176 |
if ($echo) echo $output; else return $output;
|
177 |
}
|
@@ -185,7 +182,7 @@ function yarpp_related_exist($type,$args) {
|
|
185 |
if (isset($args[$index+1])) {
|
186 |
$optvals[$options[$index]] = stripslashes($args[$index+1]);
|
187 |
} else {
|
188 |
-
$optvals[$options[$index]] = stripslashes(stripslashes(
|
189 |
}
|
190 |
}
|
191 |
extract($optvals);
|
63 |
extract($options_array);
|
64 |
|
65 |
// if cross_relate is set, override the type argument and make sure both matches are accepted in the sql query
|
66 |
+
if (yarpp_get_option('cross_relate')) $type = array('post','page');
|
67 |
|
68 |
// Fetch keywords
|
69 |
$body_terms = post_body_keywords();
|
75 |
|
76 |
// get weights
|
77 |
|
78 |
+
$bodyweight = ((yarpp_get_option('body') == 3)?3:((yarpp_get_option('body') == 2)?1:0));
|
79 |
+
$titleweight = ((yarpp_get_option('title') == 3)?3:((yarpp_get_option('title') == 2)?1:0));
|
80 |
+
$tagweight = ((yarpp_get_option('tags') != 1)?1:0);
|
81 |
+
$catweight = ((yarpp_get_option('categories') != 1)?1:0);
|
82 |
|
83 |
$totalweight = $bodyweight + $titleweight + $tagweight + $catweight;
|
84 |
|
86 |
|
87 |
// get disallowed categories and tags
|
88 |
|
89 |
+
$disterms = implode(',', array_filter(array_merge(explode(',',yarpp_get_option('discats')),explode(',',yarpp_get_option('distags'))),'is_numeric'));
|
90 |
+
|
91 |
+
$newsql = "SELECT ID, post_title, post_date, post_content, (MATCH (post_content) AGAINST ('".post_body_keywords()."')) as bodyscore, (MATCH (post_title) AGAINST ('".post_title_keywords()."')) as titlescore, COUNT( DISTINCT tagtax.term_taxonomy_id ) AS tagscore, COUNT( DISTINCT cattax.term_taxonomy_id ) AS catscore, ((MATCH (post_content) AGAINST ('".post_body_keywords()."')) * $bodyweight + (MATCH (post_title) AGAINST ('".post_title_keywords()."')) * $titleweight + COUNT( DISTINCT tagtax.term_taxonomy_id ) * $tagweight + COUNT( DISTINCT cattax.term_taxonomy_id ) * $catweight) AS score".(count(array_filter(array_merge(explode(',',yarpp_get_option('discats')),explode(',',yarpp_get_option('distags'))),'is_numeric'))?", count(blockterm.term_id) as block":"")."
|
92 |
+
FROM $wpdb->posts ";
|
93 |
+
|
94 |
+
$newsql .= (count(array_filter(array_merge(explode(',',yarpp_get_option('discats')),explode(',',yarpp_get_option('distags'))),'is_numeric'))?"left join $wpdb->term_relationships as blockrel on (wp_posts.ID = blockrel.object_id)
|
95 |
+
left join $wpdb->term_taxonomy as blocktax using (`term_taxonomy_id`)
|
96 |
+
left join $wpdb->terms as blockterm on (blocktax.term_id = blockterm.term_id and blockterm.term_id in ($disterms))":"");
|
97 |
+
|
98 |
+
$newsql .= "left JOIN $wpdb->term_relationships AS thistag ON (thistag.object_id = $post->ID )
|
99 |
+
left JOIN $wpdb->term_relationships AS tagrel on (tagrel.term_taxonomy_id = thistag.term_taxonomy_id
|
100 |
+
AND tagrel.object_id = $wpdb->posts.ID)
|
101 |
+
left JOIN $wpdb->term_taxonomy AS tagtax ON ( tagrel.term_taxonomy_id = tagtax.term_taxonomy_id
|
102 |
+
AND tagtax.taxonomy = 'post_tag')
|
103 |
+
|
104 |
+
left JOIN $wpdb->term_relationships AS thiscat ON (thiscat.object_id = $post->ID )
|
105 |
+
left JOIN $wpdb->term_relationships AS catrel on (catrel.term_taxonomy_id = thiscat.term_taxonomy_id
|
106 |
+
AND catrel.object_id = $wpdb->posts.ID)
|
107 |
+
left JOIN $wpdb->term_taxonomy AS cattax ON ( catrel.term_taxonomy_id = cattax.term_taxonomy_id
|
108 |
+
AND cattax.taxonomy = 'category')
|
109 |
+
|
110 |
+
where (post_status IN ( 'publish', 'static' ) && ID != '$post->ID')";
|
111 |
+
|
112 |
+
$newsql .= ($past_only ?" and post_date <= '$now' ":' ');
|
113 |
+
$newsql .= ((!$show_pass_post)?" and post_password ='' ":' ');
|
114 |
+
$newsql .= " and post_type IN ('".implode("', '",$type)."')";
|
115 |
+
|
116 |
+
$newsql .= " GROUP BY id ";
|
117 |
+
$newsql .= " having "; $newsql .= (count(array_filter(array_merge(explode(',',yarpp_get_option('discats')),explode(',',yarpp_get_option('distags'))),'is_numeric'))?" block = 0 and ":'');
|
118 |
+
$newsql .= " score >= $threshold";
|
119 |
+
|
120 |
+
$newsql .= ((yarpp_get_option('categories') == 3)?' and catscore >= 1':'');
|
121 |
+
$newsql .= ((yarpp_get_option('categories') == 4)?' and catscore >= 2':'');
|
122 |
+
$newsql .= ((yarpp_get_option('tags') == 3)?' and tagscore >= 1':'');
|
123 |
+
$newsql .= ((yarpp_get_option('tags') == 4)?' and tagscore >= 2':'');
|
124 |
+
$newsql .= " order by ".((yarpp_get_option('order')?yarpp_get_option('order'):"score desc"))." limit ".yarpp_get_option('limit');
|
|
|
|
|
|
|
125 |
|
126 |
if (!$giveresults) {
|
127 |
+
$sql = "select count(*) from ($sql)";
|
128 |
}
|
129 |
|
130 |
+
return $newsql;
|
131 |
}
|
132 |
|
133 |
function yarpp_related($type,$args,$echo = true) {
|
134 |
+
global $wpdb, $post, $userdata;
|
135 |
get_currentuserinfo();
|
136 |
|
137 |
// get options
|
141 |
if (isset($args[$index+1])) {
|
142 |
$optvals[$options[$index]] = stripslashes($args[$index+1]);
|
143 |
} else {
|
144 |
+
$optvals[$options[$index]] = stripslashes(stripslashes(yarpp_get_option($options[$index])));
|
145 |
}
|
146 |
}
|
147 |
extract($optvals);
|
157 |
$permalink = get_permalink($result->ID);
|
158 |
$post_content = strip_tags($result->post_content);
|
159 |
$post_content = stripslashes($post_content);
|
160 |
+
$output .= "$before_title<a href='$permalink' rel='bookmark' title='Permanent Link: $title'>$title" . (($show_score and $userdata->user_level >= 8)? ' <abbr title="'.round($result->score,3).' is the YARPP match score between the current entry and this related entry. You are seeing this value because you are logged in to WordPress as an administrator. It is not shown to regular visitors.">('.round($result->score,3).')</abbr>':'') . '</a>';
|
161 |
if ($show_excerpt) {
|
162 |
$output .= $before_post . yarpp_excerpt($post_content,$excerpt_length) . $after_post;
|
163 |
}
|
164 |
$output .= $after_title;
|
165 |
}
|
166 |
+
$output = stripslashes(stripslashes(yarpp_get_option('before_related'))).$output.stripslashes(stripslashes(yarpp_get_option('after_related')));
|
167 |
+
if (yarpp_get_option('promote_yarpp'))
|
168 |
$output .= "\n<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>";
|
169 |
|
170 |
} else {
|
171 |
+
$output = yarpp_get_option('no_results');
|
172 |
}
|
173 |
if ($echo) echo $output; else return $output;
|
174 |
}
|
182 |
if (isset($args[$index+1])) {
|
183 |
$optvals[$options[$index]] = stripslashes($args[$index+1]);
|
184 |
} else {
|
185 |
+
$optvals[$options[$index]] = stripslashes(stripslashes(yarpp_get_option($options[$index])));
|
186 |
}
|
187 |
}
|
188 |
extract($optvals);
|
options.php
CHANGED
@@ -8,6 +8,8 @@ if (!yarpp_enabled()) {
|
|
8 |
echo '</div>';
|
9 |
}
|
10 |
|
|
|
|
|
11 |
//compute $tagmap
|
12 |
$tagmap = array();
|
13 |
foreach ($wpdb->get_results("select $wpdb->terms.term_id, name from $wpdb->terms natural join $wpdb->term_taxonomy where $wpdb->term_taxonomy.taxonomy = 'category'") as $tag) {
|
@@ -26,57 +28,62 @@ function yarpp_unmapthetag($name) {
|
|
26 |
|
27 |
if (isset($_POST['update_yarpp'])) {
|
28 |
foreach (array_keys($yarpp_value_options) as $option) {
|
29 |
-
|
30 |
}
|
31 |
if (isset($_POST['discats'])) {
|
32 |
-
|
33 |
} else {
|
34 |
-
|
35 |
}
|
36 |
|
37 |
if (isset($_POST['distags'])) {
|
38 |
-
|
39 |
} else {
|
40 |
-
|
41 |
}
|
42 |
//update_option('yarpp_distags',implode(',',array_map('yarpp_unmapthetag',preg_split('!\s*[;,]\s*!',strtolower($_POST['distags']))))); // distags is even more different
|
43 |
|
44 |
foreach (array_keys($yarpp_binary_options) as $option) {
|
45 |
-
(isset($_POST[$option])) ?
|
46 |
}
|
47 |
echo '<div id="message" class="updated fade" style="background-color: rgb(207, 235, 247);"><p>Options saved!</p></div>';
|
48 |
}
|
49 |
|
50 |
function checkbox($option,$desc,$tr="<tr valign='top'>
|
51 |
<th class='th-full' colspan='2' scope='row'>",$inputplus = '',$thplus='') {
|
52 |
-
echo " $tr<input $inputplus type='checkbox' name='$option' value='true'". ((
|
53 |
</tr>";
|
54 |
}
|
55 |
function textbox($option,$desc,$size=2,$tr="<tr valign='top'>
|
56 |
<th scope='row'>") {
|
|
|
57 |
echo " $tr$desc</th>
|
58 |
-
<td><input name='$option' type='text' id='$option' value='
|
59 |
</tr>";
|
60 |
}
|
61 |
function importance($option,$desc,$type='word',$tr="<tr valign='top'>
|
62 |
<th scope='row'>",$inputplus = '') {
|
|
|
|
|
63 |
echo " $tr$desc</th>
|
64 |
<td>
|
65 |
-
<input $inputplus type='radio' name='$option' value='1'". ((
|
66 |
-
<input $inputplus type='radio' name='$option' value='2'". ((
|
67 |
-
<input $inputplus type='radio' name='$option' value='3'". ((
|
68 |
-
<input $inputplus type='radio' name='$option' value='4'". ((
|
69 |
</td>
|
70 |
</tr>";
|
71 |
}
|
72 |
|
73 |
function importance2($option,$desc,$type='word',$tr="<tr valign='top'>
|
74 |
<th scope='row'>",$inputplus = '') {
|
|
|
|
|
75 |
echo " $tr$desc</th>
|
76 |
<td>
|
77 |
-
<input $inputplus type='radio' name='$option' value='1'". ((
|
78 |
-
<input $inputplus type='radio' name='$option' value='2'". ((
|
79 |
-
<input $inputplus type='radio' name='$option' value='3'". ((
|
80 |
</td>
|
81 |
</tr>";
|
82 |
}
|
@@ -85,10 +92,10 @@ function select($option,$desc,$type='word',$tr="<tr valign='top'>
|
|
85 |
<th scope='row'>",$inputplus = '') {
|
86 |
echo " $tr$desc</th>
|
87 |
<td>
|
88 |
-
<input $inputplus type='radio' name='$option' value='1'". ((
|
89 |
-
<input $inputplus type='radio' name='$option' value='2'". ((
|
90 |
-
<input $inputplus type='radio' name='$option' value='3'". ((
|
91 |
-
<input $inputplus type='radio' name='$option' value='4'". ((
|
92 |
</td>
|
93 |
</tr>";
|
94 |
}
|
@@ -121,7 +128,7 @@ document.getElementsByTagName("head")[0].appendChild(css);
|
|
121 |
|
122 |
<h2>
|
123 |
<input type="image" src="https://www.paypal.com/en_US/i/btn/x-click-but04.gif" name="submit" alt="Make payments with PayPal - it's fast, free and secure!" title="Donate to mitcho (Michael Yoshitaka Erlewine) for this plugin via PayPal" style="float:right" />
|
124 |
-
Yet Another Related Posts Plugin Options <small><?php echo
|
125 |
</h2>
|
126 |
</form>
|
127 |
|
@@ -138,9 +145,9 @@ document.getElementsByTagName("head")[0].appendChild(css);
|
|
138 |
<table class="form-table">
|
139 |
<tbody>
|
140 |
<tr valign='top'>
|
141 |
-
<th scope='row'>Disallow by category
|
142 |
<?php
|
143 |
-
$discats = explode(',',
|
144 |
array_unshift($discats,' ');
|
145 |
foreach ($wpdb->get_results("select $wpdb->terms.term_id, name from $wpdb->terms natural join $wpdb->term_taxonomy where $wpdb->term_taxonomy.taxonomy = 'category' order by name") as $cat) {
|
146 |
echo "<input type='checkbox' name='discats[$cat->term_id]' value='true'". (array_search($cat->term_id,$discats) ? ' checked="checked"': '' )." /> <label for='discats[$cat->term_id]'>$cat->name</label> ";
|
@@ -148,10 +155,10 @@ document.getElementsByTagName("head")[0].appendChild(css);
|
|
148 |
</div></td>
|
149 |
</tr>
|
150 |
<tr valign='top'>
|
151 |
-
<th scope='row'>Disallow by tag:
|
152 |
-
<td><div style="overflow:auto;max-height:100px;"><!--Enter tags to use to block entries. Delimit with commas. Tags that do not currently exist will be ignored.<br /><input name='distags' type='text' id='$option' value='<?php implode(",",array_map("yarpp_mapthetag",explode(",",htmlspecialchars(stripslashes(
|
153 |
<?php
|
154 |
-
$distags = explode(',',
|
155 |
array_unshift($distags,' ');
|
156 |
foreach ($wpdb->get_results("select $wpdb->terms.term_id, name from $wpdb->terms natural join $wpdb->term_taxonomy where $wpdb->term_taxonomy.taxonomy = 'post_tag' order by name") as $tag) {
|
157 |
echo "<input type='checkbox' name='distags[$tag->term_id]' value='true'". (array_search($tag->term_id,$distags) ? ' checked="checked"': '' )." /> <label for='distags[$tag->term_id]'>$tag->name</label> ";
|
@@ -176,10 +183,10 @@ document.getElementsByTagName("head")[0].appendChild(css);
|
|
176 |
</div>-->
|
177 |
|
178 |
<?php textbox('threshold','Match threshold:')?>
|
179 |
-
<?php importance2('title',"Titles:
|
180 |
-
<?php importance2('body',"Bodies:
|
181 |
-
<?php importance('tags',"Tags:
|
182 |
-
<?php importance('categories',"Categories:
|
183 |
<?php checkbox('cross_relate',"Cross-relate posts and pages? <a href='#' class='info'>more><span>When the \"Cross-relate posts and pages\" option is selected, the <code>related_posts()</code>, <code>related_pagaes()</code>, and <code>related_entries()</code> all will give the same output, returning both related pages and posts.</span></a>"); ?>
|
184 |
</tbody>
|
185 |
</table>
|
@@ -207,14 +214,14 @@ document.getElementsByTagName("head")[0].appendChild(css);
|
|
207 |
<?php
|
208 |
// construct the demo code based on current preferences
|
209 |
|
210 |
-
$democode = stripslashes(
|
211 |
";
|
212 |
-
for ($i=1;$i<=
|
213 |
-
$democode .= stripslashes(
|
214 |
";
|
215 |
}
|
216 |
-
$democode .= stripslashes(
|
217 |
-
if (
|
218 |
$democode .= htmlspecialchars("\n<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>");
|
219 |
|
220 |
checkbox('auto_display',"Automatically display related posts? <a href='#' class='info'>more><span>This option automatically displays related posts right after the content on single entry pages. If this option is off, you will need to manually insert <code>related_posts()</code> or variants (<code>related_pagaes()</code> and <code>related_entries()</code>) into your theme files.","<tr valign='top'>
|
@@ -222,33 +229,33 @@ checkbox('auto_display',"Automatically display related posts? <a href='#' class=
|
|
222 |
."<code><pre style='overflow:auto;width:350px;'>".($democode)."</pre></code></td>"); ?>
|
223 |
<tr valign='top'>
|
224 |
<th>Before / after related entries:</th>
|
225 |
-
<td><input name="before_related" type="text" id="before_related" value="<?php echo stripslashes(
|
226 |
</td>
|
227 |
</tr>
|
228 |
<tr valign='top'>
|
229 |
<th>Before / after each post:</th>
|
230 |
-
<td><input name="before_title" type="text" id="before_title" value="<?php echo stripslashes(
|
231 |
</td>
|
232 |
</tr>
|
233 |
<?php checkbox('show_excerpt',"Show excerpt?","<tr valign='top'><th colspan='2'>",' name="show_excerpt" onclick="javascript:excerpt()"'); ?>
|
234 |
-
<?php textbox('excerpt_length','Excerpt length (No. of words):',null,"<tr name='excerpted' valign='top' ".(
|
235 |
<th>")?>
|
236 |
|
237 |
-
<tr name="excerpted" valign='top' <?php echo (
|
238 |
<th>Before / after (Excerpt):</th>
|
239 |
-
<td><input name="before_post" type="text" id="before_post" value="<?php echo stripslashes(
|
240 |
</td>
|
241 |
</tr>
|
242 |
|
243 |
<tr name="excerpted" valign='top'>
|
244 |
<th>Order results:</th>
|
245 |
<td><select name="order" id="name">
|
246 |
-
<option value="score DESC" <?php echo (
|
247 |
-
<option value="score ASC" <?php echo (
|
248 |
-
<option value="post_date DESC" <?php echo (
|
249 |
-
<option value="post_date ASC" <?php echo (
|
250 |
-
<option value="post_title ASC" <?php echo (
|
251 |
-
<option value="post_title DESC" <?php echo (
|
252 |
</select>
|
253 |
</td>
|
254 |
</tr>
|
8 |
echo '</div>';
|
9 |
}
|
10 |
|
11 |
+
yarpp_reinforce(); // just in case, set default options, etc.
|
12 |
+
|
13 |
//compute $tagmap
|
14 |
$tagmap = array();
|
15 |
foreach ($wpdb->get_results("select $wpdb->terms.term_id, name from $wpdb->terms natural join $wpdb->term_taxonomy where $wpdb->term_taxonomy.taxonomy = 'category'") as $tag) {
|
28 |
|
29 |
if (isset($_POST['update_yarpp'])) {
|
30 |
foreach (array_keys($yarpp_value_options) as $option) {
|
31 |
+
yarpp_set_option($option,addslashes($_POST[$option]));
|
32 |
}
|
33 |
if (isset($_POST['discats'])) {
|
34 |
+
yarpp_set_option('discats',implode(',',array_keys($_POST['discats']))); // discats is different
|
35 |
} else {
|
36 |
+
yarpp_set_option('discats','');
|
37 |
}
|
38 |
|
39 |
if (isset($_POST['distags'])) {
|
40 |
+
yarpp_set_option('distags',implode(',',array_keys($_POST['distags']))); // distags is also different
|
41 |
} else {
|
42 |
+
yarpp_set_option('distags','');
|
43 |
}
|
44 |
//update_option('yarpp_distags',implode(',',array_map('yarpp_unmapthetag',preg_split('!\s*[;,]\s*!',strtolower($_POST['distags']))))); // distags is even more different
|
45 |
|
46 |
foreach (array_keys($yarpp_binary_options) as $option) {
|
47 |
+
(isset($_POST[$option])) ? yarpp_set_option($option,true) : yarpp_set_option($option,false);
|
48 |
}
|
49 |
echo '<div id="message" class="updated fade" style="background-color: rgb(207, 235, 247);"><p>Options saved!</p></div>';
|
50 |
}
|
51 |
|
52 |
function checkbox($option,$desc,$tr="<tr valign='top'>
|
53 |
<th class='th-full' colspan='2' scope='row'>",$inputplus = '',$thplus='') {
|
54 |
+
echo " $tr<input $inputplus type='checkbox' name='$option' value='true'". ((yarpp_get_option($option)) ? ' checked="checked"': '' )." /> $desc</th>$thplus
|
55 |
</tr>";
|
56 |
}
|
57 |
function textbox($option,$desc,$size=2,$tr="<tr valign='top'>
|
58 |
<th scope='row'>") {
|
59 |
+
$value = yarpp_get_option($option,true);
|
60 |
echo " $tr$desc</th>
|
61 |
+
<td><input name='$option' type='text' id='$option' value='$value' size='$size' /></td>
|
62 |
</tr>";
|
63 |
}
|
64 |
function importance($option,$desc,$type='word',$tr="<tr valign='top'>
|
65 |
<th scope='row'>",$inputplus = '') {
|
66 |
+
$value = yarpp_get_option($option);
|
67 |
+
|
68 |
echo " $tr$desc</th>
|
69 |
<td>
|
70 |
+
<input $inputplus type='radio' name='$option' value='1'". (($value == 1) ? ' checked="checked"': '' )." /> do not consider
|
71 |
+
<input $inputplus type='radio' name='$option' value='2'". (($value == 2) ? ' checked="checked"': '' )." /> consider
|
72 |
+
<input $inputplus type='radio' name='$option' value='3'". (($value == 3) ? ' checked="checked"': '' )." /> require at least one $type in common
|
73 |
+
<input $inputplus type='radio' name='$option' value='4'". (($value == 4) ? ' checked="checked"': '' )." /> require more than one $type in common
|
74 |
</td>
|
75 |
</tr>";
|
76 |
}
|
77 |
|
78 |
function importance2($option,$desc,$type='word',$tr="<tr valign='top'>
|
79 |
<th scope='row'>",$inputplus = '') {
|
80 |
+
$value = yarpp_get_option($option);
|
81 |
+
|
82 |
echo " $tr$desc</th>
|
83 |
<td>
|
84 |
+
<input $inputplus type='radio' name='$option' value='1'". (($value == 1) ? ' checked="checked"': '' )." /> do not consider
|
85 |
+
<input $inputplus type='radio' name='$option' value='2'". (($value == 2) ? ' checked="checked"': '' )." /> consider
|
86 |
+
<input $inputplus type='radio' name='$option' value='3'". (($value == 3) ? ' checked="checked"': '' )." /> consider with extra weight
|
87 |
</td>
|
88 |
</tr>";
|
89 |
}
|
92 |
<th scope='row'>",$inputplus = '') {
|
93 |
echo " $tr$desc</th>
|
94 |
<td>
|
95 |
+
<input $inputplus type='radio' name='$option' value='1'". ((yarpp_get_option($option) == 1) ? ' checked="checked"': '' )." /> do not consider
|
96 |
+
<input $inputplus type='radio' name='$option' value='2'". ((yarpp_get_option($option) == 2) ? ' checked="checked"': '' )." /> consider
|
97 |
+
<input $inputplus type='radio' name='$option' value='3'". ((yarpp_get_option($option) == 3) ? ' checked="checked"': '' )." /> require at least one $type in common
|
98 |
+
<input $inputplus type='radio' name='$option' value='4'". ((yarpp_get_option($option) == 4) ? ' checked="checked"': '' )." /> require more than one $type in common
|
99 |
</td>
|
100 |
</tr>";
|
101 |
}
|
128 |
|
129 |
<h2>
|
130 |
<input type="image" src="https://www.paypal.com/en_US/i/btn/x-click-but04.gif" name="submit" alt="Make payments with PayPal - it's fast, free and secure!" title="Donate to mitcho (Michael Yoshitaka Erlewine) for this plugin via PayPal" style="float:right" />
|
131 |
+
Yet Another Related Posts Plugin Options <small><?php echo yarpp_get_option('version'); ?></small>
|
132 |
</h2>
|
133 |
</form>
|
134 |
|
145 |
<table class="form-table">
|
146 |
<tbody>
|
147 |
<tr valign='top'>
|
148 |
+
<th scope='row'>Disallow by category:</th><td><div style="overflow:auto;max-height:100px;">
|
149 |
<?php
|
150 |
+
$discats = explode(',',yarpp_get_option('discats'));
|
151 |
array_unshift($discats,' ');
|
152 |
foreach ($wpdb->get_results("select $wpdb->terms.term_id, name from $wpdb->terms natural join $wpdb->term_taxonomy where $wpdb->term_taxonomy.taxonomy = 'category' order by name") as $cat) {
|
153 |
echo "<input type='checkbox' name='discats[$cat->term_id]' value='true'". (array_search($cat->term_id,$discats) ? ' checked="checked"': '' )." /> <label for='discats[$cat->term_id]'>$cat->name</label> ";
|
155 |
</div></td>
|
156 |
</tr>
|
157 |
<tr valign='top'>
|
158 |
+
<th scope='row'>Disallow by tag: </th>
|
159 |
+
<td><div style="overflow:auto;max-height:100px;"><!--Enter tags to use to block entries. Delimit with commas. Tags that do not currently exist will be ignored.<br /><input name='distags' type='text' id='$option' value='<?php implode(",",array_map("yarpp_mapthetag",explode(",",htmlspecialchars(stripslashes(yarpp_get_option($option))))));?>' size='40' />-->
|
160 |
<?php
|
161 |
+
$distags = explode(',',yarpp_get_option('distags'));
|
162 |
array_unshift($distags,' ');
|
163 |
foreach ($wpdb->get_results("select $wpdb->terms.term_id, name from $wpdb->terms natural join $wpdb->term_taxonomy where $wpdb->term_taxonomy.taxonomy = 'post_tag' order by name") as $tag) {
|
164 |
echo "<input type='checkbox' name='distags[$tag->term_id]' value='true'". (array_search($tag->term_id,$distags) ? ' checked="checked"': '' )." /> <label for='distags[$tag->term_id]'>$tag->name</label> ";
|
183 |
</div>-->
|
184 |
|
185 |
<?php textbox('threshold','Match threshold:')?>
|
186 |
+
<?php importance2('title',"Titles: ")?>
|
187 |
+
<?php importance2('body',"Bodies: ")?>
|
188 |
+
<?php importance('tags',"Tags: ",'tag')?>
|
189 |
+
<?php importance('categories',"Categories: ",'category')?>
|
190 |
<?php checkbox('cross_relate',"Cross-relate posts and pages? <a href='#' class='info'>more><span>When the \"Cross-relate posts and pages\" option is selected, the <code>related_posts()</code>, <code>related_pagaes()</code>, and <code>related_entries()</code> all will give the same output, returning both related pages and posts.</span></a>"); ?>
|
191 |
</tbody>
|
192 |
</table>
|
214 |
<?php
|
215 |
// construct the demo code based on current preferences
|
216 |
|
217 |
+
$democode = stripslashes(yarpp_get_option('before_related',true))."
|
218 |
";
|
219 |
+
for ($i=1;$i<=yarpp_get_option('limit');$i++) {
|
220 |
+
$democode .= stripslashes(yarpp_get_option('before_title',true)).stripslashes(htmlspecialchars("<a href='PERMALINK$i'>RELATED TITLE $i</a>")).(yarpp_get_option('show_excerpt')?"\r\t".stripslashes(yarpp_get_option('before_post',true)).yarpp_excerpt(LOREMIPSUM,yarpp_get_option('excerpt_length')).stripslashes(yarpp_get_option('before_post',true)):'').stripslashes(yarpp_get_option('after_title',true))."
|
221 |
";
|
222 |
}
|
223 |
+
$democode .= stripslashes(yarpp_get_option('after_related',true));
|
224 |
+
if (yarpp_get_option('promote_yarpp'))
|
225 |
$democode .= htmlspecialchars("\n<p>Related posts brought to you by <a href='http://mitcho.com/code/yarpp/'>Yet Another Related Posts Plugin</a>.</p>");
|
226 |
|
227 |
checkbox('auto_display',"Automatically display related posts? <a href='#' class='info'>more><span>This option automatically displays related posts right after the content on single entry pages. If this option is off, you will need to manually insert <code>related_posts()</code> or variants (<code>related_pagaes()</code> and <code>related_entries()</code>) into your theme files.","<tr valign='top'>
|
229 |
."<code><pre style='overflow:auto;width:350px;'>".($democode)."</pre></code></td>"); ?>
|
230 |
<tr valign='top'>
|
231 |
<th>Before / after related entries:</th>
|
232 |
+
<td><input name="before_related" type="text" id="before_related" value="<?php echo stripslashes(yarpp_get_option('before_related',true)); ?>" size="10" /> / <input name="after_related" type="text" id="after_related" value="<?php echo stripslashes(yarpp_get_option('after_related',true)); ?>" size="10" /><em><small> For example: <ol></ol> or <div></div></small></em>
|
233 |
</td>
|
234 |
</tr>
|
235 |
<tr valign='top'>
|
236 |
<th>Before / after each post:</th>
|
237 |
+
<td><input name="before_title" type="text" id="before_title" value="<?php echo stripslashes(yarpp_get_option('before_title',true)); ?>" size="10" /> / <input name="after_title" type="text" id="after_title" value="<?php echo stripslashes(yarpp_get_option('after_title',true)); ?>" size="10" /><em><small> For example: <li></li> or <dl></dl></small></em>
|
238 |
</td>
|
239 |
</tr>
|
240 |
<?php checkbox('show_excerpt',"Show excerpt?","<tr valign='top'><th colspan='2'>",' name="show_excerpt" onclick="javascript:excerpt()"'); ?>
|
241 |
+
<?php textbox('excerpt_length','Excerpt length (No. of words):',null,"<tr name='excerpted' valign='top' ".(yarpp_get_option('show_excerpt')?'':"style='display:none'").">
|
242 |
<th>")?>
|
243 |
|
244 |
+
<tr name="excerpted" valign='top' <?php echo (yarpp_get_option('show_excerpt')?'':"style='display:none'")?>>
|
245 |
<th>Before / after (Excerpt):</th>
|
246 |
+
<td><input name="before_post" type="text" id="before_post" value="<?php echo stripslashes(yarpp_get_option('before_post',true)); ?>" size="10" /> / <input name="after_post" type="text" id="after_post" value="<?php echo stripslashes(yarpp_get_option('after_post')); ?>" size="10" /><em><small> For example: <li></li> or <dl></dl></small></em>
|
247 |
</td>
|
248 |
</tr>
|
249 |
|
250 |
<tr name="excerpted" valign='top'>
|
251 |
<th>Order results:</th>
|
252 |
<td><select name="order" id="name">
|
253 |
+
<option value="score DESC" <?php echo (yarpp_get_option('order')=='score DESC'?' selected="selected"':'')?>>score (high relevance to low)</option>
|
254 |
+
<option value="score ASC" <?php echo (yarpp_get_option('order')=='score ASC'?' selected="selected"':'')?>>score (low relevance to high)</option>
|
255 |
+
<option value="post_date DESC" <?php echo (yarpp_get_option('order')=='post_date DESC'?' selected="selected"':'')?>>date (new to old)</option>
|
256 |
+
<option value="post_date ASC" <?php echo (yarpp_get_option('order')=='post_date ASC'?' selected="selected"':'')?>>date (old to new)</option>
|
257 |
+
<option value="post_title ASC" <?php echo (yarpp_get_option('order')=='post_title ASC'?' selected="selected"':'')?>>title (alphabetical)</option>
|
258 |
+
<option value="post_title DESC" <?php echo (yarpp_get_option('order')=='post_title DESC'?' selected="selected"':'')?>>title (reverse alphabetical)</option>
|
259 |
</select>
|
260 |
</td>
|
261 |
</tr>
|
readme.txt
CHANGED
@@ -6,8 +6,8 @@ Plugin URI: http://mitcho.com/code/yarpp/
|
|
6 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=mitcho%40mitcho%2ecom&item_name=mitcho%2ecom%2fcode%3a%20donate%20to%20Michael%20Yoshitaka%20Erlewine&no_shipping=0&no_note=1&tax=0¤cy_code=USD&lc=US&bn=PP%2dDonationsBF&charset=UTF%2d8
|
7 |
Tags: related, posts, post, pages, page
|
8 |
Requires at least: 2.3
|
9 |
-
Tested up to: 2.6
|
10 |
-
Stable tag: 2.0.
|
11 |
|
12 |
Returns a list of the related entries based on keyword matches, limited by a certain relatedness threshold. New and improved, version 2.0!
|
13 |
|
@@ -28,6 +28,10 @@ Yet Another Related Posts Plugin (YARPP) gives you a list of posts and/or pages
|
|
28 |
|
29 |
Since YARPP 1.5, you can just put the `yet-another-related-posts-plugin` directory in your `/wp-content/plugins/` directory, activate the plugin, and you're set! You'll see related posts in single entry (permalink) pages. If all your pages say "no related posts," see the FAQ.
|
30 |
|
|
|
|
|
|
|
|
|
31 |
= Manual installation =
|
32 |
|
33 |
If you would like to put the related posts display in another part of your theme, or display them in pages other than single entry pages, turn off "auto display" in the YARPP Options, then drop `related_posts()`, `related_pages()`, or `related_entries()` (see below) in your [WP loop](http://codex.wordpress.org/The_Loop). Change any options in the Related Posts (YARPP) Options pane in Admin > Plugins. See Examples in Other Notes for sample code you can drop into your theme.
|
@@ -95,13 +99,20 @@ I highly recommend you disactivate YARPP, replace it with the new one, and then
|
|
95 |
* 2.0.4 - what 2.0 should have been
|
96 |
* Bugfix: new fulltext query for MySQL 5 compatibility
|
97 |
* Bugfix: updated apply_filters to work with WP 2.6
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
98 |
|
99 |
== Future versions ==
|
100 |
|
101 |
The following feature requests have been made and may be incorporated into a future release. If you have a bug fix, please start a new thread on [the Wordpress.org forums](http://wordpress.org/tags/yet-another-related-posts-plugin).
|
102 |
|
103 |
* User-defineable stopwords, especially to support other languages, [by request](http://wordpress.org/support/topic/159359)
|
104 |
-
* Widgetization, [by request](http://wordpress.org/support/topic/160459)
|
105 |
* Date and comment count in excerpt, [by request](http://wordpress.org/support/topic/156231)
|
106 |
-
* RSS feed support: an option to automagically show related posts in RSS feeds, [by request](http://wordpress.org/support/topic/151766).
|
107 |
* Sentece-aware excerpts, [by request](http://wordpress.org/support/topic/162465)
|
6 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=mitcho%40mitcho%2ecom&item_name=mitcho%2ecom%2fcode%3a%20donate%20to%20Michael%20Yoshitaka%20Erlewine&no_shipping=0&no_note=1&tax=0¤cy_code=USD&lc=US&bn=PP%2dDonationsBF&charset=UTF%2d8
|
7 |
Tags: related, posts, post, pages, page
|
8 |
Requires at least: 2.3
|
9 |
+
Tested up to: 2.6.2
|
10 |
+
Stable tag: 2.0.5
|
11 |
|
12 |
Returns a list of the related entries based on keyword matches, limited by a certain relatedness threshold. New and improved, version 2.0!
|
13 |
|
28 |
|
29 |
Since YARPP 1.5, you can just put the `yet-another-related-posts-plugin` directory in your `/wp-content/plugins/` directory, activate the plugin, and you're set! You'll see related posts in single entry (permalink) pages. If all your pages say "no related posts," see the FAQ.
|
30 |
|
31 |
+
= Widget =
|
32 |
+
|
33 |
+
Related posts can also be displayed as a widget. Go to the Design > Widgets options page and add the Related Posts widget. The widget will only be displayed on single entry (permalink) pages. The widget can be used even if the "auto display" option is turned off.
|
34 |
+
|
35 |
= Manual installation =
|
36 |
|
37 |
If you would like to put the related posts display in another part of your theme, or display them in pages other than single entry pages, turn off "auto display" in the YARPP Options, then drop `related_posts()`, `related_pages()`, or `related_entries()` (see below) in your [WP loop](http://codex.wordpress.org/The_Loop). Change any options in the Related Posts (YARPP) Options pane in Admin > Plugins. See Examples in Other Notes for sample code you can drop into your theme.
|
99 |
* 2.0.4 - what 2.0 should have been
|
100 |
* Bugfix: new fulltext query for MySQL 5 compatibility
|
101 |
* Bugfix: updated apply_filters to work with WP 2.6
|
102 |
+
* 2.0.5
|
103 |
+
* Further optimized algorithm - should be faster on most systems. Good bye [subqueries](http://dev.mysql.com/doc/refman/5.0/en/unnamed-views.html)!
|
104 |
+
* Bugfix: restored MySQL 4.0 support
|
105 |
+
* Bugfix: [widgets required the "auto display" option](http://wordpress.org/support/topic/190454)
|
106 |
+
* Bugfix: sometimes default values were not set properly on (re)activation
|
107 |
+
* Bugfix: [quotes in HTML tag options would get escaped](http://wordpress.org/support/topic/199139)
|
108 |
+
* Bugfix: `user_level` was being checked in a deprecated manner
|
109 |
+
* A helpful little tooltip for the admin-only threshold display
|
110 |
|
111 |
== Future versions ==
|
112 |
|
113 |
The following feature requests have been made and may be incorporated into a future release. If you have a bug fix, please start a new thread on [the Wordpress.org forums](http://wordpress.org/tags/yet-another-related-posts-plugin).
|
114 |
|
115 |
* User-defineable stopwords, especially to support other languages, [by request](http://wordpress.org/support/topic/159359)
|
|
|
116 |
* Date and comment count in excerpt, [by request](http://wordpress.org/support/topic/156231)
|
117 |
+
* RSS feed support: an option to automagically show related posts in RSS feeds, [by popular request](http://wordpress.org/support/topic/151766).
|
118 |
* Sentece-aware excerpts, [by request](http://wordpress.org/support/topic/162465)
|
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 keyword matches, limited by a certain relatedness threshold. New and improved, version 2.0!
|
6 |
-
Version: 2.0.
|
7 |
Author: mitcho (Michael Yoshitaka Erlewine)
|
8 |
*/
|
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 keyword matches, limited by a certain relatedness threshold. New and improved, version 2.0!
|
6 |
+
Version: 2.0.5
|
7 |
Author: mitcho (Michael Yoshitaka Erlewine)
|
8 |
*/
|
9 |
|