Skip to content

Commit 309bf86

Browse files
authored
Merge branch 'develop' into fix/1144-webp-support
2 parents fcfe038 + ef9ab4c commit 309bf86

21 files changed

Lines changed: 652 additions & 46 deletions
295 KB
Loading

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.

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,15 @@ Distributor supports safe, SEO-friendly content reuse and sharing via "pushing"
1717

1818
While logged in and editing or viewing any single post (or custom post type) that can be distributed, a `Distributor` admin bar item will appear, that will facilitate sharing ("pushing") that content to any `connection`.
1919

20-
<a href="http://distributorplugin.com/"><img src="https://distributorplugin.com/wp-content/themes/distributor-theme/assets/img/push-screenshot.jpg" alt="Push the content you’re editing or viewing to any of your other sites from the admin bar" width="600"></a>
20+
<a href="http://distributorplugin.com/"><img src="/.github/screenshots/screenshot-2.png" alt="Push the content you’re editing or viewing to any of your other sites from the admin bar" width="600"></a>
2121

2222
In the admin dashboard, a top level Distributor menu item links to the "pull" screen. Here, editors can share ("pull") content from any `connection` into the current site.
2323

24-
<a href="http://distributorplugin.com/"><img src="https://distributorplugin.com/wp-content/themes/distributor-theme/assets/img/pull-screenshot.jpg" alt="Pull content from another site from the Distributor admin menu" width="600"></a>
24+
<a href="http://distributorplugin.com/"><img src="/.github/screenshots/screenshot-6.png" alt="Pull content from another site from the Distributor admin menu" width="600"></a>
2525

2626
Content this is distributed (via Push or Pull) is connected to the original. Reposted content receives updates from the original, canonical source automatically.
2727

28-
<a href="http://distributorplugin.com/"><img alt="Distributor intuitively presents the origin and status of any reused content" class="browser-frame" src="https://distributorplugin.com/wp-content/themes/distributor-theme/assets/img/syndicated-screenshot.jpg" width="600"></a>
28+
<a href="http://distributorplugin.com/"><img alt="Distributor intuitively presents the origin and status of any reused content" src="/.github/screenshots/screenshot-9.jpg" width="600"></a>
2929

3030
There are two connection types: `internal` and `external`.
3131
* Internal connections are other sites inside of the same multisite network. Any user logged into the network can distribute any content in the network to any other sites in the network where that user has permission to publish posts (assuming the site supports the same post type).

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/auto-distribution.md

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
You can enable the automatic distribution of posts upon publication by togging on the "auto-distribute" feature.
2+
3+
To enable auto-distribution, you can include this code in your site's feature plugin.
4+
5+
```php
6+
add_filter( 'dt_auto_distribution_enabled', '__return_true' );
7+
```
8+
9+
This code must run prior to or on the `plugins_loaded` hook. If running on the `plugins_loaded` hook, it must do so at priority 19 or lower.
10+
11+
With auto-distribution enabled, the following will occur:
12+
13+
* upon publication, posts and pages will be pushed to all internal and external connections,
14+
* the default status for pushing posts is `publish`, and,
15+
* auto distribution is runs via cron jobs to avoid slowing down the publication process for users.
16+
17+
## Filters
18+
19+
The auto-distribution feature comes with a number of filters in additional to the one above.
20+
21+
### Auto-distributed post types
22+
23+
By default only posts and pages are auto-distributed. To enable auto-distribution of custom post
24+
types requires the `auto_distribute_supported_post_types` filter be used.
25+
26+
To add a custom post type to supported post types would require the code:
27+
28+
```php
29+
add_filter( 'auto_distribute_supported_post_types', function( $post_types ) {
30+
$post_types[] = 'my_cpt';
31+
return $post_types;
32+
} );
33+
```
34+
35+
### Default post status.
36+
37+
The `dt_auto_distribution_default_status` filter allows you to filter the default post status for
38+
distribution. To modify the default post status for one post type but not others, you can use the code:
39+
40+
```php
41+
function ad_demo_modify_page_default_status( $default_status, $post ) {
42+
if ( 'page' !== get_post_type() ) {
43+
return $default_status;
44+
}
45+
46+
return 'draft';
47+
}
48+
add_filter( 'dt_auto_distribution_default_status', 'ad_demo_modify_page_default_status', 10, 2 );
49+
```
50+
51+
### Whether to auto-distribute a post
52+
53+
The `dt_auto_distribute_post` filter allows you to filter whether an individual post will be
54+
auto-distributed. The filter accepts a number of arguments providing the context of the post,
55+
see the [filter's docs](./dt_auto_distribute_post.html) for further information.'
56+
57+
This filter is only run for post types that are supported, see above.
58+
59+
To prevent auto-distribution to a certain connection type:
60+
61+
```php
62+
function ad_demo_no_external( $should_distribute, $post, $user_id, $connection_type ) {
63+
if ( $connection_type === 'external' ) {
64+
return false;
65+
}
66+
return $should_distribute;
67+
}
68+
add_filter( 'dt_auto_distribute_post', 'ad_demo_no_external', 10, 4 );
69+
```

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

docs/tutorials.json

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,13 @@
1414
"snippets": {
1515
"title": "Snippets"
1616
},
17-
"demo-with-playground": {
18-
"title": "Demo with Playground"
19-
},
20-
"stored-id-handling": {
21-
"title": "Stored ID Handling"
22-
}
17+
"demo-with-playground": {
18+
"title": "Demo with Playground"
19+
},
20+
"stored-id-handling": {
21+
"title": "Stored ID Handling"
22+
},
23+
"auto-distribution": {
24+
"title": "Enabling Auto Distribution"
25+
}
2326
}

0 commit comments

Comments
 (0)