PluginProbe
Jetpack – WP Security, Backup, Speed, & Growth / 16.3-a.7
Jetpack – WP Security, Backup, Speed, & Growth v16.3-a.7
16.3-a.5 16.3-a.7 16.3-a.3 16.3-a.1 16.2 16.2-beta 12.0.3 12.1.3 12.2.3 12.3.2 12.4.2 12.5.2 12.6.4 12.7.3 12.8.3 12.9.5 13.0.2 13.1.5 13.2.4 13.3.3 13.4.5 13.5.2 13.6.2 13.7.2 13.8.3 All 506 releases
← All changes | extensions/plugins/likes/likes.php +16 -1 13.8.3 → 16.3-a.7 View file →
@@ -7,12 +7,17 @@
7 7
8 8 namespace Automattic\Jetpack\Extensions\Likes;
9 9
10 10 use Automattic\Jetpack\Connection\Manager as Connection_Manager;
11 +use Automattic\Jetpack\Modules;
11 12 use Automattic\Jetpack\Status;
12 13 use Automattic\Jetpack\Status\Host;
13 14 use Jetpack_Gutenberg;
14 15
16 +if ( ! defined( 'ABSPATH' ) ) {
17 + exit( 0 );
18 +}
19 +
15 20 /**
16 21 * Register Likes plugin.
17 22 *
18 23 * @return void
@@ -17,8 +22,18 @@
17 22 *
18 23 * @return void
19 24 */
20 25 function register_plugins() {
26 + /*
27 + * The extension is available even when the module is not active,
28 + * so we can display a nudge to activate the module instead of the block.
29 + * We skip that nudge for non-admins, who cannot activate modules, and on block themes,
30 + * where the answer is the Like block in a template rather than the legacy module.
31 + */
32 + if ( ! ( new Modules() )->is_active( 'likes' ) && ( ! current_user_can( 'jetpack_activate_modules' ) || wp_is_block_theme() ) ) {
33 + return;
34 + }
35 +
21 36 // Register Likes.
22 37 if (
23 38 ( new Host() )->is_wpcom_simple()
24 39 || ( ( new Connection_Manager( 'jetpack' ) )->has_connected_owner() && ! ( new Status() )->is_offline_mode() )
@@ -34,9 +49,9 @@
34 49 */
35 50 add_action(
36 51 'rest_api_init',
37 52 function () {
38 - if ( ! \Jetpack::is_module_active( 'likes' ) ) {
53 + if ( ! ( new Modules() )->is_active( 'likes' ) ) {
39 54 $post_types = get_post_types( array( 'public' => true ) );
40 55 foreach ( $post_types as $post_type ) {
41 56 add_post_type_support( $post_type, 'jetpack-post-likes' );
42 57 }