Skip to content

Commit ef9ab4c

Browse files
committed
Merge branch 'release/2.2.0' into develop
2 parents ba231c8 + fdff417 commit ef9ab4c

16 files changed

+82
-47
lines changed

CHANGELOG.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,34 @@ All notable changes to this project will be documented in this file, per [the Ke
44

55
## [Unreleased] - TBD
66

7+
## [2.2.0] - 2025-09-08
8+
**Note that this release bumps the WordPress minimum supported version from 6.5 to 6.6.**
9+
10+
### Added
11+
- The `distributor_register_data` function that enables developers to register stored data references, such as IDs stored in post meta, shortcodes, or block attributes and define custom pre-distribution and post-distribution callbacks to process these references (props [@iamdharmesh](https://github.com/iamdharmesh), [@jeffpaul](https://github.com/jeffpaul), [@peterwilsoncc](https://github.com/peterwilsoncc), [@dkotter](https://github.com/dkotter) via [#1302](https://github.com/10up/distributor/pull/1302)).
12+
- Add some default pre and post callback functions to the `distributor_register_data` function, allowing easy processing of common entities like posts, terms, and media (props [@iamdharmesh](https://github.com/iamdharmesh), [@jeffpaul](https://github.com/jeffpaul), [@peterwilsoncc](https://github.com/peterwilsoncc), [@dkotter](https://github.com/dkotter) via [#1309](https://github.com/10up/distributor/pull/1309)).
13+
- Ability to auto-distribute posts when turned on via a filter, `dt_auto_distribution_enabled` (props [@peterwilsoncc](https://github.com/peterwilsoncc), [@faisal-alvi](https://github.com/faisal-alvi), [@jeffpaul](https://github.com/jeffpaul), [@dkotter](https://github.com/dkotter) via [#1321](https://github.com/10up/distributor/pull/1321)).
14+
15+
### Changed
16+
- Bump WordPress "tested up to" version 6.8 (props [@Sourabh208](https://github.com/Sourabh208), [@dkotter](https://github.com/dkotter) via [#1311](https://github.com/10up/distributor/pull/1311)).
17+
- Bump WordPress minimum to 6.6 (props [@Sourabh208](https://github.com/Sourabh208), [@jeffpaul](https://github.com/jeffpaul), [@peterwilsoncc](https://github.com/peterwilsoncc) via [#1312](https://github.com/10up/distributor/pull/1312)).
18+
19+
### Fixed
20+
- Ensure post data is slashed when sent via a subscription update (props [@chandrapatel](https://github.com/chandrapatel), [@peterwilsoncc](https://github.com/peterwilsoncc) via [#1310](https://github.com/10up/distributor/pull/1310)).
21+
- Broken images in docs (props [@GaryJones](https://github.com/GaryJones), [@jeffpaul](https://github.com/jeffpaul), [@av3nger](https://github.com/av3nger), [@dkotter](https://github.com/dkotter) via [#1319](https://github.com/10up/distributor/pull/1319)).
22+
23+
### Security
24+
- Prevent cross-site scripting vulnerabilities on the pull screen (props [@iamdharmesh](https://github.com/iamdharmesh), [@peterwilsoncc](https://github.com/peterwilsoncc), [@jeffpaul](https://github.com/jeffpaul), [@Sidsector9](https://github.com/Sidsector9), [@dkotter](https://github.com/dkotter) via [#1273](https://github.com/10up/distributor/pull/1273), [#1274](https://github.com/10up/distributor/pull/1274), [#1316](https://github.com/10up/distributor/pull/1316)).
25+
- Bump `ws` from 7.5.10 to 8.18.0 and `@wordpress/scripts` from 26.19.0 to 29.0.0 (props [@dependabot](https://github.com/apps/dependabot), [@Sidsector9](https://github.com/Sidsector9) via [#1270](https://github.com/10up/distributor/pull/1270)).
26+
- Bump `axios` from 1.7.4 to 1.9.0, `body-parser` from 1.20.2 to 1.20.3, `express` from 4.19.2 to 4.21.2, `@wordpress/e2e-test-utils-playwright` from 1.7.0 to 1.23.0, `http-proxy-middleware` from 2.0.6 to 2.0.9, `tar-fs` from 3.0.4 to 3.0.8, `serialize-javascript` from 6.0.1 to 6.0.2, `mocha` from 10.2.0 to 11.3.0 and `send` from 0.18.0 to 0.19.0; also removes `cookie` (props [@dependabot](https://github.com/apps/dependabot), [@peterwilsoncc](https://github.com/peterwilsoncc) via [#1314](https://github.com/10up/distributor/pull/1314)).
27+
- Bump `on-headers` from 1.0.2 to 1.1.0 and `compression` from 1.7.4 to 1.8.1 (props [@dependabot](https://github.com/apps/dependabot), [@dkotter](https://github.com/dkotter) via [#1325](https://github.com/10up/distributor/pull/1325)).
28+
- Bump `tmp` from 0.2.1 to 0.2.5 and `@wordpress/env` from 10.5.0 to 10.29.0 (props [@dependabot](https://github.com/apps/dependabot), [@dkotter](https://github.com/dkotter) via [#1334](https://github.com/10up/distributor/pull/1334)).
29+
30+
### Developer
31+
- Fix eslint errors (props [@GaryJones](https://github.com/GaryJones), [@iamdharmesh](https://github.com/iamdharmesh) via [#1320](https://github.com/10up/distributor/pull/1320)).
32+
- Update all third-party actions our workflows rely on to use versions based on specific commit hashes (props [@dkotter](https://github.com/dkotter), [@jeffpaul](https://github.com/jeffpaul), [@faisal-alvi](https://github.com/faisal-alvi) via [#1305](https://github.com/10up/distributor/pull/1305)).
33+
- Fix featured media E2E tests (props [@peterwilsoncc](https://github.com/peterwilsoncc), [@dkotter](https://github.com/dkotter) via [#1332](https://github.com/10up/distributor/pull/1332)).
34+
735
## [2.1.0] - 2025-02-10
836
**Note that this release bumps the WordPress minimum supported version from 6.4 to 6.5.**
937

@@ -597,6 +625,7 @@ This adds a post type selector when viewing the Pull Content list for both exter
597625
- Initial closed release.
598626

599627
[Unreleased]: https://github.com/10up/distributor/compare/trunk...develop
628+
[2.2.0]: https://github.com/10up/distributor/compare/2.1.0...2.2.0
600629
[2.1.0]: https://github.com/10up/distributor/compare/2.0.6...2.1.0
601630
[2.0.6]: https://github.com/10up/distributor/compare/2.0.5...2.0.6
602631
[2.0.5]: https://github.com/10up/distributor/compare/2.0.4...2.0.5

CREDITS.md

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

distributor.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* Plugin URI: https://github.com/10up/distributor
55
* Update URI: https://distributorplugin.com
66
* Description: Makes it easy to distribute and reuse content across your websites, whether inside of a multisite or across the web.
7-
* Version: 2.1.0
7+
* Version: 2.2.0
88
* Requires at least: 6.6
99
* Requires PHP: 7.4
1010
* Author: 10up Inc.
@@ -28,7 +28,7 @@
2828
exit; // Exit if accessed directly.
2929
}
3030

31-
define( 'DT_VERSION', '2.1.0' );
31+
define( 'DT_VERSION', '2.2.0' );
3232
define( 'DT_PLUGIN_FILE', preg_replace( '#^.*plugins/(.*)$#i', '$1', __FILE__ ) );
3333
define( 'DT_PLUGIN_PATH', plugin_dir_path( __FILE__ ) );
3434
define( 'DT_PLUGIN_FULL_FILE', __FILE__ );

docs/stored-id-handling.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ The `distributor_register_data` function streamlines the process of updating sto
1010
- **Extracting the reference:** Defining how to locate the specific attribute or meta key holding the ID.
1111
- **Processing the data:** Using pre-distribution and post-distribution callbacks to prepare and update the reference IDs, ensuring they point to the correct data on the target site.
1212

13-
#### **Important:** Ensure that this data registration code is added to both the source and target sites. Also, verify that your Distributor plugin version is the same on both sites and equal to or greater than the required version (x.x.x).
13+
#### **Important:** Ensure that this data registration code is added to both the source and target sites. Also, verify that your Distributor plugin version is the same on both sites and equal to or greater than the required version (2.2.0).
1414

1515
## Function Definition
1616

includes/auto-distribute.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
*
1313
* Runs on the `plugins_loaded, 20` hook.
1414
*
15-
* @since x.x.x
15+
* @since 2.2.0
1616
*/
1717
function setup() {
1818
$n = function( $function ) {
@@ -32,7 +32,7 @@ function setup() {
3232
*
3333
* Default is false, see the filter `dt_auto_distribution_enabled` to enable it.
3434
*
35-
* @since x.x.x
35+
* @since 2.2.0
3636
*
3737
* @return bool Whether the auto-distribution feature is enabled.
3838
*/
@@ -49,7 +49,7 @@ function enabled() {
4949
* to all network and external connections that the post had not already been distributed
5050
* to. These posts will be distributed as published posts, not drafts.
5151
*
52-
* @since x.x.x.
52+
* @since 2.2.0
5353
* @hook dt_auto_distribution_enabled
5454
*
5555
* @param {bool} $enabled Whether the auto-distribution feature is enabled. Default false.
@@ -65,7 +65,7 @@ function enabled() {
6565
* This is the default status that will be applied to auto-distributed posts
6666
* on the distribution site.
6767
*
68-
* @since x.x.x
68+
* @since 2.2.0
6969
*
7070
* @param int|\WP_Post $post Post ID or WP_Post object for the post being pushed.
7171
* @return string Default status for auto-distributed posts.
@@ -76,7 +76,7 @@ function default_post_status( $post ) {
7676
/**
7777
* Filter the default status for auto-distributed posts.
7878
*
79-
* @since x.x.x
79+
* @since 2.2.0
8080
* @hook dt_auto_distribution_default_status
8181
*
8282
* @param {string} $status Default status for auto-distributed posts. Default 'publish'.
@@ -92,7 +92,7 @@ function default_post_status( $post ) {
9292
*
9393
* This function checks if the post should be auto-distributed based on filters.
9494
*
95-
* @since x.x.x
95+
* @since 2.2.0
9696
*
9797
* @param int|\WP_Post $post Post ID or WP_Post object for the post being pushed.
9898
* @param int $user_id User ID of the user pushing the post.
@@ -110,7 +110,7 @@ function auto_distribute_post( $post, $user_id, $connection_type, $connection_id
110110
/**
111111
* Filter to determine if a post should be auto-distributed.
112112
*
113-
* @since x.x.x
113+
* @since 2.2.0
114114
* @hook dt_auto_distribute_post
115115
*
116116
* @param {bool} $should_distribute Whether the post should be auto-distributed.
@@ -130,7 +130,7 @@ function auto_distribute_post( $post, $user_id, $connection_type, $connection_id
130130
* By default, this is post and page but that
131131
* value can be filtered.
132132
*
133-
* @since x.x.x
133+
* @since 2.2.0
134134
*
135135
* @return string[] Array of post types that can be auto-distributed.
136136
*/
@@ -139,7 +139,7 @@ function auto_distribute_supported_post_types() {
139139
/**
140140
* Filter the post types that are auto-distributable.
141141
*
142-
* @since x.x.x
142+
* @since 2.2.0
143143
* @hook auto_distribute_supported_post_types
144144
*
145145
* @param {string[]} $post_types Array of post types that can be auto-distributed.
@@ -320,7 +320,7 @@ function get_external_connections( $post_id = 0, $user_id = 0 ) {
320320
*
321321
* @hook dt_external_connections_per_page
322322
*
323-
* @since x.x.x
323+
* @since 2.2.0
324324
*
325325
* @param {int} $max_connections The maximum number of external connections to load.
326326
* @return {int} The maximum number of external connections to load.

includes/classes/DistributorPost.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -663,7 +663,7 @@ protected function get_media() {
663663
/**
664664
* Get the extra data for the post to be processed on the target site.
665665
*
666-
* @since x.x.x
666+
* @since 2.2.0
667667
*
668668
* @return array[] {
669669
* Array of extra data keyed by the data name.
@@ -694,7 +694,7 @@ protected function get_extra_data() {
694694
/**
695695
* Filters whether to process extra data for the post.
696696
*
697-
* @since x.x.x
697+
* @since 2.2.0
698698
* @hook dt_process_extra_data
699699
*
700700
* @param {bool} $process_extra_data Whether to process extra data.
@@ -797,7 +797,7 @@ protected function get_extra_data() {
797797
/**
798798
* Filters the extra data for the post to be processed on the target site.
799799
*
800-
* @since x.x.x
800+
* @since 2.2.0
801801
* @hook dt_extra_data
802802
*
803803
* @param {array} $extra_data Extra data for the post.
@@ -812,7 +812,7 @@ protected function get_extra_data() {
812812
/**
813813
* Parse blocks to obtain value of given attribute.
814814
*
815-
* @since x.x.x
815+
* @since 2.2.0
816816
*
817817
* @param array $block Block to parse.
818818
* @param string $block_name Block name to look for.
@@ -849,7 +849,7 @@ protected function parse_blocks_for_attribute_values( $block, $block_name, $bloc
849849
/**
850850
* Get the attribute values of a given shortcode.
851851
*
852-
* @since x.x.x
852+
* @since 2.2.0
853853
*
854854
* @param string $content The post content.
855855
* @param string $shortcode The shortcode to look for.

includes/classes/RegisteredDataHandler.php

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,21 @@
1010
/**
1111
* This class is responsible for processing the registered data for the post content and post meta.
1212
*
13-
* @since x.x.x
13+
* @since 2.2.0
1414
*/
1515
class RegisteredDataHandler {
1616
/**
1717
* The Connection data array.
1818
*
19-
* @since x.x.x
19+
* @since 2.2.0
2020
* @var array
2121
*/
2222
public $connection_data = array();
2323

2424
/**
2525
* Constructor for the RegisteredDataHandler class.
2626
*
27-
* @since x.x.x
27+
* @since 2.2.0
2828
*
2929
* @param array $connection_data The connection data array.
3030
*/
@@ -35,7 +35,7 @@ public function __construct( $connection_data = array() ) {
3535
/**
3636
* Search and replace inner content of a block with the provided replacements.
3737
*
38-
* @since x.x.x
38+
* @since 2.2.0
3939
*
4040
* @param array $block The block to search and replace inner content.
4141
* @param array $replacement_strings Array of search and replace strings for inner content.
@@ -58,7 +58,7 @@ public function search_replace_block_inner_content( $block, $replacement_strings
5858
*
5959
* Processes the blocks data recursively and calls the callback function provided in the registered data.
6060
*
61-
* @since x.x.x
61+
* @since 2.2.0
6262
*
6363
* @param array $blocks Array of blocks.
6464
* @param array $registered_data Array of registered data.
@@ -169,7 +169,7 @@ public function process_blocks_data_recursive( $blocks, $registered_data, $extra
169169
*
170170
* Calls the callback function provided in the registered data and updates the post data.
171171
*
172-
* @since x.x.x
172+
* @since 2.2.0
173173
*
174174
* @param array $post_data The post data.
175175
* @param bool $is_rest Whether the post data is from the REST API.
@@ -248,7 +248,7 @@ public function process_registered_data( $post_data, $is_rest = false ) {
248248
/**
249249
* Filter the post data after processing the registered data.
250250
*
251-
* @since x.x.x
251+
* @since 2.2.0
252252
* @hook dt_after_registered_data_processed
253253
*
254254
* @param {array} $post_data The post data after processing the registered data.
@@ -267,7 +267,7 @@ public function process_registered_data( $post_data, $is_rest = false ) {
267267
*
268268
* Calls the callback function provided in the registered data and updates the post meta data.
269269
*
270-
* @since x.x.x
270+
* @since 2.2.0
271271
*
272272
* @param array $post_meta The post meta data.
273273
* @param array $registered_data The distributor registered data.
@@ -328,7 +328,7 @@ public function process_registered_post_meta_data( $post_meta, $registered_data,
328328
/**
329329
* Filter the post meta data after processing the registered data.
330330
*
331-
* @since x.x.x
331+
* @since 2.2.0
332332
* @hook dt_after_registered_post_meta_processed
333333
*
334334
* @param {array} $post_meta The post meta data.
@@ -344,7 +344,7 @@ public function process_registered_post_meta_data( $post_meta, $registered_data,
344344
/**
345345
* Process the registered block data for the post content.
346346
*
347-
* @since x.x.x
347+
* @since 2.2.0
348348
*
349349
* @param string $post_content The post content.
350350
* @param array $registered_data The distributor registered data.
@@ -370,7 +370,7 @@ public function process_registered_block_data( $post_content, $registered_data,
370370
/**
371371
* Filter the post content blocks after processing the registered data.
372372
*
373-
* @since x.x.x
373+
* @since 2.2.0
374374
* @hook dt_after_registered_block_data_processed
375375
*
376376
* @param {array} $post_content The post content.
@@ -386,7 +386,7 @@ public function process_registered_block_data( $post_content, $registered_data,
386386
/**
387387
* Process the registered shortcode data for the post content.
388388
*
389-
* @since x.x.x
389+
* @since 2.2.0
390390
*
391391
* @param string $post_content The post content.
392392
* @param array $registered_data The distributor registered data.
@@ -458,7 +458,7 @@ function ( $matches ) use ( &$index, $shortcode, $shortcode_attribute, $callback
458458
/**
459459
* Filter the post content shortcodes after processing the registered data.
460460
*
461-
* @since x.x.x
461+
* @since 2.2.0
462462
* @hook dt_after_registered_shortcode_data_processed
463463
*
464464
* @param {array} $post_content The post content.
@@ -474,7 +474,7 @@ function ( $matches ) use ( &$index, $shortcode, $shortcode_attribute, $callback
474474
/**
475475
* Prepare the term extra data to be sent to the target site.
476476
*
477-
* @since x.x.x
477+
* @since 2.2.0
478478
*
479479
* @param int $term_id The term ID.
480480
* @param bool $with_parent Whether to include the parent term data.
@@ -504,7 +504,7 @@ public function prepare_registered_data_term( $term_id, $with_parent = false ) {
504504
/**
505505
* Process the registered data for the term.
506506
*
507-
* @since x.x.x
507+
* @since 2.2.0
508508
*
509509
* @param array $term_data The term data to be processed.
510510
* @param bool $process_parent Whether to process the parent term.

includes/debug-info.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ function get_formatted_external_connections() {
215215
*
216216
* @hook dt_external_connections_per_page
217217
*
218-
* @since x.x.x
218+
* @since 2.2.0
219219
*
220220
* @param {int} $max_connections The maximum number of external connections to load.
221221
* @return {int} The maximum number of external connections to load.

includes/global-functions.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ function str_ends_with( $haystack, $needle ) {
125125
/**
126126
* Register a data field for Stored ID handling.
127127
*
128-
* @since x.x.x
128+
* @since 2.2.0
129129
*
130130
* @global array $distributor_registered_data Global registry for distributor data.
131131
*
@@ -225,7 +225,7 @@ function distributor_register_data( $data_name, $args ) {
225225
/**
226226
* Get the registered distributor data.
227227
*
228-
* @since x.x.x
228+
* @since 2.2.0
229229
*
230230
* @global array $distributor_registered_data Global registry for distributor data.
231231
*
@@ -543,7 +543,7 @@ function distributor_term_pre_distribute_callback( $term_id, $source_post_id ) {
543543
* Filter whether to distribute term with parents.
544544
* If set to true, the term will be distributed with its parents.
545545
*
546-
* @since x.x.x
546+
* @since 2.2.0
547547
* @hook dt_registered_data_distribute_term_parent
548548
*
549549
* @param bool $with_parents Whether to distribute term with parents. Default false.

includes/pull-ui.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ function setup_list_table() {
6868
*
6969
* @hook dt_external_connections_per_page
7070
*
71-
* @since x.x.x
71+
* @since 2.2.0
7272
*
7373
* @param {int} $max_connections The maximum number of external connections to load.
7474
* @return {int} The maximum number of external connections to load.

0 commit comments

Comments
 (0)