Yet Another Related Posts Plugin (YARPP) - Version 5.15.3

Version Description

(15-March-2021) = * Enhancement: Improved readability of the database indexes prompt

Download this release

Release Info

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

Code changes from version 5.15.2 to 5.15.3

classes/YARPP_Core.php CHANGED
@@ -438,9 +438,10 @@ class YARPP {
438
  public function diagnostic_big_db(){
439
  global $wpdb;
440
  if(! defined('YARPP_BIG_DB')){
441
- define('YARPP_BIG_DB', 2000);
442
  }
443
  $sql = 'SELECT count(*) FROM ' . $wpdb->posts;
 
444
  $posts_count = $wpdb->get_var($sql);
445
  return (int)$posts_count > YARPP_BIG_DB;
446
  }
438
  public function diagnostic_big_db(){
439
  global $wpdb;
440
  if(! defined('YARPP_BIG_DB')){
441
+ define('YARPP_BIG_DB', 5000);
442
  }
443
  $sql = 'SELECT count(*) FROM ' . $wpdb->posts;
444
+ // Note: count includes drafts, revisions, etc
445
  $posts_count = $wpdb->get_var($sql);
446
  return (int)$posts_count > YARPP_BIG_DB;
447
  }
classes/YARPP_Meta_Box_Relatedness.php CHANGED
@@ -1,99 +1,111 @@
1
  <?php
2
 
3
  class YARPP_Meta_Box_Relatedness extends YARPP_Meta_Box {
4
- public function display() {
5
- global $yarpp;
6
- ?>
7
- <p><?php _e( 'YARPP limits the related posts list by (1) a maximum number and (2) a <em>match threshold</em>.', 'yarpp' ); ?> <span class='yarpp_help dashicons dashicons-editor-help' data-help="<?php echo esc_attr( __( 'The higher the match threshold, the more restrictive, and you get less related posts overall. The default match threshold is 5. If you want to find an appropriate match threshold, take a look at some post\'s related posts display and their scores. You can see what kinds of related posts are being picked up and with what kind of match scores, and determine an appropriate threshold for your site.', 'yarpp' ) ); ?>">&nbsp;</span></p>
8
 
9
- <?php
10
- $this->textbox( 'threshold', __( 'Match threshold:', 'yarpp' ) );
11
- $this->disabled_warning();
12
- $this->weight( 'title', __( "Titles: ", 'yarpp' ) );
13
- $this->weight( 'body', __( "Bodies: ", 'yarpp' ) );
14
 
15
- foreach ( $yarpp->get_taxonomies() as $taxonomy ) {
16
- $this->tax_weight( $taxonomy );
17
- }
18
- }
19
 
20
  /**
21
  * If applicable, echos out a warning that the fulltext indexes don't exist and so comparing using titles and bodies
22
- * must be disabled until some database changes happen.
23
  */
24
- protected function disabled_warning(){
25
- global $yarpp, $wpdb;
26
- $database_supports_fulltext_indexes = $yarpp->db_schema->database_supports_fulltext_indexes();
27
- if ( ! $database_supports_fulltext_indexes ) {
28
- ?>
29
- <div class='yarpp-callout yarpp-notice'>
30
- <p><?php
31
- esc_html_e('Comparing posts based on titles or bodies is currently disabled','yarpp');
32
- ?>
33
- &nbsp;&nbsp;<a href="#" id="yarpp_fulltext_expand"><?php
34
- printf(
35
- // translators: icon to expand
36
- __('Show Details %s','yarpp'),
37
- '[+]'
38
- );
39
- ?>
40
- </a>
41
- </p>
42
- <div id="yarpp_fulltext_details" class="hidden">
43
- <p><?php
44
- printf(
45
- esc_html__('Because full-text indexing is not supported by your current table engine, "%1$s", YARPP cannot compare posts based on their titles or bodies.','yarpp'),
46
- 'InnoDB',
47
- '5.6.4',
48
- '<code>' . $wpdb->posts . '</code>',
49
- 'MyISAM'
50
- );
51
- ?>
52
- </p>
53
- <p><?php
54
- printf(
55
- esc_html__('Please contact your host about updating MySQL to at latest version %1$s, or run the following SQL code on your MySQL client (eg PHPMyAdmin) or terminal:', 'yarpp'),
56
- '5.6.4'
57
- );
58
- ?>
59
- </p>
60
- <p>
61
- <?php
62
- printf(
63
- esc_html__('See MySQL %1$sstorage engines%2$s documentation for details on MySQL engines.','yarpp'),
64
- '<a href="https://dev.mysql.com/doc/refman/8.0/en/storage-engines.html" target="_blank">',
65
- '</a>'
66
- );
67
- ?>
68
- </p>
69
- </div>
70
- </div>
71
- <?php
72
- } elseif($yarpp->diagnostic_big_db()){
73
- // it's a big database. So while we *can* automatically add indexes, we need to warn the site owner.
74
- ?>
75
- <div class='yarpp-callout yarpp-notice'>
76
- <p><?php esc_html_e('Enabling comparisons using titles or bodies will automatically add "fulltext indexes".', 'yarpp');?>
77
- <a href="#" id="yarpp_fulltext_expand"><?php
78
- printf(
79
- // translators: icon to expand
80
- __('Show Details %s','yarpp'),
81
- '[+]'
82
- );
83
- ?>
84
- </a>
85
- </p>
86
- <div id="yarpp_fulltext_details" class="hidden">
87
- <p><?php esc_html_e('"Fulltext indexes" will improve YARPP’s algorithm but may affect performance.', 'yarpp');?></p>
88
- <p><?php esc_html_e('You have a large database and so adding them may take several minutes and cause the website to become unresponsive during this time. We recommend performing this action during off-peak hours.', 'yarpp');?></p>
89
- <p><?php esc_html_e('Please make a database backup before attempting this, and consider adding the indexes manually by running the following queries:', 'yarpp');?></p>
90
- <code>
91
- ALTER TABLE <?php echo $wpdb->posts;?> ADD FULLTEXT `yarpp_content` (`post_content`);
92
- ALTER TABLE <?php echo $wpdb->posts;?> ADD FULLTEXT `yarpp_title` (`post_title`);
93
- </code>
94
- </div>
95
- </div>
96
- <?php
97
- }
98
- }
99
- }
 
 
 
 
 
 
 
 
 
 
 
 
1
  <?php
2
 
3
  class YARPP_Meta_Box_Relatedness extends YARPP_Meta_Box {
4
+ public function display() {
5
+ global $yarpp;
6
+ ?>
7
+ <p><?php _e( 'YARPP limits the related posts list by (1) a maximum number and (2) a <em>match threshold</em>.', 'yarpp' ); ?> <span class='yarpp_help dashicons dashicons-editor-help' data-help="<?php echo esc_attr( __( 'The higher the match threshold, the more restrictive, and you get less related posts overall. The default match threshold is 5. If you want to find an appropriate match threshold, take a look at some post\'s related posts display and their scores. You can see what kinds of related posts are being picked up and with what kind of match scores, and determine an appropriate threshold for your site.', 'yarpp' ) ); ?>">&nbsp;</span></p>
8
 
9
+ <?php
10
+ $this->textbox( 'threshold', __( 'Match threshold:', 'yarpp' ) );
11
+ $this->disabled_warning();
12
+ $this->weight( 'title', __( 'Titles: ', 'yarpp' ) );
13
+ $this->weight( 'body', __( 'Bodies: ', 'yarpp' ) );
14
 
15
+ foreach ( $yarpp->get_taxonomies() as $taxonomy ) {
16
+ $this->tax_weight( $taxonomy );
17
+ }
18
+ }
19
 
20
  /**
21
  * If applicable, echos out a warning that the fulltext indexes don't exist and so comparing using titles and bodies
22
+ * must be disabled until some database changes happen.
23
  */
24
+ protected function disabled_warning() {
25
+ global $yarpp, $wpdb;
26
+ $database_supports_fulltext_indexes = $yarpp->db_schema->database_supports_fulltext_indexes();
27
+ if ( ! $database_supports_fulltext_indexes ) {
28
+ ?>
29
+ <div class='yarpp-callout yarpp-notice'>
30
+ <p>
31
+ <?php
32
+ esc_html_e('Comparing posts based on Titles or Bodies is currently disabled', 'yarpp');
33
+ ?>
34
+ &nbsp;&nbsp;<a href="#" id="yarpp_fulltext_expand">
35
+ <?php
36
+ printf(
37
+ // translators: icon to expand
38
+ __('Show Details %s', 'yarpp'),
39
+ '[+]'
40
+ );
41
+ ?>
42
+ </a>
43
+ </p>
44
+ <div id="yarpp_fulltext_details" class="hidden">
45
+ <p>
46
+ <?php
47
+ printf(
48
+ esc_html__('Because full-text indexing is not supported by your current table engine, "%1$s", YARPP cannot compare posts based on their Titles or Bodies.', 'yarpp'),
49
+ 'InnoDB',
50
+ '5.6.4',
51
+ '<code>' . $wpdb->posts . '</code>',
52
+ 'MyISAM'
53
+ );
54
+ ?>
55
+ </p>
56
+ <p>
57
+ <?php
58
+ printf(
59
+ esc_html__('Please contact your host about updating MySQL to at latest version %1$s, or run the following SQL code on your MySQL client (eg PHPMyAdmin) or terminal:', 'yarpp'),
60
+ '5.6.4'
61
+ );
62
+ ?>
63
+ </p>
64
+ <p>
65
+ <?php
66
+ printf(
67
+ esc_html__('See MySQL %1$sstorage engines%2$s documentation for details on MySQL engines.', 'yarpp'),
68
+ '<a href="https://dev.mysql.com/doc/refman/8.0/en/storage-engines.html" target="_blank">',
69
+ '</a>'
70
+ );
71
+ ?>
72
+ </p>
73
+ </div>
74
+ </div>
75
+ <?php
76
+ } elseif ($yarpp->diagnostic_big_db() && ( ! $yarpp->db_schema->title_column_has_index() || ! $yarpp->db_schema->content_column_has_index() )) {
77
+ // it's a big database. So while we *can* automatically add indexes, we need to warn the site owner.
78
+ ?>
79
+ <div class='yarpp-callout yarpp-notice'>
80
+ <p><strong><?php esc_html_e('Enabling comparisons using Titles or Bodies requires adding "fulltext indexes" to the posts table.', 'yarpp'); ?></strong>
81
+ <a href="#" id="yarpp_fulltext_expand">
82
+ <?php
83
+ printf(
84
+ // translators: icon to expand
85
+ __('Show Details %s', 'yarpp'),
86
+ '[+]'
87
+ );
88
+ ?>
89
+ </a>
90
+ </p>
91
+ <div id="yarpp_fulltext_details" class="hidden">
92
+ <p><?php esc_html_e('"Fulltext indexes" will improve YARPP’s algorithm but may affect performance.', 'yarpp'); ?></p>
93
+ <p><?php esc_html_e('You have a large database and so adding them may take several minutes and cause the website to become unresponsive during this time. We recommend performing this action during off-peak hours.', 'yarpp'); ?></p>
94
+ <p><?php esc_html_e('Please make a database backup before attempting this, and consider adding the indexes manually by running the following queries:', 'yarpp'); ?></p>
95
+ <p>
96
+ <span class="dashicons <?php echo ( $yarpp->db_schema->content_column_has_index() === true ) ? 'dashicons-yes': 'dashicons-clock'; ?>"></span>
97
+ <code>
98
+ ALTER TABLE <?php echo $wpdb->posts; ?> ADD FULLTEXT `yarpp_content` (`post_content`);
99
+ </code>
100
+ <br/>
101
+ <span class="dashicons <?php echo ( $yarpp->db_schema->title_column_has_index() === true ) ? 'dashicons-yes': 'dashicons-clock'; ?>"></span>
102
+ <code>
103
+ ALTER TABLE <?php echo $wpdb->posts; ?> ADD FULLTEXT `yarpp_title` (`post_title`);
104
+ </code>
105
+ </p>
106
+ </div>
107
+ </div>
108
+ <?php
109
+ }
110
+ }
111
+ }
readme.txt CHANGED
@@ -5,7 +5,7 @@ Requires at least: 3.7
5
  Requires PHP: 5.3
6
  License: GPLv2 or later
7
  Tested up to: 5.7
8
- Stable tag: 5.15.2
9
 
10
  The most popular plugin to display a list of related posts on your site based on a powerful unique algorithm.
11
 
@@ -309,6 +309,9 @@ add_action(
309
  `
310
 
311
  == Changelog ==
 
 
 
312
  = 5.15.2 (12-March-2021) =
313
  * Tested up to WordPress 5.7
314
 
@@ -1103,5 +1106,5 @@ After a break of many years, the plugin is 100% supported now that the baton has
1103
  * Initial upload
1104
 
1105
  == Upgrade Notice ==
1106
- = 5.15.2 =
1107
  We update this plugin regularly so we can make it better for you. Update to the latest version for all of the available features and improvements. Thank you for using YARPP!
5
  Requires PHP: 5.3
6
  License: GPLv2 or later
7
  Tested up to: 5.7
8
+ Stable tag: 5.15.3
9
 
10
  The most popular plugin to display a list of related posts on your site based on a powerful unique algorithm.
11
 
309
  `
310
 
311
  == Changelog ==
312
+ = 5.15.3 (15-March-2021) =
313
+ * Enhancement: Improved readability of the database indexes prompt
314
+
315
  = 5.15.2 (12-March-2021) =
316
  * Tested up to WordPress 5.7
317
 
1106
  * Initial upload
1107
 
1108
  == Upgrade Notice ==
1109
+ = 5.15.3 =
1110
  We update this plugin regularly so we can make it better for you. Update to the latest version for all of the available features and improvements. Thank you for using YARPP!
style/options_basic.css CHANGED
@@ -393,8 +393,8 @@ body.rtl #yarpp-optin-learnmore {
393
  .yarpp-callout{
394
  margin: 5px 0 15px;
395
  border: 1px solid #ccd0d4;
396
- border-left-width:4px;
397
- padding:1px 12px;
398
  }
399
  .yarpp-notice{
400
  border-left-color:#ffb900;;
393
  .yarpp-callout{
394
  margin: 5px 0 15px;
395
  border: 1px solid #ccd0d4;
396
+ border-left-width: 4px;
397
+ padding: 1px 12px;
398
  }
399
  .yarpp-notice{
400
  border-left-color:#ffb900;;
yarpp.php CHANGED
@@ -2,7 +2,7 @@
2
  /*
3
  Plugin Name: Yet Another Related Posts Plugin (YARPP)
4
  Description: Adds related posts to your site and in RSS feeds, based on a powerful, customizable algorithm.
5
- Version: 5.15.2
6
  Author: YARPP
7
  Author URI: https://yarpp.com/
8
  Plugin URI: https://yarpp.com/
@@ -24,7 +24,7 @@ if(!defined('WP_CONTENT_DIR')){
24
  define('WP_CONTENT_DIR', substr($tr,0,strrpos($tr,'/')));
25
  }
26
 
27
- define('YARPP_VERSION', '5.15.2');
28
 
29
  define('YARPP_DIR', dirname(__FILE__));
30
  /**
2
  /*
3
  Plugin Name: Yet Another Related Posts Plugin (YARPP)
4
  Description: Adds related posts to your site and in RSS feeds, based on a powerful, customizable algorithm.
5
+ Version: 5.15.3
6
  Author: YARPP
7
  Author URI: https://yarpp.com/
8
  Plugin URI: https://yarpp.com/
24
  define('WP_CONTENT_DIR', substr($tr,0,strrpos($tr,'/')));
25
  }
26
 
27
+ define('YARPP_VERSION', '5.15.3');
28
 
29
  define('YARPP_DIR', dirname(__FILE__));
30
  /**