Related Posts for WordPress - Version 1.6.2

Version Description

Download this release

Release Info

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

Code changes from version 1.6.1 to 1.6.2

classes/class-constants.php CHANGED
@@ -25,7 +25,7 @@ abstract class RP4WP_Constants {
25
  const OPTION_INSTALL_DATE = 'rp4wp_install_date';
26
  const OPTION_ADMIN_NOTICE_KEY = 'rp4wp_hide_nag';
27
 
 
28
  const NONCE_REINSTALL = 'rp4wp-reinstall-secret';
29
 
30
-
31
  }
25
  const OPTION_INSTALL_DATE = 'rp4wp_install_date';
26
  const OPTION_ADMIN_NOTICE_KEY = 'rp4wp_hide_nag';
27
 
28
+ // Nonce
29
  const NONCE_REINSTALL = 'rp4wp-reinstall-secret';
30
 
 
31
  }
classes/class-rp4wp.php ADDED
@@ -0,0 +1,149 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if ( ! defined( 'ABSPATH' ) ) {
4
+ exit;
5
+ } // Exit if accessed directly
6
+
7
+ class RP4WP {
8
+
9
+ private static $instance = null;
10
+
11
+ const VERSION = '1.6.2';
12
+
13
+ /**
14
+ * @var RP4WP_Settings
15
+ */
16
+ public $settings = null;
17
+
18
+ /**
19
+ * Singleton get method
20
+ *
21
+ * @since 1.0.0
22
+ * @access public
23
+ *
24
+ * @return RP4WP
25
+ */
26
+ public static function get() {
27
+ if ( null == self::$instance ) {
28
+ self::$instance = new self();
29
+ }
30
+
31
+ return self::$instance;
32
+ }
33
+
34
+ /**
35
+ * Get the plugin file
36
+ *
37
+ * @access public
38
+ * @static
39
+ * @return String
40
+ */
41
+ public static function get_plugin_file() {
42
+ return RP4WP_PLUGIN_FILE;
43
+ }
44
+
45
+ /**
46
+ * A static method that will setup the autoloader
47
+ */
48
+ private static function setup_autoloader() {
49
+ require_once( plugin_dir_path( self::get_plugin_file() ) . '/classes/class-autoloader.php' );
50
+ $autoloader = new RP4WP_Autoloader( plugin_dir_path( self::get_plugin_file() ) . 'classes/' );
51
+ spl_autoload_register( array( $autoloader, 'load' ) );
52
+ }
53
+
54
+ /**
55
+ * This method runs on plugin activation
56
+ */
57
+ public static function activation() {
58
+
59
+ // Setup autoloader
60
+ self::setup_autoloader();
61
+
62
+ // Run the installer
63
+ $installer = new RP4WP_Installer();
64
+ $installer->install();
65
+
66
+ // Redirect to installation wizard
67
+ add_site_option( RP4WP_Constants::OPTION_DO_INSTALL, true );
68
+ }
69
+
70
+ /**
71
+ * The constructor
72
+ */
73
+ private function __construct() {
74
+ $this->init();
75
+ }
76
+
77
+ /**
78
+ * Initialize the plugin
79
+ */
80
+ private function init() {
81
+
82
+ // Setup the autoloader
83
+ self::setup_autoloader();
84
+
85
+ // Load plugin text domain
86
+ load_plugin_textdomain( 'related-posts-for-wp', false, dirname( plugin_basename( RP4WP_PLUGIN_FILE ) ) . '/languages/' );
87
+
88
+ // Check if we need to run the installer
89
+ if ( is_admin() && get_site_option( RP4WP_Constants::OPTION_DO_INSTALL, false ) ) {
90
+
91
+ // Delete do install site option
92
+ delete_site_option( RP4WP_Constants::OPTION_DO_INSTALL );
93
+
94
+ // Redirect to installation wizard
95
+ wp_redirect( admin_url() . '?page=rp4wp_install', 307 );
96
+ exit;
97
+ }
98
+
99
+ if ( is_admin() ) {
100
+ // Check if we need to display an 'is installing' notice
101
+ $is_installing_notice = new RP4WP_Is_Installing_Notice();
102
+ $is_installing_notice->check();
103
+ }
104
+
105
+ // Setup settings
106
+ add_action( 'init', array( $this, 'setup_settings' ) );
107
+
108
+ // Filters
109
+ $manager_filter = new RP4WP_Manager_Filter( plugin_dir_path( RP4WP_PLUGIN_FILE ) . 'classes/filters/' );
110
+ $manager_filter->load_filters();
111
+
112
+ // Hooks
113
+ $manager_hook = new RP4WP_Manager_Hook( plugin_dir_path( RP4WP_PLUGIN_FILE ) . 'classes/hooks/' );
114
+ $manager_hook->load_hooks();
115
+
116
+ // Include template functions
117
+ if ( ! is_admin() ) {
118
+ require_once( plugin_dir_path( self::get_plugin_file() ) . '/includes/template-functions.php' );
119
+ }
120
+
121
+ // Setup the nag
122
+ if ( is_admin() ) {
123
+ $nag_manager = new RP4WP_Nag_Manager();
124
+ $nag_manager->setup();
125
+ }
126
+
127
+ }
128
+
129
+ /**
130
+ * Setup the settings
131
+ *
132
+ * @since 1.6.2
133
+ * @access public
134
+ */
135
+ public function setup_settings() {
136
+ $this->settings = new RP4WP_Settings();
137
+ }
138
+
139
+ }
140
+
141
+ /**
142
+ * @since 1.0.0
143
+ * @access public
144
+ *
145
+ * @return RP4WP
146
+ */
147
+ function RP4WP() {
148
+ return RP4WP::get();
149
+ }
classes/class-settings.php CHANGED
@@ -97,7 +97,7 @@ class RP4WP_Settings {
97
  'description' => __( "Click this button if you want to restart the wizard. Please note that this will delete all current related post links, also those you've manually added. Of course, we will never delete your actual posts.", 'related-posts-for-wp' ),
98
  'type' => 'button_link',
99
  'href' => admin_url( '?page=rp4wp_install&reinstall=1&rp4wp_nonce=' . wp_create_nonce( RP4WP_Constants::NONCE_REINSTALL ) ),
100
- 'default' => __( 'Restart wizard', '' ),
101
  ),
