Skip to content

Commit

Permalink
Enhanced Distribution: begin deprecation (#36168)
Browse files Browse the repository at this point in the history
* Enhanced Distribution: begin deprecation

* Remove from module list

* Move Reader hooks to 3rd-party

* Update version

* Remove mention in My Jetpack

* Update projects/plugins/jetpack/modules/enhanced-distribution.php

Co-authored-by: Jeremy Herve <[email protected]>

* Remove additional reference to a JP Dash test

* Remove from array of modules that lack UI

* Update RSS feed addition hooks

* Ver bumps

* Ensure Reader utilities load on most recent RSS feeds

See #36168 (comment)

* Simplify output of each function

* Remove redundant casting

---------

Co-authored-by: Jeremy Herve <[email protected]>
  • Loading branch information
kraftbj and jeherve authored Mar 22, 2024
1 parent cccb93c commit 11b2a22
Show file tree
Hide file tree
Showing 14 changed files with 89 additions and 120 deletions.
4 changes: 4 additions & 0 deletions projects/packages/my-jetpack/changelog/remove-enhdist
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: removed

Removed reference to Creator Network, which is being deprecated.
14 changes: 0 additions & 14 deletions projects/packages/my-jetpack/src/products/class-creator.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,20 +156,6 @@ public static function get_features_by_tier() {
),
),
),
array(
'name' => __( 'Creator network', 'jetpack-my-jetpack' ),
'info' => array(
'content' => __(
'<p>The creator network is the network of websites either hosted with WordPress.com or self-hosted and connected with Jetpack.</p>
<p>Sites that are part of the creator network can gain exposure to new readers. Sites on the Creator plan have enhanced distribution to more areas of the Reader.</p>',
'jetpack-my-jetpack'
),
),
'tiers' => array(
self::FREE_TIER_SLUG => array( 'included' => true ),
self::UPGRADED_TIER_SLUG => array( 'included' => true ),
),
),
array(
'name' => __( 'Jetpack Blocks', 'jetpack-my-jetpack' ),
'info' => array(
Expand Down
3 changes: 3 additions & 0 deletions projects/plugins/jetpack/3rd-party/3rd-party.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,9 @@ function load_3rd_party_compat_filters() {
require_once JETPACK__PLUGIN_DIR . '/3rd-party/atomic.php';
}

// WordPress.com Reader
require_once JETPACK__PLUGIN_DIR . '/3rd-party/wpcom-reader.php';

// WPML
if ( defined( 'ICL_SITEPRESS_VERSION' ) ) {
require_once JETPACK__PLUGIN_DIR . '/3rd-party/wpml.php';
Expand Down
66 changes: 66 additions & 0 deletions projects/plugins/jetpack/3rd-party/wpcom-reader.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
<?php
/**
* This provides minor tweaks to improve the experience for Jetpack feed in the WordPress.com Reader.
*
* This does not make sites available in the Reader—that depends on the public access to /feed/ as a method on the WP.com side
* to check if a site is public. It also does not add any content to the feed. Any content that should not be displayed in the Reader
* or other RSS readers should be filtered out elsewhere.
*
* These hooks were originally part of the now-deprecated Enhanced Distribution.
*
* @since $$next-version$$
* @package Automattic/jetpack
*/

use Automattic\Jetpack\Connection\Manager as Connection_Manager;
use Automattic\Jetpack\Status;
use Automattic\Jetpack\Status\Host;

foreach ( array( 'rss_head', 'rss1_head', 'rss2_head' ) as $rss_head_action ) {
add_action( $rss_head_action, 'jetpack_wpcomreader_feed_id' );
}
foreach ( array( 'rss_item', 'rss1_item', 'rss2_item' ) as $rss_item_action ) {
add_action( $rss_item_action, 'jetpack_wpcomreader_post_id' );
}

/**
* Output feed identifier based on blog ID.
*
* @return void
*/
function jetpack_wpcomreader_feed_id() {
if (
( new Host() )->is_wpcom_simple()
|| (
( new Connection_Manager() )->is_connected()
&& ! ( new Status() )->is_offline_mode()
)
) {
$blog_id = Connection_Manager::get_site_id( true ); // Silence since we're not wanting to handle the error state.
if ( ! $blog_id ) {
return;
}

printf(
'<site xmlns="com-wordpress:feed-additions:1">%d</site>',
(int) $blog_id
);
}
}

/**
* Output feed item identifier based on current post ID.
*
* @return void
*/
function jetpack_wpcomreader_post_id() {
$id = get_the_ID();
if ( ! $id ) {
return;
}

printf(
'<post-id xmlns="com-wordpress:feed-additions:1">%d</post-id>',
(int) $id
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ describe( 'SettingsCard', () => {
'notes',
'subscriptions',
'protect',
'enhanced-distribution',
'comments',
'json-api',
'photon',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ describe( 'SettingsGroup', () => {
'notes',
'subscriptions',
'protect',
'enhanced-distribution',
'comments',
'json-api',
'photon',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export const SearchableModules = withModuleSettingsFormHelpers(
}

// Only should be features that don't already have a UI, and we want to reveal in search.
const safelist = [ 'contact-form', 'enhanced-distribution', 'json-api', 'notes' ];
const safelist = [ 'contact-form', 'json-api', 'notes' ];

const allModules = this.props.modules,
results = [];
Expand Down
4 changes: 4 additions & 0 deletions projects/plugins/jetpack/changelog/remove-enhdist
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: minor
Type: bugfix

Enhanced Distribution: begin deprecation process as the Firehose is winding down
11 changes: 6 additions & 5 deletions projects/plugins/jetpack/class.jetpack.php
Original file line number Diff line number Diff line change
Expand Up @@ -2289,11 +2289,12 @@ public static function get_default_modules( $min_version = false, $max_version =
*/
public function handle_deprecated_modules( $modules ) {
$deprecated_modules = array(
'debug' => null, // Closed out and moved to the debugger library.
'wpcc' => 'sso', // Closed out in 2.6 -- SSO provides the same functionality.
'gplus-authorship' => null, // Closed out in 3.2 -- Google dropped support.
'minileven' => null, // Closed out in 8.3 -- Responsive themes are common now, and so is AMP.
'lazy-images' => null, // Closed out in 12.8 -- WordPress core now has native lazy loading.
'debug' => null, // Closed out and moved to the debugger library.
'wpcc' => 'sso', // Closed out in 2.6 -- SSO provides the same functionality.
'gplus-authorship' => null, // Closed out in 3.2 -- Google dropped support.
'minileven' => null, // Closed out in 8.3 -- Responsive themes are common now, and so is AMP.
'lazy-images' => null, // Closed out in 12.8 -- WordPress core now has native lazy loading.
'enhanced-distribution' => null, // Closed out in 13.3 -- WP.com is winding down the firehose.
);

// Don't activate SSO if they never completed activating WPCC.
Expand Down
80 changes: 5 additions & 75 deletions projects/plugins/jetpack/modules/enhanced-distribution.php
Original file line number Diff line number Diff line change
@@ -1,81 +1,11 @@
<?php
/**
* Module Name: Enhanced Distribution
* Module Description: Increase reach and traffic.
* Sort Order: 5
* First Introduced: 1.2
* Requires Connection: Yes
* Auto Activate: Public
* Module Tags: Writing
* Feature: Engagement
* Additional Search Queries: google, seo, firehose, search, broadcast, broadcasting, creator
* Module formerly known as Enhanced Distribution.
*
* @deprecated 13.2.0
*
* @package automattic/jetpack
*/

/**
* In case it's active prior to upgrading to '1.9'.
*/
function jetpack_enhanced_distribution_before_activate_default_modules() {
$old_version = Jetpack_Options::get_option( 'old_version' );
list( $old_version ) = explode( ':', $old_version );

if ( version_compare( $old_version, '1.9-something', '>=' ) ) {
return;
}

Jetpack::check_privacy( __FILE__ );
}

add_action( 'jetpack_before_activate_default_modules', 'jetpack_enhanced_distribution_before_activate_default_modules' );

if ( isset( $_GET['get_freshly_pressed_data'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
/**
* If a request has ?get_freshly_pressed_data=true appended
* to the end, then let's provide the necessary data back via JSON.
*/
function jetpack_get_freshly_pressed_data() {
if ( is_single() ) {
wp_send_json_success(
array(
'blog_id' => Jetpack_Options::get_option( 'id' ),
'post_id' => get_the_ID(),
)
);
} else {
wp_send_json_error(
array(
'message' => 'Not Singular',
)
);
}
}
add_action( 'template_redirect', 'jetpack_get_freshly_pressed_data' );
}

add_action( 'rss_head', 'jetpack_enhanced_distribution_feed_id' );
add_action( 'rss_item', 'jetpack_enhanced_distribution_post_id' );
add_action( 'rss2_head', 'jetpack_enhanced_distribution_feed_id' );
add_action( 'rss2_item', 'jetpack_enhanced_distribution_post_id' );

/**
* Output feed identifier based on blog ID.
*/
function jetpack_enhanced_distribution_feed_id() {
$id = (int) Jetpack_Options::get_option( 'id' );
if ( $id > 0 ) {
$output = sprintf( '<site xmlns="com-wordpress:feed-additions:1">%d</site>', $id );
echo $output; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
}

/**
* Output feed item identifier based on current post ID.
*/
function jetpack_enhanced_distribution_post_id() {
$id = (int) get_the_ID();
if ( $id ) {
$output = sprintf( '<post-id xmlns="com-wordpress:feed-additions:1">%d</post-id>', $id );
echo $output; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
}
}
_deprecated_file( basename( __FILE__ ), 'jetpack-$$next-version$$' );
// Silence is golden. Left here to ensure no fatals on some seemingly misconfigured opcache setups.
20 changes: 0 additions & 20 deletions projects/plugins/jetpack/modules/module-info.php
Original file line number Diff line number Diff line change
Expand Up @@ -240,26 +240,6 @@ function jetpack_subscriptions_more_info() {
}
add_action( 'jetpack_module_more_info_subscriptions', 'jetpack_subscriptions_more_info' );

/**
* Enhanced Distribution support link.
*/
function jetpack_enhanced_distribution_more_link() {
echo esc_url( Redirect::get_url( 'jetpack-support-enhanced-distribution' ) );
}
add_action( 'jetpack_learn_more_button_enhanced-distribution', 'jetpack_enhanced_distribution_more_link' );

/**
* Enhanced Distribution description.
*/
function jetpack_enhanced_distribution_more_info() {
esc_html_e(
'Jetpack will automatically take your great published content and share it instantly with third-party services
like search engines, increasing your reach and traffic.',
'jetpack'
);
}
add_action( 'jetpack_module_more_info_enhanced-distribution', 'jetpack_enhanced_distribution_more_info' );

/**
* Protect support link.
*/
Expand Down
1 change: 0 additions & 1 deletion projects/plugins/jetpack/readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,6 @@ Jetpack is the ultimate toolkit for WP for both the classic editor and the block
* Custom CSS — Customize the appearance of your theme without creating a child theme or worrying about updates overwriting your customizations.
* Custom Content Types — Adds custom post types (CPTs) to your site.
* Downtime Monitor — Alerts you via electronic mail if your site goes down to ensure you keep uptime.
* Enhanced Distribution — Increase your reach by allowing your content to be included in the WordPress.com “firehose” of public blog content.
* Extra Sidebar Widgets — Extra widgets you can add to your blog, including RSS Links and Facebook Like Boxes.
* Gravatar Hovercards — Make your Gravatar profile visible to those viewing your blog.
* Google Analytics (GA) — Track your WordPress site statistics thanks to Google Analytics.
Expand Down
1 change: 0 additions & 1 deletion projects/plugins/jetpack/tests/php/test-get-modules.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ public function test_get_available_modules() {
'copy-post',
'custom-content-types',
'custom-css',
'enhanced-distribution',
'google-analytics',
'gravatar-hovercards',
'infinite-scroll',
Expand Down
1 change: 0 additions & 1 deletion tools/e2e-commons/helpers/plan-helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,6 @@ function getPlanData(
'contact-form',
'custom-content-types',
'custom-css',
'enhanced-distribution',
'gravatar-hovercards',
'json-api',
'latex',
Expand Down

0 comments on commit 11b2a22

Please sign in to comment.