| @@ -1,8 +1,8 @@ | ||
| 1 | 1 | <?php //phpcs:ignore WordPress.Files.FileName.InvalidClassFileName |
| 2 | 2 | /** |
| 3 | 3 | * Module Name: Likes |
| 4 | - * Module Description: Give visitors an easy way to show they appreciate your content. | |
| 4 | + * Module Description: Let readers like your posts to show appreciation and encourage interaction. | |
| 5 | 5 | * First Introduced: 2.2 |
| 6 | 6 | * Sort Order: 23 |
| 7 | 7 | * Requires Connection: Yes |
| 8 | 8 | * Auto Activate: No |
| @@ -20,18 +20,39 @@ | ||
| 20 | 20 | |
| 21 | 21 | // phpcs:disable Universal.Files.SeparateFunctionsFromOO.Mixed -- TODO: Move classes to appropriately-named class files. |
| 22 | 22 | |
| 23 | 23 | use Automattic\Jetpack\Assets; |
| 24 | +use Automattic\Jetpack\Status\Host; | |
| 24 | 25 | |
| 25 | -Assets::add_resource_hint( | |
| 26 | - array( | |
| 27 | - '//widgets.wp.com', | |
| 28 | - '//s0.wp.com', | |
| 29 | - '//0.gravatar.com', | |
| 30 | - '//1.gravatar.com', | |
| 31 | - '//2.gravatar.com', | |
| 32 | - ), | |
| 33 | - 'dns-prefetch' | |
| 26 | +if ( ! defined( 'ABSPATH' ) ) { | |
| 27 | + exit( 0 ); | |
| 28 | +} | |
| 29 | + | |
| 30 | +add_filter( | |
| 31 | + 'wp_resource_hints', | |
| 32 | + function ( $hints, $relation_type ) { | |
| 33 | + if ( 'dns-prefetch' !== $relation_type ) { | |
| 34 | + return $hints; | |
| 35 | + } | |
| 36 | + | |
| 37 | + // Only hint on pages where Likes can render. | |
| 38 | + if ( ! is_singular() && ! is_home() && ! is_front_page() && ! is_archive() && ! is_search() ) { | |
| 39 | + return $hints; | |
| 40 | + } | |
| 41 | + | |
| 42 | + return array_merge( | |
| 43 | + $hints, | |
| 44 | + array( | |
| 45 | + '//widgets.wp.com', | |
| 46 | + '//s0.wp.com', | |
| 47 | + '//0.gravatar.com', | |
| 48 | + '//1.gravatar.com', | |
| 49 | + '//2.gravatar.com', | |
| 50 | + ) | |
| 51 | + ); | |
| 52 | + }, | |
| 53 | + 10, | |
| 54 | + 2 | |
| 34 | 55 | ); |
| 35 | 56 | |
| 36 | 57 | require_once __DIR__ . '/likes/jetpack-likes-master-iframe.php'; |
| 37 | 58 | require_once __DIR__ . '/likes/jetpack-likes-settings.php'; |
| @@ -39,9 +60,8 @@ | ||
| 39 | 60 | /** |
| 40 | 61 | * Jetpack Like Class |
| 41 | 62 | */ |
| 42 | 63 | class Jetpack_Likes { |
| 43 | - | |
| 44 | 64 | /** |
| 45 | 65 | * Jetpack_Likes_Settings object |
| 46 | 66 | * |
| 47 | 67 | * @var Jetpack_Likes_Settings |
| @@ -75,30 +95,18 @@ | ||
| 75 | 95 | |
| 76 | 96 | add_action( 'jetpack_activate_module_likes', array( $this, 'set_social_notifications_like' ) ); |
| 77 | 97 | add_action( 'jetpack_deactivate_module_likes', array( $this, 'delete_social_notifications_like' ) ); |
| 78 | 98 | |
| 79 | - Jetpack::enable_module_configurable( __FILE__ ); | |
| 99 | + // The `enable_module_configurable` method doesn't exist in the WP.com loader implementation. | |
| 100 | + if ( ! ( new Host() )->is_wpcom_simple() ) { | |
| 101 | + Jetpack::enable_module_configurable( __FILE__ ); | |
| 102 | + } | |
| 103 | + | |
| 80 | 104 | add_filter( 'jetpack_module_configuration_url_likes', array( $this, 'jetpack_likes_configuration_url' ) ); |
| 81 | - add_action( 'admin_print_scripts-settings_page_sharing', array( $this, 'load_jp_css' ) ); | |
| 82 | - add_filter( 'sharing_show_buttons_on_row_start', array( $this, 'configuration_target_area' ) ); | |
| 83 | 105 | |
| 84 | - $active = Jetpack::get_active_modules(); | |
| 106 | + $sharedaddy_active = Jetpack::is_module_active( 'sharedaddy' ); | |
| 85 | 107 | |
| 86 | - if ( ! in_array( 'sharedaddy', $active, true ) && ! in_array( 'publicize', $active, true ) ) { | |
| 87 | - // we don't have a sharing page yet. | |
| 88 | - add_action( 'admin_menu', array( $this->settings, 'sharing_menu' ) ); | |
| 89 | - } | |
| 90 | - | |
| 91 | - if ( in_array( 'publicize', $active, true ) && ! in_array( 'sharedaddy', $active, true ) ) { | |
| 92 | - // we have a sharing page but not the global options area. | |
| 93 | - add_action( 'pre_admin_screen_sharing', array( $this->settings, 'sharing_block' ), 20 ); | |
| 94 | - add_action( 'pre_admin_screen_sharing', array( $this->settings, 'updated_message' ), -10 ); | |
| 95 | - } | |
| 96 | - | |
| 97 | - if ( ! in_array( 'sharedaddy', $active, true ) ) { | |
| 98 | - add_action( 'admin_init', array( $this->settings, 'process_update_requests_if_sharedaddy_not_loaded' ) ); | |
| 99 | - add_action( 'sharing_global_options', array( $this->settings, 'admin_settings_showbuttonon_init' ), 19 ); | |
| 100 | - add_action( 'sharing_admin_update', array( $this->settings, 'admin_settings_showbuttonon_callback' ), 19 ); | |
| 108 | + if ( ! $sharedaddy_active ) { | |
| 101 | 109 | add_action( 'admin_init', array( $this->settings, 'add_meta_box' ) ); |
| 102 | 110 | } else { |
| 103 | 111 | add_filter( 'sharing_meta_box_title', array( $this->settings, 'add_likes_to_sharing_meta_box_title' ) ); |
| 104 | 112 | add_action( 'start_sharing_meta_box_content', array( $this->settings, 'meta_box_content' ) ); |
| @@ -105,16 +113,12 @@ | ||
| 105 | 113 | } |
| 106 | 114 | |
| 107 | 115 | add_action( 'admin_init', array( $this, 'admin_discussion_likes_settings_init' ) ); // Likes notifications. |
| 108 | 116 | |
| 109 | - add_action( 'admin_bar_menu', array( $this, 'admin_bar_likes' ), 60 ); | |
| 110 | - | |
| 111 | 117 | add_action( 'wp_enqueue_scripts', array( $this, 'load_styles_register_scripts' ) ); |
| 112 | 118 | |
| 113 | 119 | add_action( 'save_post', array( $this->settings, 'meta_box_save' ) ); |
| 114 | 120 | add_action( 'edit_attachment', array( $this->settings, 'meta_box_save' ) ); |
| 115 | - add_action( 'sharing_global_options', array( $this->settings, 'admin_settings_init' ), 20 ); | |
| 116 | - add_action( 'sharing_admin_update', array( $this->settings, 'admin_settings_callback' ), 20 ); | |
| 117 | 121 | } |
| 118 | 122 | |
| 119 | 123 | /** |
| 120 | 124 | * Set the social_notifications_like option to `on` when the Likes module is activated. |
| @@ -145,21 +149,51 @@ | ||
| 145 | 149 | } |
| 146 | 150 | |
| 147 | 151 | /** |
| 148 | 152 | * Loads Jetpack's CSS on the sharing page so we can use .jetpack-targetable |
| 153 | + * | |
| 154 | + * @deprecated 16.3 Settings > Sharing is a plain WordPress settings screen now. | |
| 155 | + * | |
| 156 | + * @return void | |
| 149 | 157 | */ |
| 150 | 158 | public function load_jp_css() { |
| 151 | - /** | |
| 152 | - * Do we really need `admin_styles`? With the new admin UI, it's breaking some bits. | |
| 153 | - * Jetpack::init()->admin_styles(); | |
| 154 | - */ | |
| 159 | + _deprecated_function( __METHOD__, 'jetpack-16.3' ); | |
| 155 | 160 | } |
| 156 | 161 | |
| 157 | 162 | /** |
| 163 | + * Adds in the jetpack-targetable class so when we visit sharing#likes our like settings get highlighted by a yellow box | |
| 164 | + * | |
| 165 | + * @deprecated 16.3 The Likes settings have a section of their own on Settings > Sharing. | |
| 166 | + * | |
| 167 | + * @param string $html row heading for the sharedaddy "which page" setting. | |
| 168 | + * @return string The unchanged $html. | |
| 169 | + */ | |
| 170 | + public function configuration_target_area( $html = '' ) { | |
| 171 | + _deprecated_function( __METHOD__, 'jetpack-16.3' ); | |
| 172 | + return $html; | |
| 173 | + } | |
| 174 | + | |
| 175 | + /** | |
| 158 | 176 | * Load scripts and styles for front end. |
| 159 | 177 | */ |
| 160 | 178 | public function load_styles_register_scripts() { |
| 161 | - wp_enqueue_style( 'jetpack_likes', plugins_url( 'likes/style.css', __FILE__ ), array(), JETPACK__VERSION ); | |
| 179 | + // Likes are only rendered on pages that display post content. | |
| 180 | + if ( ! is_singular() && ! is_home() && ! is_front_page() && ! is_archive() && ! is_search() ) { | |
| 181 | + return; | |
| 182 | + } | |
| 183 | + | |
| 184 | + $style_url = Assets::get_file_url_for_environment( | |
| 185 | + '_inc/build/likes/style.min.css', | |
| 186 | + 'modules/likes/style.css' | |
| 187 | + ); | |
| 188 | + wp_enqueue_style( 'jetpack_likes', $style_url, array(), JETPACK__VERSION ); | |
| 189 | + $style_path = plugin_dir_path( JETPACK__PLUGIN_FILE ) . ( | |
| 190 | + /** This filter is documented in projects/plugins/jetpack/load-jetpack.php */ | |
| 191 | + apply_filters( 'jetpack_should_use_minified_assets', true ) | |
| 192 | + ? '_inc/build/likes/style.min.css' | |
| 193 | + : 'modules/likes/style.css' | |
| 194 | + ); | |
| 195 | + wp_style_add_data( 'jetpack_likes', 'path', $style_path ); | |
| 162 | 196 | wp_register_script( |
| 163 | 197 | 'jetpack_likes_queuehandler', |
| 164 | 198 | Assets::get_file_url_for_environment( |
| 165 | 199 | '_inc/build/likes/queuehandler.min.js', |
| @@ -171,21 +205,10 @@ | ||
| 171 | 205 | ); |
| 172 | 206 | } |
| 173 | 207 | |
| 174 | 208 | /** |
| 175 | - * Adds in the jetpack-targetable class so when we visit sharing#likes our like settings get highlighted by a yellow box | |
| 176 | - * | |
| 177 | - * @param string $html row heading for the sharedaddy "which page" setting. | |
| 178 | - * @return string $html with the jetpack-targetable class and likes id. tbody gets closed after the like settings | |
| 209 | + * Options to be added to the discussion page. The Sharing settings live in Sharing_Likes\Settings\Likes_Section. | |
| 179 | 210 | */ |
| 180 | - public function configuration_target_area( $html = '' ) { | |
| 181 | - $html = "<tbody id='likes' class='jetpack-targetable'>" . $html; | |
| 182 | - return $html; | |
| 183 | - } | |
| 184 | - | |
| 185 | - /** | |
| 186 | - * Options to be added to the discussion page (see also admin_settings_init, etc below for Sharing settings page) | |
| 187 | - */ | |
| 188 | 211 | public function admin_discussion_likes_settings_init() { |
| 189 | 212 | // Add a temporary section, until we can move the setting out of there and with the rest of the email notification settings. |
| 190 | 213 | add_settings_section( 'likes-notifications', __( 'Likes Notifications', 'jetpack' ), array( $this, 'admin_discussion_likes_settings_section' ), 'discussion' ); |
| 191 | 214 | add_settings_field( 'social-notifications', __( 'Email me whenever', 'jetpack' ), array( $this, 'admin_discussion_likes_settings_field' ), 'discussion', 'likes-notifications' ); |
| @@ -294,16 +317,18 @@ | ||
| 294 | 317 | ?> |
| 295 | 318 | <style type="text/css"> |
| 296 | 319 | .vers img { display: none; } |
| 297 | 320 | .metabox-prefs .vers img { display: inline; } |
| 298 | - .fixed .column-likes { width: 5.5em; padding: 8px 0; text-align: left; } | |
| 299 | - .fixed .column-stats { width: 5em; } | |
| 321 | + .fixed .column-likes { width: 2.5em; padding: 4px 0; text-align: left; } | |
| 322 | + .fixed .column-stats { width: 5em; white-space: nowrap; } | |
| 300 | 323 | .fixed .column-likes .post-com-count { |
| 301 | 324 | -webkit-box-sizing: border-box; |
| 302 | 325 | -moz-box-sizing: border-box; |
| 303 | 326 | box-sizing: border-box; |
| 304 | 327 | display: inline-block; |
| 305 | - padding: 0 8px; | |
| 328 | + padding: 0 4px; | |
| 329 | + min-width: 2em; | |
| 330 | + text-align: center; | |
| 306 | 331 | height: 2em; |
| 307 | 332 | margin-top: 5px; |
| 308 | 333 | -webkit-border-radius: 5px; |
| 309 | 334 | border-radius: 5px; |
| @@ -313,9 +338,9 @@ | ||
| 313 | 338 | line-height: 21px; |
| 314 | 339 | } |
| 315 | 340 | .fixed .column-likes .post-com-count::after { border: none !important; } |
| 316 | 341 | .fixed .column-likes .post-com-count:hover { background-color: #2271b1; } |
| 317 | - .fixed .column-likes .vers:before { | |
| 342 | + .fixed .column-likes .vers::before { | |
| 318 | 343 | font: normal 20px/1 dashicons; |
| 319 | 344 | content: '\f155'; |
| 320 | 345 | speak: none; |
| 321 | 346 | -webkit-font-smoothing: antialiased; |
| @@ -342,9 +367,9 @@ | ||
| 342 | 367 | 'modules/likes/post-count.js' |
| 343 | 368 | ), |
| 344 | 369 | array( 'jquery' ), |
| 345 | 370 | JETPACK__VERSION, |
| 346 | - $in_footer = false | |
| 371 | + false | |
| 347 | 372 | ); |
| 348 | 373 | wp_enqueue_script( |
| 349 | 374 | 'likes-post-count-jetpack', |
| 350 | 375 | Assets::get_file_url_for_environment( |
| @@ -352,9 +377,9 @@ | ||
| 352 | 377 | 'modules/likes/post-count-jetpack.js' |
| 353 | 378 | ), |
| 354 | 379 | array( 'jquery', 'likes-post-count' ), |
| 355 | 380 | JETPACK__VERSION, |
| 356 | - $in_footer = false | |
| 381 | + false | |
| 357 | 382 | ); |
| 358 | 383 | } |
| 359 | 384 | } |
| 360 | 385 | |
| @@ -405,8 +430,16 @@ | ||
| 405 | 430 | if ( ! is_numeric( $post_id ) || ! $this->settings->is_likes_visible() ) { |
| 406 | 431 | return $content; |
| 407 | 432 | } |
| 408 | 433 | |
| 434 | + // Do not output Likes on requests for ActivityPub requests. | |
| 435 | + if ( | |
| 436 | + function_exists( '\Activitypub\is_activitypub_request' ) | |
| 437 | + && \Activitypub\is_activitypub_request() | |
| 438 | + ) { | |
| 439 | + return $content; | |
| 440 | + } | |
| 441 | + | |
| 409 | 442 | // Ensure we don't display like button on post excerpts that are hooked inside the post content |
| 410 | 443 | if ( in_array( 'the_excerpt', (array) $wp_current_filter, true ) && |
| 411 | 444 | in_array( 'the_content', (array) $wp_current_filter, true ) ) { |
| 412 | 445 | return $content; |
| @@ -416,18 +449,19 @@ | ||
| 416 | 449 | $url = home_url(); |
| 417 | 450 | $url_parts = wp_parse_url( $url ); |
| 418 | 451 | $domain = $url_parts['host']; |
| 419 | 452 | |
| 420 | - // Make sure to include the scripts before the iframe otherwise weird things happen. | |
| 421 | - add_action( 'wp_footer', 'jetpack_likes_master_iframe', 21 ); | |
| 453 | + // Make sure to include the `queuehandler` scripts before the iframe otherwise the script won't find the iframe. | |
| 454 | + if ( ! has_action( 'wp_footer', 'jetpack_likes_master_iframe' ) ) { | |
| 455 | + add_action( 'wp_footer', 'jetpack_likes_master_iframe', 21 ); | |
| 456 | + } | |
| 422 | 457 | |
| 423 | 458 | /** |
| 424 | 459 | * If the same post appears more then once on a page the page goes crazy |
| 425 | 460 | * we need a slightly more unique id / name for the widget wrapper. |
| 426 | 461 | */ |
| 427 | - $uniqid = uniqid(); | |
| 428 | - | |
| 429 | - $src = sprintf( 'https://widgets.wp.com/likes/#blog_id=%1$d&post_id=%2$d&origin=%3$s&obj_id=%1$d-%2$d-%4$s', $blog_id, $post_id, $domain, $uniqid ); | |
| 462 | + $uniqid = uniqid(); | |
| 463 | + $src = sprintf( 'https://widgets.wp.com/likes/?ver=%1$s#blog_id=%2$d&post_id=%3$d&origin=%4$s&obj_id=%2$d-%3$d-%5$s', rawurlencode( JETPACK__VERSION ), $blog_id, $post_id, $domain, $uniqid ); | |
| 430 | 464 | $name = sprintf( 'like-post-frame-%1$d-%2$d-%3$s', $blog_id, $post_id, $uniqid ); |
| 431 | 465 | $wrapper = sprintf( 'like-post-wrapper-%1$d-%2$d-%3$s', $blog_id, $post_id, $uniqid ); |
| 432 | 466 | $headline = sprintf( |
| 433 | 467 | /** This filter is already documented in modules/sharedaddy/sharing-service.php */ |
| @@ -436,11 +470,15 @@ | ||
| 436 | 470 | ); |
| 437 | 471 | |
| 438 | 472 | $title = esc_html__( 'Like or Reblog', 'jetpack' ); |
| 439 | 473 | |
| 474 | + /** This filter is documented in modules/likes/jetpack-likes-master-iframe.php */ | |
| 475 | + $src = apply_filters( 'jetpack_likes_iframe_src', $src ); | |
| 476 | + | |
| 440 | 477 | $html = "<div class='sharedaddy sd-block sd-like jetpack-likes-widget-wrapper jetpack-likes-widget-unloaded' id='$wrapper' data-src='$src' data-name='$name' data-title='$title'>"; |
| 441 | 478 | $html .= $headline; |
| 442 | - $html .= "<div class='likes-widget-placeholder post-likes-widget-placeholder' style='height: 55px;'><span class='button'><span>" . esc_html__( 'Like', 'jetpack' ) . '</span></span> <span class="loading">' . esc_html__( 'Loading...', 'jetpack' ) . '</span></div>'; | |
| 479 | + require_once JETPACK__PLUGIN_DIR . '_inc/lib/class-jetpack-spinner.php'; | |
| 480 | + $html .= "<div class='likes-widget-placeholder post-likes-widget-placeholder' style='height: 55px;'><span class='button'><span>" . esc_html__( 'Like', 'jetpack' ) . '</span></span> <span class="loading">' . Jetpack_Spinner::render( 18 ) . '<span class="screen-reader-text">' . esc_html__( 'Loading…', 'jetpack' ) . '</span></span></div>'; | |
| 443 | 481 | $html .= "<span class='sd-text-color'></span><a class='sd-link-color'></a>"; |
| 444 | 482 | $html .= '</div>'; |
| 445 | 483 | |
| 446 | 484 | // Let's make sure that the script is enqueued. |
| @@ -447,76 +485,8 @@ | ||
| 447 | 485 | wp_enqueue_script( 'jetpack_likes_queuehandler' ); |
| 448 | 486 | |
| 449 | 487 | return $content . $html; |
| 450 | 488 | } |
| 451 | - | |
| 452 | - /** Checks if admin bar is visible.*/ | |
| 453 | - public function is_admin_bar_button_visible() { | |
| 454 | - global $wp_admin_bar; | |
| 455 | - | |
| 456 | - if ( ! is_object( $wp_admin_bar ) ) { | |
| 457 | - return false; | |
| 458 | - } | |
| 459 | - | |
| 460 | - if ( ( ! is_singular( 'post' ) && ! is_attachment() && ! is_page() ) ) { | |
| 461 | - return false; | |
| 462 | - } | |
| 463 | - | |
| 464 | - if ( ! $this->settings->is_likes_visible() ) { | |
| 465 | - return false; | |
| 466 | - } | |
| 467 | - | |
| 468 | - if ( ! $this->settings->is_post_likeable() ) { | |
| 469 | - return false; | |
| 470 | - } | |
| 471 | - | |
| 472 | - /** | |
| 473 | - * Filters whether the Like button is enabled in the admin bar. | |
| 474 | - * | |
| 475 | - * @module likes | |
| 476 | - * | |
| 477 | - * @since 2.2.0 | |
| 478 | - * | |
| 479 | - * @param bool true Should the Like button be visible in the Admin bar. Default to true. | |
| 480 | - */ | |
| 481 | - return (bool) apply_filters( 'jetpack_admin_bar_likes_enabled', true ); | |
| 482 | - } | |
| 483 | - | |
| 484 | - /** Adds like section in admin bar. */ | |
| 485 | - public function admin_bar_likes() { | |
| 486 | - global $wp_admin_bar; | |
| 487 | - | |
| 488 | - $post_id = get_the_ID(); | |
| 489 | - | |
| 490 | - if ( ! is_numeric( $post_id ) || ! $this->is_admin_bar_button_visible() ) { | |
| 491 | - return; | |
| 492 | - } | |
| 493 | - | |
| 494 | - $protocol = 'http'; | |
| 495 | - if ( is_ssl() ) { | |
| 496 | - $protocol = 'https'; | |
| 497 | - } | |
| 498 | - $blog_id = Jetpack_Options::get_option( 'id' ); | |
| 499 | - $url = home_url(); | |
| 500 | - $url_parts = wp_parse_url( $url ); | |
| 501 | - $domain = $url_parts['host']; | |
| 502 | - | |
| 503 | - // Make sure to include the scripts before the iframe otherwise weird things happen. | |
| 504 | - add_action( 'wp_footer', 'jetpack_likes_master_iframe', 21 ); | |
| 505 | - | |
| 506 | - $src = sprintf( 'https://widgets.wp.com/likes/#blog_id=%2$d&post_id=%3$d&origin=%1$s://%4$s', $protocol, $blog_id, $post_id, $domain ); | |
| 507 | - | |
| 508 | - $html = "<iframe class='admin-bar-likes-widget jetpack-likes-widget' scrolling='no' frameBorder='0' name='admin-bar-likes-widget' src='$src'></iframe>"; | |
| 509 | - | |
| 510 | - $node = array( | |
| 511 | - 'id' => 'admin-bar-likes-widget', | |
| 512 | - 'meta' => array( | |
| 513 | - 'html' => $html, | |
| 514 | - ), | |
| 515 | - ); | |
| 516 | - | |
| 517 | - $wp_admin_bar->add_node( $node ); | |
| 518 | - } | |
| 519 | 489 | } |
| 520 | 490 | |
| 521 | 491 | /** |
| 522 | 492 | * Callback to get the value for the jetpack_likes_enabled field. |
| @@ -526,10 +496,16 @@ | ||
| 526 | 496 | * When it is set to 0, we disable likes on the post, regardless of the global setting. |
| 527 | 497 | * When it is set to 1, we enable likes on the post, regardless of the global setting. |
| 528 | 498 | * |
| 529 | 499 | * @param array $post - post data we're checking. |
| 500 | + * | |
| 501 | + * @return bool | |
| 530 | 502 | */ |
| 531 | 503 | function jetpack_post_likes_get_value( array $post ) { |
| 504 | + if ( ! isset( $post['id'] ) ) { | |
| 505 | + return false; | |
| 506 | + } | |
| 507 | + | |
| 532 | 508 | $post_likes_switched = get_post_meta( $post['id'], 'switch_like_status', true ); |
| 533 | 509 | |
| 534 | 510 | /** This filter is documented in modules/jetpack-likes-settings.php */ |
| 535 | 511 | $sitewide_likes_enabled = (bool) apply_filters( 'wpl_is_enabled_sitewide', ! get_option( 'disabled_likes' ) ); |
| @@ -608,15 +584,6 @@ | ||
| 608 | 584 | |
| 609 | 585 | // Some CPTs (e.g. Jetpack portfolios and testimonials) get registered with |
| 610 | 586 | // restapi_theme_init because they depend on theme support, so let's also hook to that. |
| 611 | 587 | add_action( 'restapi_theme_init', 'jetpack_post_likes_register_rest_field', 20 ); |
| 612 | - | |
| 613 | -/** | |
| 614 | - * Set the Likes and Sharing Gutenberg extension availability. | |
| 615 | - */ | |
| 616 | -function jetpack_post_likes_set_extension_availability() { | |
| 617 | - Jetpack_Gutenberg::set_extension_available( 'likes' ); | |
| 618 | -} | |
| 619 | - | |
| 620 | -add_action( 'jetpack_register_gutenberg_extensions', 'jetpack_post_likes_set_extension_availability' ); | |
| 621 | 588 | |
| 622 | 589 | Jetpack_Likes::init(); |