102
  ) ),
103
  self::PREFIX . 'misc' => array(
97
  'description' => __( "Click this button if you want to restart the wizard. Please note that this will delete all current related post links, also those you've manually added. Of course, we will never delete your actual posts.", 'related-posts-for-wp' ),
98
  'type' => 'button_link',
99
  'href' => admin_url( '?page=rp4wp_install&reinstall=1&rp4wp_nonce=' . wp_create_nonce( RP4WP_Constants::NONCE_REINSTALL ) ),
100
+ 'default' => __( 'Restart wizard', 'related-posts-for-wp' ),
101
  ),
102
  ) ),
103
  self::PREFIX . 'misc' => array(
readme.txt CHANGED
@@ -4,7 +4,7 @@ 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.6.1
8
  License: GPLv3 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -88,6 +88,10 @@ There is one custom table created for the post cache, this table will however no
88
 
89
  == Changelog ==
90
 
 
 
 
 
91
  = 1.6.1: September 13, 2014 =
92
  * Fixed a bug that caused the manual post link table to be empty.
93
  * Added checks to only do certain checks in admin.
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.6.2
8
  License: GPLv3 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
88
 
89
  == Changelog ==
90
 
91
+ = 1.6.2: September 17, 2014 =
92
+ * Fixed a WSOD caused by wp_created_nonce being called before init hook.
93
+ * Changed the way the plugin is bootstrapped.
94
+
95
  = 1.6.1: September 13, 2014 =
96
  * Fixed a bug that caused the manual post link table to be empty.
97
  * Added checks to only do certain checks in admin.
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.6.1
7
  Author: Barry Kooij
8
  Author URI: http://www.barrykooij.com/
9
  License: GPL v3
@@ -22,140 +22,28 @@
22
  along with this program. If not, see <http://www.gnu.org/licenses/>.
23
  */
24
 
25
- class RP4WP {
26
 
27
- private static $instance = null;
 
 
28
 
29
- const VERSION = '1.6.1';
30
 
31
- /**
32
- * @var RP4WP_Settings
33
- */
34
- public $settings = null;
35
-
36
- /**
37
- * Singleton get method
38
- *
39
- * @since 1.0.0
40
- * @access public
41
- *
42
- * @return RP4WP
43
- */
44
- public static function get() {
45
- if ( null == self::$instance ) {
46
- self::$instance = new self();
47
- }
48
-
49
- return self::$instance;
50
- }
51
-
52
- /**
53
- * Get the plugin file
54
- *
55
- * @access public
56
- * @static
57
- * @return String
58
- */
59
- public static function get_plugin_file() {
60
- return __FILE__;
61
- }
62
-
63
- /**
64
- * A static method that will setup the autoloader
65
- */
66
- private static function setup_autoloader() {
67
- require_once( plugin_dir_path( self::get_plugin_file() ) . '/classes/class-autoloader.php' );
68
- $autoloader = new RP4WP_Autoloader( plugin_dir_path( self::get_plugin_file() ) . 'classes/' );
69
- spl_autoload_register( array( $autoloader, 'load' ) );
70
- }
71
-
72
- /**
73
- * This method runs on plugin activation
74
- */
75
- public static function activation() {
76
-
77
- // Setup autoloader
78
- self::setup_autoloader();
79
-
80
- // Run the installer
81
- $installer = new RP4WP_Installer();
82
- $installer->install();
83
-
84
- // Redirect to installation wizard
85
- add_site_option( RP4WP_Constants::OPTION_DO_INSTALL, true );
86
- }
87
-
88
- /**
89
- * The constructor
90
- */
91
- private function __construct() {
92
- $this->init();
93
  }
94
 
95
- /**
96
- * Initialize the plugin
97
- */
98
- private function init() {
99
-
100
- // Setup the autoloader
101
- self::setup_autoloader();
102
-
103
- // Load plugin text domain
104
- load_plugin_textdomain( 'related-posts-for-wp', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' );
105
-
106
- // Check if we need to run the installer
107
- if ( is_admin() && get_site_option( RP4WP_Constants::OPTION_DO_INSTALL, false ) ) {
108
 
109
- // Delete do install site option
110
- delete_site_option( RP4WP_Constants::OPTION_DO_INSTALL );
111
-
112
- // Redirect to installation wizard
113
- wp_redirect( admin_url() . '?page=rp4wp_install', 307 );
114
- exit;
115
- }
116
-
117
- if ( is_admin() ) {
118
- // Check if we need to display an 'is installing' notice
119
- $is_installing_notice = new RP4WP_Is_Installing_Notice();
120
- $is_installing_notice->check();
121
- }
122
-
123
- // Setup settings
124
- $this->settings = new RP4WP_Settings();
125
-
126
- // Filters
127
- $manager_filter = new RP4WP_Manager_Filter( plugin_dir_path( __FILE__ ) . 'classes/filters/' );
128
- $manager_filter->load_filters();
129
-
130
- // Hooks
131
- $manager_hook = new RP4WP_Manager_Hook( plugin_dir_path( __FILE__ ) . 'classes/hooks/' );
132
- $manager_hook->load_hooks();
133
-
134
- // Include template functions
135
- if ( ! is_admin() ) {
136
- require_once( plugin_dir_path( self::get_plugin_file() ) . '/includes/template-functions.php' );
137
- }
138
-
139
- // Setup the nag
140
- if ( is_admin() ) {
141
- $nag_manager = new RP4WP_Nag_Manager();
142
- $nag_manager->setup();
143
- }
144
-
145
- }
146
-
147
- }
148
-
149
- function RP4WP() {
150
- return RP4WP::get();
151
- }
152
-
153
- function __rp4wp_main() {
154
  RP4WP();
 
155
  }
156
 
157
  // Create object - Plugin init
158
- add_action( 'plugins_loaded', '__rp4wp_main' );
159
 
160
  // Activation hook
161
  register_activation_hook( __FILE__, array( 'RP4WP', 'activation' ) );
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.6.2
7
  Author: Barry Kooij
8
  Author URI: http://www.barrykooij.com/
9
  License: GPL v3
22
  along with this program. If not, see <http://www.gnu.org/licenses/>.
23
  */
24
 
 
25
 
26
+ if ( ! defined( 'ABSPATH' ) ) {
27
+ exit;
28
+ } // Exit if accessed directly
29
 
30
+ function rp4wp_load_plugin() {
31
 
32
+ if ( defined( 'RP4WP_PLUGIN_FILE' ) ) {
33
+ return false;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
34
  }
35
 
36
+ // Define
37
+ define( 'RP4WP_PLUGIN_FILE', __FILE__ );
 
 
 
 
 
 
 
 
 
 
 
38
 
39
+ // Load main plugin file
40
+ require_once plugin_dir_path( RP4WP_PLUGIN_FILE ) . 'classes/class-rp4wp.php';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
41
  RP4WP();
42
+
43
  }
44
 
45
  // Create object - Plugin init
46
+ add_action( 'plugins_loaded', 'rp4wp_load_plugin', 20 );
47
 
48
  // Activation hook
49
  register_activation_hook( __FILE__, array( 'RP4WP', 'activation' ) );