-
Notifications
You must be signed in to change notification settings - Fork 805
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Enhanced Distribution: begin deprecation (#36168)
* 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
Showing
14 changed files
with
89 additions
and
120 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
80 changes: 5 additions & 75 deletions
80
projects/plugins/jetpack/modules/enhanced-distribution.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters