Related Posts for WordPress - Version 1.7.6

Version Description

Download this release

Release Info

Developer barrykooij
Plugin Icon 128x128 Related Posts for WordPress
Version 1.7.6
Comparing to
See all releases

Code changes from version 1.7.5 to 1.7.6

classes/class-post-link-manager.php CHANGED
@@ -371,7 +371,7 @@ class RP4WP_Post_Link_Manager {
371
  $excerpt_length = RP4WP::get()->settings->get_option( 'excerpt_length' );
372
  if ( $excerpt_length > 0 ) {
373
  $excerpt = strip_shortcodes( ( ( '' != $rp4wp_post->post_excerpt ) ? $rp4wp_post->post_excerpt : wp_trim_words( $rp4wp_post->post_content, $excerpt_length ) ) );
374
- $content .= "<p>" . $excerpt . "</p>";
375
  }
376
 
377
  $content .= "</div>" . PHP_EOL;
371
  $excerpt_length = RP4WP::get()->settings->get_option( 'excerpt_length' );
372
  if ( $excerpt_length > 0 ) {
373
  $excerpt = strip_shortcodes( ( ( '' != $rp4wp_post->post_excerpt ) ? $rp4wp_post->post_excerpt : wp_trim_words( $rp4wp_post->post_content, $excerpt_length ) ) );
374
+ $content .= "<p>" . apply_filters( 'rp4wp_post_excerpt', $excerpt, $rp4wp_post->ID ) . "</p>";
375
  }
376
 
377
  $content .= "</div>" . PHP_EOL;
classes/class-rp4wp.php CHANGED
@@ -8,7 +8,7 @@ class RP4WP {
8
 
9
  private static $instance = null;
10
 
11
- const VERSION = '1.7.5';
12
 
13
  /**
14
  * @var RP4WP_Settings
8
 
9
  private static $instance = null;
10
 
11
+ const VERSION = '1.7.6';
12
 
13
  /**
14
  * @var RP4WP_Settings
classes/hooks/class-hook-related-auto-link.php CHANGED
@@ -5,11 +5,11 @@ if ( ! defined( 'ABSPATH' ) ) {
5
  } // Exit if accessed directly
6
 
7
  class RP4WP_Hook_Related_Auto_Link extends RP4WP_Hook {
8
- protected $tag = 'save_post';
9
- protected $args = 2;
10
  protected $priority = 11;
11
 
12
- public function run( $post_id, $post ) {
13
 
14
  // verify this is not an auto save routine.
15
  if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
@@ -21,13 +21,8 @@ class RP4WP_Hook_Related_Auto_Link extends RP4WP_Hook {
21
  return;
22
  }
23
 
24
- // Check permission
25
- if ( ! current_user_can( 'edit_post', $post_id ) ) {
26
- return;
27
- }
28
-
29
  // Post status must be publish
30
- if ( 'publish' != $post->post_status ) {
31
  return;
32
  }
33
 
@@ -37,7 +32,7 @@ class RP4WP_Hook_Related_Auto_Link extends RP4WP_Hook {
37
  }
38
 
39
  // Check if the current post is already auto linked
40
- if ( 1 != get_post_meta( $post_id, RP4WP_Constants::PM_POST_AUTO_LINKED, true ) ) {
41
 
42
  // Get automatic linking post amount
43
  $automatic_linking_post_amount = RP4WP::get()->settings->get_option( 'automatic_linking_post_amount' );
@@ -46,10 +41,10 @@ class RP4WP_Hook_Related_Auto_Link extends RP4WP_Hook {
46
  $related_post_manager = new RP4WP_Related_Post_Manager();
47
 
48
  // Link related posts
49
- $related_post_manager->link_related_post( $post_id, $automatic_linking_post_amount );
50
 
51
  // Set the auto linked meta
52
- update_post_meta( $post_id, RP4WP_Constants::PM_POST_AUTO_LINKED, 1 );
53
  }
54
 
55
  }
5
  } // Exit if accessed directly
6
 
7
  class RP4WP_Hook_Related_Auto_Link extends RP4WP_Hook {
8
+ protected $tag = 'transition_post_status';
9
+ protected $args = 3;
10
  protected $priority = 11;
11
 
12
+ public function run( $new_status, $old_status, $post ) {
13
 
14
  // verify this is not an auto save routine.
15
  if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
21
  return;
22
  }
23
 
 
 
 
 
 
24
  // Post status must be publish
25
+ if ( 'publish' != $new_status ) {
26
  return;
27
  }
28
 
32
  }
33
 
34
  // Check if the current post is already auto linked
35
+ if ( 1 != get_post_meta( $post->ID, RP4WP_Constants::PM_POST_AUTO_LINKED, true ) ) {
36
 
37
  // Get automatic linking post amount
38
  $automatic_linking_post_amount = RP4WP::get()->settings->get_option( 'automatic_linking_post_amount' );
41
  $related_post_manager = new RP4WP_Related_Post_Manager();
42
 
43
  // Link related posts
44
+ $related_post_manager->link_related_post( $post->ID, $automatic_linking_post_amount );
45
 
46
  // Set the auto linked meta
47
+ update_post_meta( $post->ID, RP4WP_Constants::PM_POST_AUTO_LINKED, 1 );
48
  }
49
 
50
  }
classes/hooks/class-hook-related-save-words.php CHANGED
@@ -5,10 +5,10 @@ if ( ! defined( 'ABSPATH' ) ) {
5
  } // Exit if accessed directly
6
 
7
  class RP4WP_Hook_Related_Save_Words extends RP4WP_Hook {
8
- protected $tag = 'save_post';
9
- protected $args = 2;
10
 
11
- public function run( $post_id, $post ) {
12
 
13
  // verify this is not an auto save routine.
14
  if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
@@ -20,19 +20,14 @@ class RP4WP_Hook_Related_Save_Words extends RP4WP_Hook {
20
  return;
21
  }
22
 
23
- // Check permission
24
- if ( ! current_user_can( 'edit_post', $post_id ) ) {
25
- return;
26
- }
27
-
28
  // Post status must be publish
29
- if ( 'publish' != $post->post_status ) {
30
  return;
31
  }
32
 
33
  // Save Words
34
  $related_word_manager = new RP4WP_Related_Word_Manager();
35
- $related_word_manager->save_words_of_post( $post_id );
36
 
37
  }
38
  }
5
  } // Exit if accessed directly
6
 
7
  class RP4WP_Hook_Related_Save_Words extends RP4WP_Hook {
8
+ protected $tag = 'transition_post_status';
9
+ protected $args = 3;
10
 
11
+ public function run( $new_status, $old_status, $post ) {
12
 
13
  // verify this is not an auto save routine.
14
  if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
20
  return;
21
  }
22
 
 
 
 
 
 
23
  // Post status must be publish
24
+ if ( 'publish' != $new_status ) {
25
  return;
26
  }
27
 
28
  // Save Words
29
  $related_word_manager = new RP4WP_Related_Word_Manager();
30
+ $related_word_manager->save_words_of_post( $post->ID );
31
 
32
  }
33
  }
classes/settings/class-settings.php CHANGED
@@ -30,6 +30,14 @@ class RP4WP_Settings {
30
  $css_default_lines[] = '.rp4wp-related-posts ul>li>p{margin:0;padding:0;}';
31
  $css_default_lines[] = '.rp4wp-related-post-image{width:35%;padding-right:25px;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box;float:left;}';
32
 
 
 
 
 
 
 
 
 
33
  // The fields
34
  $this->sections = array(
35
  self::PREFIX . 'automatic_linking' => array(
30
  $css_default_lines[] = '.rp4wp-related-posts ul>li>p{margin:0;padding:0;}';
31
  $css_default_lines[] = '.rp4wp-related-post-image{width:35%;padding-right:25px;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box;float:left;}';
32
 
33
+ if ( is_rtl() ) {
34
+ $css_default_lines = array();
35
+ $css_default_lines[] = '.rp4wp-related-posts ul{width:100%;padding:0;margin:0;float:right;}';
36
+ $css_default_lines[] = '.rp4wp-related-posts ul>li{list-style:none;padding:0;margin:0;padding-bottom:20px;float:right;}';
37
+ $css_default_lines[] = '.rp4wp-related-posts ul>li>p{margin:0;padding:0;}';
38
+ $css_default_lines[] = '.rp4wp-related-post-image{width:35%;padding-left:25px;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box;float:right;}';
39
+ }
40
+
41
  // The fields
42
  $this->sections = array(
43
  self::PREFIX . 'automatic_linking' => array(
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: barrykooij
3
  Donate link: http://www.relatedpostsforwp.com/
4
  Tags: related posts for wordpress, related posts for wp, simple related posts, easy related posts, related posts, related, relations, internal links, seo, bounce rate
5
  Requires at least: 3.6
6
- Tested up to: 4.0
7
- Stable tag: 1.7.5
8
  License: GPLv3 or later
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
@@ -112,6 +112,11 @@ There is one custom table created for the post cache, this table will however no
112
 
113
  == Changelog ==
114
 
 
 
 
 
 
115
  = 1.7.5: November 15, 2014 =
116
  * Fixed a hardcoded database table bug.
117
  * Display notice and don't load plugin on multisite.
@@ -220,4 +225,4 @@ There is one custom table created for the post cache, this table will however no
220
  * Initial version
221
 
222
  == Upgrade Notice ==
223
- This version is safe to upgrade. If all of your related posts are linked automatically, we do recommend rerunning the wizard for better results.
3
  Donate link: http://www.relatedpostsforwp.com/
4
  Tags: related posts for wordpress, related posts for wp, simple related posts, easy related posts, related posts, related, relations, internal links, seo, bounce rate
5
  Requires at least: 3.6
6
+ Tested up to: 4.1
7
+ Stable tag: 1.7.6
8
  License: GPLv3 or later
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
112
 
113
  == Changelog ==
114
 
115
+ = 1.7.6: December 2, 2014 =
116
+ * Added 'rp4wp_post_excerpt' filter.
117
+ * Added RTL support.
118
+ * Fixed a scheduled post bug
119
+
120
  = 1.7.5: November 15, 2014 =
121
  * Fixed a hardcoded database table bug.
122
  * Display notice and don't load plugin on multisite.
225
  * Initial version
226
 
227
  == Upgrade Notice ==
228
+ This version is safe to upgrade. If all of your related posts are linked automatically, we do recommend rerunning the wizard for better results.
related-posts-for-wp.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Related Posts for WordPress
4
  Plugin URI: http://www.relatedpostsforwp.com/
5
  Description: Related Posts for WordPress, the best way to display related posts in WordPress.
6
- Version: 1.7.5
7
  Author: Barry Kooij
8
  Author URI: http://www.barrykooij.com/
9
  License: GPL v3
3
  Plugin Name: Related Posts for WordPress
4
  Plugin URI: http://www.relatedpostsforwp.com/
5
  Description: Related Posts for WordPress, the best way to display related posts in WordPress.
6
+ Version: 1.7.6
7
  Author: Barry Kooij
8
  Author URI: http://www.barrykooij.com/
9
  License: GPL v3