PluginProbe
Jetpack – WP Security, Backup, Speed, & Growth / 16.3-beta
Jetpack – WP Security, Backup, Speed, & Growth v16.3-beta
16.3-beta 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 All 507 releases
← All changes | modules/comment-likes.php +11 -24 16.2 → 16.3-beta View file →
@@ -13,8 +13,9 @@
13 13 * @package automattic/jetpack
14 14 */
15 15
16 16 use Automattic\Jetpack\Assets;
17 +use Automattic\Jetpack\Sharing_Likes\Post_Likes_Switch;
17 18
18 19 if ( ! defined( 'ABSPATH' ) ) {
19 20 exit( 0 );
20 21 }
@@ -79,39 +80,22 @@
79 80
80 81 add_action( 'template_redirect', array( $this, 'frontend_init' ) );
81 82 add_action( 'admin_init', array( $this, 'admin_init' ) );
82 83
84 + /*
85 + * Comment likes are gated on the Likes settings, so when the Likes module is
86 + * off this module still needs the per-post metabox that carries them.
87 + */
83 88 if ( ! Jetpack::is_module_active( 'likes' ) ) {
84 - $active = Jetpack::get_active_modules();
85 - $sharedaddy_active = in_array( 'sharedaddy', $active, true );
86 -
87 - if ( $this->settings->needs_own_sharing_menu( $sharedaddy_active ) ) {
88 - /*
89 - * Sharedaddy is what registers Settings > Sharing, and it is off, so we
90 - * register that screen ourselves; the Likes settings that gate comment
91 - * likes are displayed on it.
92 - */
93 - add_action( 'admin_menu', array( $this->settings, 'sharing_menu' ) );
94 - } elseif ( in_array( 'publicize', $active, true ) && ! $sharedaddy_active ) {
95 - // we have a sharing page but not the global options area.
96 - add_action( 'pre_admin_screen_sharing', array( $this->settings, 'sharing_block' ), 20 );
97 - add_action( 'pre_admin_screen_sharing', array( $this->settings, 'updated_message' ), -10 );
98 - }
99 -
100 - if ( ! $sharedaddy_active ) {
101 - add_action( 'admin_init', array( $this->settings, 'process_update_requests_if_sharedaddy_not_loaded' ) );
102 - add_action( 'sharing_global_options', array( $this->settings, 'admin_settings_showbuttonon_init' ), 19 );
103 - add_action( 'sharing_admin_update', array( $this->settings, 'admin_settings_showbuttonon_callback' ), 19 );
104 - add_action( 'admin_init', array( $this->settings, 'add_meta_box' ) );
105 - } else {
89 + if ( Jetpack::is_module_active( 'sharedaddy' ) ) {
106 90 add_filter( 'sharing_meta_box_title', array( $this->settings, 'add_likes_to_sharing_meta_box_title' ) );
107 91 add_action( 'start_sharing_meta_box_content', array( $this->settings, 'meta_box_content' ) );
92 + } else {
93 + add_action( 'admin_init', array( $this->settings, 'add_meta_box' ) );
108 94 }
109 95
110 96 add_action( 'save_post', array( $this->settings, 'meta_box_save' ) );
111 97 add_action( 'edit_attachment', array( $this->settings, 'meta_box_save' ) );
112 - add_action( 'sharing_global_options', array( $this->settings, 'admin_settings_init' ), 20 );
113 - add_action( 'sharing_admin_update', array( $this->settings, 'admin_settings_callback' ), 20 );
114 98 }
115 99 }
116 100
117 101 /**
@@ -262,6 +246,9 @@
262 246
263 247 return $content . $like_button;
264 248 }
265 249 }
250 +
251 +// Comment likes follow the per-post Likes switch, so the block editor needs it without the Likes module.
252 +Post_Likes_Switch::init();
266 253
267 254 Jetpack_Comment_Likes::init();