Yet Another Related Posts Plugin (YARPP) - Version 2.0.6

Version Description

Download this release

Release Info

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

Code changes from version 2.0.5 to 2.0.6

Files changed (4) hide show
  1. includes.php +17 -11
  2. magic.php +1 -1
  3. readme.txt +4 -2
  4. yarpp.php +1 -1
includes.php CHANGED
@@ -54,11 +54,22 @@ function yarpp_activate() {
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
@@ -94,21 +105,16 @@ function yarpp_upgrade_check($inuse = false) {
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
-
98
- if (get_option('yarpp_version') < 2.02) {
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`)");
54
}
55
if (!yarpp_enabled()) {
56
// $wpdb->query("ALTER TABLE `wp_posts` DROP INDEX `yarpp_cache`");
57
+ if (!$wpdb->query("ALTER TABLE $wpdb->posts ADD FULLTEXT `yarpp_title` ( `post_title`)")) {
58
+ echo "<!--MySQL error on adding yarpp_title: ";
59
+ $wpdb->print_error();
60
+ echo "-->";
61
+ }
62
+ if (!$wpdb->query("ALTER TABLE $wpdb->posts ADD FULLTEXT `yarpp_content` ( `post_content`)")) {
63
+ echo "<!--MySQL error on adding yarpp_content: ";
64
+ $wpdb->print_error();
65
+ echo "-->";
66
+ }
67
+ if (!yarpp_enabled()) {
68
+ return 0;
69
+ }
70
}
71
+ add_option('yarpp_version','2.06');
72
+ update_option('yarpp_version','2.06');
73
return 1;
74
}
75
105
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>';
106
update_option('yarpp_version','2.0');
107
}
108
109
if (get_option('yarpp_version') < 2.03) {
110
$wpdb->query("ALTER TABLE $wpdb->posts ADD FULLTEXT `yarpp_title` ( `post_title`)");
111
$wpdb->query("ALTER TABLE $wpdb->posts ADD FULLTEXT `yarpp_content` ( `post_content`)"); update_option('yarpp_version','2.03');
112
}
113
114
+ if (get_option('yarpp_version') < 2.06) {
115
+ update_option('yarpp_version','2.06');
116
}
117
118
// just in case, try to add the index one more time.
119
if (!yarpp_enabled()) {
120
$wpdb->query("ALTER TABLE $wpdb->posts ADD FULLTEXT `yarpp_title` ( `post_title`)");
magic.php CHANGED
@@ -91,7 +91,7 @@ function yarpp_sql($options_array,$giveresults = true) {
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
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 ($wpdb->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
readme.txt CHANGED
@@ -7,7 +7,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=mitcho%4
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
@@ -98,7 +98,7 @@ I highly recommend you disactivate YARPP, replace it with the new one, and then
98
* Bugfix: [2.0.2 accidentally required some tags or categories to be disabled](http://wordpress.org/support/topic/188745)
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
@@ -107,6 +107,8 @@ I highly recommend you disactivate YARPP, replace it with the new one, and then
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
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.6
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
98
* Bugfix: [2.0.2 accidentally required some tags or categories to be disabled](http://wordpress.org/support/topic/188745)
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
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
+ * 2.0.6
111
+ * A quick emergency bugfix (In one instance, assumed existence of `wp_posts`)
112
113
== Future versions ==
114
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.5
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.6
7
Author: mitcho (Michael Yoshitaka Erlewine)
8
*/
9