Version Description
Download this release
Release Info
Developer | barrykooij |
Plugin | Related Posts for WordPress |
Version | 1.4.1 |
Comparing to | |
See all releases |
Code changes from version 1.4.0 to 1.4.1
- classes/class-manager-filter.php +50 -46
- classes/class-manager-hook.php +35 -32
- classes/filters/class-filter-after-post.php +5 -0
- classes/filters/class-filter.php +29 -4
- classes/hooks/class-hook.php +29 -4
- readme.txt +13 -6
- related-posts-for-wp.php +3 -3
classes/class-manager-filter.php
CHANGED
@@ -1,68 +1,72 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
if ( !
|
4 |
exit;
|
5 |
} // Exit if accessed directly
|
6 |
|
7 |
-
|
8 |
|
9 |
-
|
10 |
-
private static $filters;
|
11 |
|
12 |
-
|
13 |
-
|
14 |
-
}
|
15 |
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
|
|
|
|
|
|
|
|
|
|
26 |
}
|
27 |
-
}
|
28 |
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
|
38 |
-
|
39 |
-
$file_name = $file->getFileName();
|
40 |
|
41 |
-
|
42 |
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
|
|
|
48 |
}
|
|
|
49 |
}
|
50 |
|
51 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
52 |
|
53 |
-
|
54 |
-
* Return instance of created hook
|
55 |
-
*
|
56 |
-
* @param $class_name
|
57 |
-
*
|
58 |
-
* @return Hook
|
59 |
-
*/
|
60 |
-
public function get_hook_instance( $class_name ) {
|
61 |
-
if ( isset( self::$hooks[$class_name] ) ) {
|
62 |
-
return self::$hooks[$class_name];
|
63 |
}
|
64 |
|
65 |
-
return null;
|
66 |
}
|
67 |
|
68 |
-
}
|
|
1 |
<?php
|
2 |
|
3 |
+
if ( !defined( 'ABSPATH' ) ) {
|
4 |
exit;
|
5 |
} // Exit if accessed directly
|
6 |
|
7 |
+
if ( !class_exists( 'RP4WP_Manager_Filter' ) ) {
|
8 |
|
9 |
+
class RP4WP_Manager_Filter {
|
|
|
10 |
|
11 |
+
private $filter_dir;
|
12 |
+
private static $filters;
|
|
|
13 |
|
14 |
+
public function __construct( $filter_dir ) {
|
15 |
+
$this->filter_dir = $filter_dir;
|
16 |
+
}
|
17 |
+
|
18 |
+
/**
|
19 |
+
* Load on specific filter instead of all filters.
|
20 |
+
* This method should be used when the load_filters() isn't run yet, for example in the (de)activation process.
|
21 |
+
*
|
22 |
+
* @param $file_name
|
23 |
+
*/
|
24 |
+
public function load_filter( $file_name ) {
|
25 |
+
$class = RP4WP_Class_Manager::format_class_name( $file_name );
|
26 |
+
if ( 'RP4WP_Filter' != $class ) {
|
27 |
+
self::$filters[$class] = new $class;
|
28 |
+
}
|
29 |
}
|
|
|
30 |
|
31 |
+
/**
|
32 |
+
* Load and set hooks
|
33 |
+
*
|
34 |
+
* @access public
|
35 |
+
* @static
|
36 |
+
* @return void
|
37 |
+
*/
|
38 |
+
public function load_filters() {
|
39 |
|
40 |
+
foreach ( new DirectoryIterator( $this->filter_dir ) as $file ) {
|
|
|
41 |
|
42 |
+
if ( !$file->isDir() && ( strpos( $file->getFileName(), '.' ) !== 0 ) ) {
|
43 |
|
44 |
+
$class = RP4WP_Class_Manager::format_class_name( $file->getFileName() );
|
45 |
+
if ( 'RP4WP_Filter' != $class ) {
|
46 |
+
self::$filters[$class] = new $class;
|
47 |
+
}
|
48 |
|
49 |
+
}
|
50 |
}
|
51 |
+
|
52 |
}
|
53 |
|
54 |
+
/**
|
55 |
+
* Return instance of created hook
|
56 |
+
*
|
57 |
+
* @param $class_name
|
58 |
+
*
|
59 |
+
* @return RP4WP_Filter
|
60 |
+
*/
|
61 |
+
public static function get_filter_object( $class_name ) {
|
62 |
+
if ( isset( self::$filters[$class_name] ) ) {
|
63 |
+
return self::$filters[$class_name];
|
64 |
+
}
|
65 |
|
66 |
+
return null;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
67 |
}
|
68 |
|
|
|
69 |
}
|
70 |
|
71 |
+
}
|
72 |
+
|
classes/class-manager-hook.php
CHANGED
@@ -4,53 +4,56 @@ if ( !defined( 'ABSPATH' ) ) {
|
|
4 |
exit;
|
5 |
} // Exit if accessed directly
|
6 |
|
7 |
-
|
8 |
|
9 |
-
|
10 |
-
private static $hooks;
|
11 |
|
12 |
-
|
13 |
-
|
14 |
-
|
|
|
|
|
|
|
15 |
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
|
25 |
-
|
26 |
-
$file_name = $file->getFileName();
|
27 |
|
28 |
-
|
|
|
|
|
|
|
|
|
|
|
29 |
|
30 |
-
$class = RP4WP_Class_Manager::format_class_name( $file->getFileName() );
|
31 |
-
if ( 'RP4WP_Hook' != $class ) {
|
32 |
-
self::$hooks[$class] = new $class;
|
33 |
}
|
34 |
|
35 |
}
|
36 |
|
37 |
}
|
38 |
|
39 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
40 |
|
41 |
-
|
42 |
-
* Return instance of created hook
|
43 |
-
*
|
44 |
-
* @param $class_name
|
45 |
-
*
|
46 |
-
* @return Hook
|
47 |
-
*/
|
48 |
-
public function get_hook_instance( $class_name ) {
|
49 |
-
if ( isset( self::$hooks[$class_name] ) ) {
|
50 |
-
return self::$hooks[$class_name];
|
51 |
}
|
52 |
|
53 |
-
return null;
|
54 |
}
|
55 |
|
56 |
}
|
4 |
exit;
|
5 |
} // Exit if accessed directly
|
6 |
|
7 |
+
if ( !class_exists( 'RP4WP_Manager_Hook' ) ) {
|
8 |
|
9 |
+
class RP4WP_Manager_Hook {
|
|
|
10 |
|
11 |
+
private $hook_dir;
|
12 |
+
private static $hooks;
|
13 |
+
|
14 |
+
public function __construct( $hook_dir ) {
|
15 |
+
$this->hook_dir = $hook_dir;
|
16 |
+
}
|
17 |
|
18 |
+
/**
|
19 |
+
* Load and set hooks
|
20 |
+
*
|
21 |
+
* @access public
|
22 |
+
* @static
|
23 |
+
* @return void
|
24 |
+
*/
|
25 |
+
public function load_hooks() {
|
26 |
|
27 |
+
foreach ( new DirectoryIterator( $this->hook_dir ) as $file ) {
|
|
|
28 |
|
29 |
+
if ( !$file->isDir() && ( strpos( $file->getFileName(), '.' ) !== 0 ) ) {
|
30 |
+
|
31 |
+
$class = RP4WP_Class_Manager::format_class_name( $file->getFileName() );
|
32 |
+
if ( 'RP4WP_Hook' != $class ) {
|
33 |
+
self::$hooks[$class] = new $class;
|
34 |
+
}
|
35 |
|
|
|
|
|
|
|
36 |
}
|
37 |
|
38 |
}
|
39 |
|
40 |
}
|
41 |
|
42 |
+
/**
|
43 |
+
* Return instance of created hook
|
44 |
+
*
|
45 |
+
* @param $class_name
|
46 |
+
*
|
47 |
+
* @return RP4WP_Hook
|
48 |
+
*/
|
49 |
+
public static function get_hook_object( $class_name ) {
|
50 |
+
if ( isset( self::$hooks[$class_name] ) ) {
|
51 |
+
return self::$hooks[$class_name];
|
52 |
+
}
|
53 |
|
54 |
+
return null;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
55 |
}
|
56 |
|
|
|
57 |
}
|
58 |
|
59 |
}
|
classes/filters/class-filter-after-post.php
CHANGED
@@ -28,6 +28,11 @@ class RP4WP_Filter_After_Post extends RP4WP_Filter {
|
|
28 |
return $content;
|
29 |
}
|
30 |
|
|
|
|
|
|
|
|
|
|
|
31 |
// Post Link Manager
|
32 |
$pl_manager = new RP4WP_Post_Link_Manager();
|
33 |
|
28 |
return $content;
|
29 |
}
|
30 |
|
31 |
+
// Allow disabling content filter
|
32 |
+
if( false === apply_filters( 'rp4wp_append_content', true ) ) {
|
33 |
+
return $content;
|
34 |
+
}
|
35 |
+
|
36 |
// Post Link Manager
|
37 |
$pl_manager = new RP4WP_Post_Link_Manager();
|
38 |
|
classes/filters/class-filter.php
CHANGED
@@ -13,10 +13,6 @@ abstract class RP4WP_Filter {
|
|
13 |
* Construct method. Set tag and register hook.
|
14 |
*
|
15 |
* @access public
|
16 |
-
*
|
17 |
-
* @param mixed $tag (default: null)
|
18 |
-
*
|
19 |
-
* @return void
|
20 |
*/
|
21 |
public function __construct() {
|
22 |
$this->register();
|
@@ -37,4 +33,33 @@ abstract class RP4WP_Filter {
|
|
37 |
add_filter( $this->tag, array( $this, 'run' ), $this->priority, $this->args );
|
38 |
}
|
39 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
40 |
}
|
13 |
* Construct method. Set tag and register hook.
|
14 |
*
|
15 |
* @access public
|
|
|
|
|
|
|
|
|
16 |
*/
|
17 |
public function __construct() {
|
18 |
$this->register();
|
33 |
add_filter( $this->tag, array( $this, 'run' ), $this->priority, $this->args );
|
34 |
}
|
35 |
|
36 |
+
/**
|
37 |
+
* Get the args
|
38 |
+
*
|
39 |
+
* @return int
|
40 |
+
*/
|
41 |
+
public function get_args() {
|
42 |
+
return $this->args;
|
43 |
+
}
|
44 |
+
|
45 |
+
/**
|
46 |
+
* Get the priority
|
47 |
+
*
|
48 |
+
* @return int
|
49 |
+
*/
|
50 |
+
public function get_priority() {
|
51 |
+
return $this->priority;
|
52 |
+
}
|
53 |
+
|
54 |
+
/**
|
55 |
+
* Get the tag
|
56 |
+
*
|
57 |
+
* @return string
|
58 |
+
*/
|
59 |
+
public function get_tag() {
|
60 |
+
return $this->tag;
|
61 |
+
}
|
62 |
+
|
63 |
+
|
64 |
+
|
65 |
}
|
classes/hooks/class-hook.php
CHANGED
@@ -13,10 +13,6 @@ abstract class RP4WP_Hook {
|
|
13 |
* Construct method. Set tag and register hook.
|
14 |
*
|
15 |
* @access public
|
16 |
-
*
|
17 |
-
* @param mixed $tag (default: null)
|
18 |
-
*
|
19 |
-
* @return void
|
20 |
*/
|
21 |
public function __construct() {
|
22 |
$this->register();
|
@@ -37,4 +33,33 @@ abstract class RP4WP_Hook {
|
|
37 |
add_action( $this->tag, array( $this, 'run' ), $this->priority, $this->args );
|
38 |
}
|
39 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
40 |
}
|
13 |
* Construct method. Set tag and register hook.
|
14 |
*
|
15 |
* @access public
|
|
|
|
|
|
|
|
|
16 |
*/
|
17 |
public function __construct() {
|
18 |
$this->register();
|
33 |
add_action( $this->tag, array( $this, 'run' ), $this->priority, $this->args );
|
34 |
}
|
35 |
|
36 |
+
/**
|
37 |
+
* Get args
|
38 |
+
*
|
39 |
+
* @return int
|
40 |
+
*/
|
41 |
+
public function get_args() {
|
42 |
+
return $this->args;
|
43 |
+
}
|
44 |
+
|
45 |
+
/**
|
46 |
+
* Get priority
|
47 |
+
*
|
48 |
+
* @return int
|
49 |
+
*/
|
50 |
+
public function get_priority() {
|
51 |
+
return $this->priority;
|
52 |
+
}
|
53 |
+
|
54 |
+
/**
|
55 |
+
* Get tag
|
56 |
+
*
|
57 |
+
* @return string
|
58 |
+
*/
|
59 |
+
public function get_tag() {
|
60 |
+
return $this->tag;
|
61 |
+
}
|
62 |
+
|
63 |
+
|
64 |
+
|
65 |
}
|
readme.txt
CHANGED
@@ -1,11 +1,11 @@
|
|
1 |
=== Related Posts for WordPress ===
|
2 |
Contributors: barrykooij
|
3 |
-
Donate link: http://www.
|
4 |
-
Tags: related posts for wordpress, related posts for wp, simple related posts, easy related posts, related posts, related, relations, internal links, seo
|
5 |
Requires at least: 3.6
|
6 |
Tested up to: 4.0
|
7 |
-
Stable tag: 1.4.
|
8 |
-
License:
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
11 |
Display related posts without slowing down your website! Link all your existing content with only 1 click, get related posts for all your posts today!
|
@@ -28,10 +28,11 @@ After installing the plugin you will be taking to a wizard that will analyze you
|
|
28 |
Everyone makes mistakes, so do we. That's why you can easily modify all automatically created related posts. Simply navigate to the post that has incorrect related posts attached to it, edit it and you're done.
|
29 |
|
30 |
= WPML compatible =
|
31 |
-
Related Posts for WordPress is fully compatible with WPML. You can automatically
|
32 |
|
33 |
**More information**
|
34 |
|
|
|
35 |
- Other [WordPress plugins](http://profiles.wordpress.org/barrykooij/) by [Barry Kooij](http://www.barrykooij.com/)
|
36 |
- Contact Barry on Twitter: [@CageNL](http://twitter.com/CageNL)
|
37 |
- If you're a dev, follow or contribute to the [Related Posts for WordPress plugin on GitHub](https://github.com/barrykooij/related-posts-for-wp)
|
@@ -46,6 +47,8 @@ Related Posts for WordPress is fully compatible with WPML. You can automatically
|
|
46 |
|
47 |
== Frequently Asked Questions ==
|
48 |
|
|
|
|
|
49 |
= Where's the settings screen? =
|
50 |
Settings > Related Posts.
|
51 |
|
@@ -64,7 +67,7 @@ Not yet, we're working on this and this will be added soon!
|
|
64 |
= Is there a shortcode? =
|
65 |
Yes, use [rp4wp]
|
66 |
|
67 |
-
= Does
|
68 |
There is one custom table created for the post cache, this table will however not be used at the frontend of your website. Related Posts are fetched with normal WP_Query objects.
|
69 |
|
70 |
== Screenshots ==
|
@@ -76,6 +79,10 @@ There is one custom table created for the post cache, this table will however no
|
|
76 |
|
77 |
== Changelog ==
|
78 |
|
|
|
|
|
|
|
|
|
79 |
= 1.4.0: August 24, 2014 =
|
80 |
* Created the possibility to restart the installation wizard. See settings page for this option.
|
81 |
* Added notice that allows resuming installation wizard that will be displayed if the installation wizard crashed.
|
1 |
=== Related Posts for WordPress ===
|
2 |
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.4.1
|
8 |
+
License: GPLv3 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
11 |
Display related posts without slowing down your website! Link all your existing content with only 1 click, get related posts for all your posts today!
|
28 |
Everyone makes mistakes, so do we. That's why you can easily modify all automatically created related posts. Simply navigate to the post that has incorrect related posts attached to it, edit it and you're done.
|
29 |
|
30 |
= WPML compatible =
|
31 |
+
Related Posts for WordPress is fully compatible with WPML. You can automatically add manually link related posts in their own language.
|
32 |
|
33 |
**More information**
|
34 |
|
35 |
+
- Visit the [Related Posts for WordPress website](http://www.relatedpostsforwp.com/?utm_source=wp-plugin-repo&utm_medium=link&utm_campaign=more-information)
|
36 |
- Other [WordPress plugins](http://profiles.wordpress.org/barrykooij/) by [Barry Kooij](http://www.barrykooij.com/)
|
37 |
- Contact Barry on Twitter: [@CageNL](http://twitter.com/CageNL)
|
38 |
- If you're a dev, follow or contribute to the [Related Posts for WordPress plugin on GitHub](https://github.com/barrykooij/related-posts-for-wp)
|
47 |
|
48 |
== Frequently Asked Questions ==
|
49 |
|
50 |
+
Please see the [FAQ section at our website.](http://www.relatedpostsforwp.com/faq/?utm_source=wp-plugin-repo&utm_medium=link&utm_campaign=faq)
|
51 |
+
|
52 |
= Where's the settings screen? =
|
53 |
Settings > Related Posts.
|
54 |
|
67 |
= Is there a shortcode? =
|
68 |
Yes, use [rp4wp]
|
69 |
|
70 |
+
= Does Related Posts for WordPress uses it's own database table ? =
|
71 |
There is one custom table created for the post cache, this table will however not be used at the frontend of your website. Related Posts are fetched with normal WP_Query objects.
|
72 |
|
73 |
== Screenshots ==
|
79 |
|
80 |
== Changelog ==
|
81 |
|
82 |
+
= 1.4.1: August 29, 2014 =
|
83 |
+
* Added filter 'rp4wp_append_content' to allow disabling of related post append to content.
|
84 |
+
* Fixed various hook and filter class bugs.
|
85 |
+
|
86 |
= 1.4.0: August 24, 2014 =
|
87 |
* Created the possibility to restart the installation wizard. See settings page for this option.
|
88 |
* Added notice that allows resuming installation wizard that will be displayed if the installation wizard crashed.
|
related-posts-for-wp.php
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
<?php
|
2 |
/*
|
3 |
Plugin Name: Related Posts for WordPress
|
4 |
-
Plugin URI: http://www.
|
5 |
Description: Related Posts for WordPress, related posts that perform!
|
6 |
-
Version: 1.4.
|
7 |
Author: Barry Kooij
|
8 |
Author URI: http://www.barrykooij.com/
|
9 |
License: GPL v3
|
@@ -26,7 +26,7 @@ class RP4WP {
|
|
26 |
|
27 |
private static $instance = null;
|
28 |
|
29 |
-
const VERSION = '1.4.
|
30 |
|
31 |
/**
|
32 |
* @var RP4WP_Settings
|
1 |
<?php
|
2 |
/*
|
3 |
Plugin Name: Related Posts for WordPress
|
4 |
+
Plugin URI: http://www.relatedpostsforwp.com/
|
5 |
Description: Related Posts for WordPress, related posts that perform!
|
6 |
+
Version: 1.4.1
|
7 |
Author: Barry Kooij
|
8 |
Author URI: http://www.barrykooij.com/
|
9 |
License: GPL v3
|
26 |
|
27 |
private static $instance = null;
|
28 |
|
29 |
+
const VERSION = '1.4.1';
|
30 |
|
31 |
/**
|
32 |
* @var RP4WP_Settings
|