Skip to content

Commit 761d15a

Browse files
committed
Update version to 4.0.0 and bump WordPress compatibility to 6.8
1 parent 6290524 commit 761d15a

File tree

5 files changed

+20
-37
lines changed

5 files changed

+20
-37
lines changed

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Contextual Related Posts
1+
# Contextual Related Posts
22

33
[![WordPress Plugin Version](https://github.com/WebberZone/contextual-related-posts/blob/master/wporg-assets/banner-1544x500.png)](https://wordpress.org/plugins/contextual-related-posts/)
44

@@ -10,7 +10,7 @@
1010

1111
__Requires:__ 6.3
1212

13-
__Tested up to:__ 6.7
13+
__Tested up to:__ 6.8
1414

1515
__Requires PHP:__ 7.4
1616

contextual-related-posts.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* Plugin Name: Contextual Related Posts
1616
* Plugin URI: https://webberzone.com/plugins/contextual-related-posts/
1717
* Description: Display related posts on your website or in your feed. Increase reader retention and reduce bounce rates.
18-
* Version: 4.0.0-RC1
18+
* Version: 4.0.0
1919
* Author: WebberZone
2020
* Author URI: https://webberzone.com
2121
* License: GPL-2.0+
@@ -36,7 +36,7 @@
3636
* @since 2.9.3
3737
*/
3838
if ( ! defined( 'CRP_VERSION' ) ) {
39-
define( 'CRP_VERSION', '4.0.0-beta1' );
39+
define( 'CRP_VERSION', '4.0.0' );
4040
}
4141

4242

includes/class-main.php

+13-26
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,9 @@
99

1010
use WebberZone\Contextual_Related_Posts\Admin\Activator;
1111
use WebberZone\Contextual_Related_Posts\Frontend\Display;
12-
1312
if ( ! defined( 'WPINC' ) ) {
1413
exit;
1514
}
16-
1715
/**
1816
* Main plugin class.
1917
*
@@ -72,15 +70,6 @@ final class Main {
7270
*/
7371
public Frontend\Language_Handler $language;
7472

75-
/**
76-
* Pro modules.
77-
*
78-
* @since 3.5.0
79-
*
80-
* @var Pro\Pro|null
81-
*/
82-
public ?Pro\Pro $pro = null;
83-
8473
/**
8574
* Gets the instance of the class.
8675
*
@@ -93,7 +82,6 @@ public static function get_instance(): self {
9382
self::$instance = new self();
9483
self::$instance->init();
9584
}
96-
9785
return self::$instance;
9886
}
9987

@@ -116,9 +104,7 @@ private function init(): void {
116104
$this->styles = new Frontend\Styles_Handler();
117105
$this->shortcodes = new Frontend\Shortcodes();
118106
$this->blocks = new Frontend\Blocks\Blocks();
119-
120107
$this->hooks();
121-
122108
if ( is_admin() ) {
123109
$this->admin = new Admin\Admin();
124110
if ( is_multisite() ) {
@@ -140,8 +126,12 @@ public function hooks(): void {
140126
add_filter( 'the_excerpt_rss', array( $this, 'content_filter' ), \crp_get_option( 'content_filter_priority', 10 ) );
141127
add_filter( 'the_content_feed', array( $this, 'content_filter' ), \crp_get_option( 'content_filter_priority', 10 ) );
142128
add_action( 'parse_query', array( $this, 'parse_query' ) );
143-
144-
add_action( 'activated_plugin', array( $this, 'activated_plugin' ), 10, 2 );
129+
add_action(
130+
'activated_plugin',
131+
array( $this, 'activated_plugin' ),
132+
10,
133+
2
134+
);
145135
add_action( 'pre_current_active_plugins', array( $this, 'plugin_deactivated_notice' ) );
146136
}
147137

@@ -160,8 +150,9 @@ public function initiate_plugin(): void {
160150
* @since 3.5.0
161151
*/
162152
public function register_widgets(): void {
163-
register_widget( '\WebberZone\Contextual_Related_Posts\Frontend\Widgets\Related_Posts_Widget' );
153+
register_widget( '\\WebberZone\\Contextual_Related_Posts\\Frontend\\Widgets\\Related_Posts_Widget' );
164154
}
155+
165156
/**
166157
* Function to register our new routes from the controller.
167158
*
@@ -210,25 +201,20 @@ public function activated_plugin( string $plugin, bool $network_wide ): void {
210201
if ( ! in_array( $plugin, array( 'contextual-related-posts/contextual-related-posts.php', 'contextual-related-posts-pro/contextual-related-posts.php' ), true ) ) {
211202
return;
212203
}
213-
214204
Activator::activation_hook( $network_wide );
215-
216205
$plugin_to_deactivate = 'contextual-related-posts/contextual-related-posts.php';
217206
$deactivated_notice_id = '1';
218-
219207
// If we just activated the free version, deactivate the pro version.
220208
if ( $plugin === $plugin_to_deactivate ) {
221209
$plugin_to_deactivate = 'contextual-related-posts-pro/contextual-related-posts.php';
222210
$deactivated_notice_id = '2';
223211
}
224-
225212
if ( is_multisite() && is_network_admin() ) {
226213
$active_plugins = (array) get_site_option( 'active_sitewide_plugins', array() );
227214
$active_plugins = array_keys( $active_plugins );
228215
} else {
229216
$active_plugins = (array) get_option( 'active_plugins', array() );
230217
}
231-
232218
foreach ( $active_plugins as $plugin_basename ) {
233219
if ( $plugin_to_deactivate === $plugin_basename ) {
234220
set_transient( 'crp_deactivated_notice_id', $deactivated_notice_id, 1 * HOUR_IN_SECONDS );
@@ -248,18 +234,19 @@ public function plugin_deactivated_notice(): void {
248234
if ( ! in_array( $deactivated_notice_id, array( 1, 2 ), true ) ) {
249235
return;
250236
}
251-
252237
$message = __( "Contextual Related Posts and Contextual Related Posts PRO should not be active at the same time. We've automatically deactivated Contextual Related Posts.", 'contextual-related-posts' );
253238
if ( 2 === $deactivated_notice_id ) {
254239
$message = __( "Contextual Related Posts and Contextual Related Posts PRO should not be active at the same time. We've automatically deactivated Contextual Related Posts PRO.", 'contextual-related-posts' );
255240
}
256-
257241
?>
258242
<div class="updated" style="border-left: 4px solid #ffba00;">
259-
<p><?php echo esc_html( $message ); ?></p>
243+
<p>
244+
<?php
245+
echo esc_html( $message );
246+
?>
247+
</p>
260248
</div>
261249
<?php
262-
263250
delete_transient( 'crp_deactivated_notice_id' );
264251
}
265252
}

includes/load-freemius.php

+2-6
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ function crp_freemius() {
2020
if ( ! defined( 'WP_FS__PRODUCT_15040_MULTISITE' ) ) {
2121
define( 'WP_FS__PRODUCT_15040_MULTISITE', true );
2222
}
23-
2423
// Include Freemius SDK.
2524
require_once dirname( __DIR__ ) . '/vendor/freemius/start.php';
2625
$crp_freemius = \fs_dynamic_init(
@@ -30,7 +29,7 @@ function crp_freemius() {
3029
'premium_slug' => 'contextual-related-posts-pro',
3130
'type' => 'plugin',
3231
'public_key' => 'pk_4aec305b9c97637276da2e55b723f',
33-
'is_premium' => true,
32+
'is_premium' => false,
3433
'premium_suffix' => 'Pro',
3534
'has_addons' => false,
3635
'has_paid_plans' => true,
@@ -40,7 +39,7 @@ function crp_freemius() {
4039
'support' => false,
4140
'network' => true,
4241
'parent' => array(
43-
'slug' => is_multisite() ? 'crp_options_page' : 'options-general.php',
42+
'slug' => ( is_multisite() ? 'crp_options_page' : 'options-general.php' ),
4443
),
4544
),
4645
'is_live' => true,
@@ -66,9 +65,6 @@ function crp_freemius_get_plugin_icon() {
6665
*/
6766
function crp_freemius_uninstall() {
6867
require_once dirname( __DIR__ ) . '/uninstaller.php';
69-
if ( crp_freemius()->can_use_premium_code__premium_only() ) {
70-
\WebberZone\Contextual_Related_Posts\Pro\Pro::uninstall_pro();
71-
}
7268
}
7369

7470
// Init Freemius.

readme.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Contributors: webberzone, ajay
44
Donate link: https://wzn.io/donate-crp
55
Stable tag: 4.0.0
66
Requires at least: 6.3
7-
Tested up to: 6.7
7+
Tested up to: 6.8
88
Requires PHP: 7.4
99
License: GPLv2 or later
1010

0 commit comments

Comments
 (0)