Skip to content

Commit

Permalink
Merge branch 'develop' into fix/349
Browse files Browse the repository at this point in the history
  • Loading branch information
ravinderk authored Sep 8, 2023
2 parents 910ff84 + d4578e3 commit 7c7856f
Show file tree
Hide file tree
Showing 76 changed files with 1,709 additions and 2,667 deletions.
3 changes: 3 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,6 @@ indent_size = 4
[*.{json,yml,md}]
indent_style = space
indent_size = 2

[{*.txt,wp-config-sample.php}]
end_of_line = crlf
8 changes: 8 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,11 @@
/.gitattributes export-ignore
/.gitignore export-ignore
/.wordpress-version-checker.json export-ignore

# Text files should have LF line endings.
* text eol=lf

# Binary files should not be modified.
*.mo binary
*.png binary
*.jpg binary
2 changes: 1 addition & 1 deletion .github/workflows/cypress.yml
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ jobs:
run: npm run copy-htaccess

- name: Test
run: npm run cypress:run --config-file tests/cypress/config.js
run: npm run cypress:run

- name: Update summary
if: always()
Expand Down
9 changes: 5 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ All notable changes to this project will be documented in this file, per [the Ke

## [Unreleased] - TBD

## [2.0.0] - TBD
## [2.0.0] - 2023-09-05
**Note that Distributor now requires PHP 7.4 or later and WordPress 5.7 or later.**

_This entry was generated for the 2.0.0-rc1 release and will be updated during the Beta and Release Candidate processes._
Please see the [migration guide](https://10up.github.io/distributor/tutorial-migration-guide-version-1-to-version-2.html) for important changes between version 1 and version 2 that may require your action.

### Added
- Migration guide for version 1 to version 2 (props [@peterwilsoncc](https://github.com/peterwilsoncc), [@faisal-alvi](https://github.com/faisal-alvi), [@jeffpaul](https://github.com/jeffpaul) via [#996](https://github.com/10up/distributor/pull/996)).
Expand All @@ -30,12 +30,13 @@ _This entry was generated for the 2.0.0-rc1 release and will be updated during t
- Toggles the Distributor admin bar element in Gutenberg based on the post status (props [@ggutenberg](https://github.com/ggutenberg), [@jeffpaul](https://github.com/jeffpaul), [@peterwilsoncc](https://github.com/peterwilsoncc) via [#1022](https://github.com/10up/distributor/pull/1022), [#1114](https://github.com/10up/distributor/pull/1114)).
- Reduced duplicate code pushing posts to connections (props [@peterwilsoncc](https://github.com/peterwilsoncc), [@cadic](https://github.com/cadic), [@jeffpaul](https://github.com/jeffpaul), [@faisal-alvi](https://github.com/faisal-alvi), [@aaronware](https://github.com/aaronware) via [#999](https://github.com/10up/distributor/pull/999)).
- Unified translator comments (props [@peterwilsoncc](https://github.com/peterwilsoncc), [@cadic](https://github.com/cadic) via [#949](https://github.com/10up/distributor/pull/949)).
- WordPress "tested up to" version 6.2 (props [@jayedul](https://github.com/jayedul), [@faisal-alvi](https://github.com/faisal-alvi), [@jeffpaul](https://github.com/jeffpaul) via [#1047](https://github.com/10up/distributor/pull/1047)).
- WordPress "tested up to" version 6.3 (props [@jayedul](https://github.com/jayedul), [@faisal-alvi](https://github.com/faisal-alvi), [@jeffpaul](https://github.com/jeffpaul), [@QAharshalkadu](https://github.com/QAharshalkadu), [@dkotter](https://github.com/dkotter) via [#1047](https://github.com/10up/distributor/pull/1047), [#1118](https://github.com/10up/distributor/issues/1118), [#1123](https://github.com/10up/distributor/pull/1123)).
- Browserlist database updated to version 1.0.30001489 (props [@peterwilsoncc](https://github.com/peterwilsoncc), [@dkotter](https://github.com/dkotter) via [#1059](https://github.com/10up/distributor/pull/1059)).
- Build process now uses `@wordpress/scripts` in place of Gulp (props [@peterwilsoncc](https://github.com/peterwilsoncc), [@dinhtungdu](https://github.com/dinhtungdu), [@dkotter](https://github.com/dkotter) via [#916](https://github.com/10up/distributor/pull/916)).
- Migrated E2E tests to Cypress (props [@peterwilsoncc](https://github.com/peterwilsoncc), [@jeffpaul](https://github.com/jeffpaul), [@iamdharmesh](https://github.com/iamdharmesh) via [#1070](https://github.com/10up/distributor/pull/1070)).
- Update `dependency-review.yml` (props [@jeffpaul](https://github.com/jeffpaul), [@peterwilsoncc](https://github.com/peterwilsoncc) via [#1054](https://github.com/10up/distributor/pull/1054)).
- Order of operations setting meta, media and terms in the network push and pull functions (props [@sethrubenstein](https://github.com/sethrubenstein), [@jeffpaul](https://github.com/jeffpaul), [@peterwilsoncc](https://github.com/peterwilsoncc) via [#1095](https://github.com/10up/distributor/pull/1095)).
- Upgrade the Plugin Update Checker library from 4.13 to 5.1 (props [@dkotter](https://github.com/dkotter) via [#1124](https://github.com/10up/distributor/pull/1124)).

### Deprecated
- `dt_push_post` action hook (props [@dkotter](https://github.com/dkotter), [@peterwilsoncc](https://github.com/peterwilsoncc), [@dhanendran](https://github.com/dhanendran), [@ravinderk](https://github.com/ravinderk), [@jeffpaul](https://github.com/jeffpaul) via [#1024](https://github.com/10up/distributor/pull/1024)).
Expand Down Expand Up @@ -470,7 +471,7 @@ This adds a post type selector when viewing the Pull Content list for both exter
- Initial closed release.

[Unreleased]: https://github.com/10up/distributor/compare/trunk...develop
[2.0.0]: https://github.com/10up/distributor/compare/1.9.1...develop
[2.0.0]: https://github.com/10up/distributor/compare/1.9.1...2.0.0
[1.9.1]: https://github.com/10up/distributor/compare/1.9.0...1.9.1
[1.9.0]: https://github.com/10up/distributor/compare/1.8.0...1.9.0
[1.8.0]: https://github.com/10up/distributor/compare/1.7.1...1.8.0
Expand Down
3 changes: 2 additions & 1 deletion CREDITS.md

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

> Distributor is a WordPress plugin that makes it easy to distribute and reuse content across your websites — whether in a single multisite or across the web.
[![Support Level](https://img.shields.io/badge/support-active-green.svg)](#support-level) [![Tests](https://github.com/10up/distributor/actions/workflows/test.yml/badge.svg)](https://github.com/10up/distributor/actions/workflows/test.yml) [![Linting](https://github.com/10up/distributor/actions/workflows/lint.yml/badge.svg)](https://github.com/10up/distributor/actions/workflows/lint.yml) [![Code scanning](https://github.com/10up/distributor/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/10up/distributor/actions/workflows/codeql-analysis.yml) [![Release Version](https://img.shields.io/github/release/10up/distributor.svg)](https://github.com/10up/distributor/releases/latest) ![WordPress tested up to version](https://img.shields.io/badge/WordPress-v6.1%20tested-success.svg) [![License](https://img.shields.io/github/license/10up/distributor.svg)](https://github.com/10up/distributor/blob/develop/LICENSE.md)
[![Support Level](https://img.shields.io/badge/support-active-green.svg)](#support-level) [![Tests](https://github.com/10up/distributor/actions/workflows/test.yml/badge.svg)](https://github.com/10up/distributor/actions/workflows/test.yml) [![Linting](https://github.com/10up/distributor/actions/workflows/lint.yml/badge.svg)](https://github.com/10up/distributor/actions/workflows/lint.yml) [![Code scanning](https://github.com/10up/distributor/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/10up/distributor/actions/workflows/codeql-analysis.yml) [![Release Version](https://img.shields.io/github/release/10up/distributor.svg)](https://github.com/10up/distributor/releases/latest) ![WordPress tested up to version](https://img.shields.io/badge/WordPress-v6.3%20tested-success.svg) [![License](https://img.shields.io/github/license/10up/distributor.svg)](https://github.com/10up/distributor/blob/develop/LICENSE.md)

*You can learn more about Distributor's features at [DistributorPlugin.com](https://distributorplugin.com) and documentation at the [Distributor documentation site](https://10up.github.io/distributor/).*

Expand Down Expand Up @@ -58,7 +58,7 @@ Distributor is built with the same extensible approach as WordPress itself, with
* [WordPress](http://wordpress.org) 5.7+
* External connections require HTTP Basic Authentication or [WordPress.com OAuth2](https://developer.wordpress.com/docs/oauth2/) (must be on [WordPress VIP](https://wpvip.com/)) be set up on the remote website. For Basic Auth, we recommend using [Application Passwords](https://make.wordpress.org/core/2020/11/05/application-passwords-integration-guide/#Getting-Credentials) built in to WordPress.
* For external connections, Distributor needs to be installed on BOTH sides of the connection.
* Version 2 of Distributor requires version two on BOTH sides of all connections.
* Version 2.0.0 of Distributor requires version 2.0.0 on BOTH sides of all connections. For other version 2.0.0 specific changes, please see our [migration guide](https://10up.github.io/distributor/tutorial-migration-guide-version-1-to-version-2.html).

## Installation

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
],
"require": {
"php": ">=7.4",
"yahnis-elsts/plugin-update-checker": "4.13",
"yahnis-elsts/plugin-update-checker": "5.1",
"ext-json": "*"
},
"autoload": {
Expand Down
20 changes: 10 additions & 10 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions distributor.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* Plugin URI: https://github.com/10up/distributor
* Update URI: https://distributorplugin.com
* Description: Makes it easy to distribute and reuse content across your websites, whether inside of a multisite or across the web.
* Version: 2.0.0-rc1
* Version: 2.0.0
* Requires at least: 5.7
* Requires PHP: 7.4
* Author: 10up Inc.
Expand All @@ -28,7 +28,7 @@
exit; // Exit if accessed directly.
}

define( 'DT_VERSION', '2.0.0-rc1' );
define( 'DT_VERSION', '2.0.0' );
define( 'DT_PLUGIN_FILE', preg_replace( '#^.*plugins/(.*)$#i', '$1', __FILE__ ) );
define( 'DT_PLUGIN_PATH', plugin_dir_path( __FILE__ ) );
define( 'DT_PLUGIN_FULL_FILE', __FILE__ );
Expand Down
35 changes: 32 additions & 3 deletions docs/migration-guide-version-1-to-version-2.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
Version 2 of Distributor includes a number of breaking changes that will require updates to custom code you may have written for distributor.
Version 2.0.0 of Distributor includes a number of breaking changes that will require updates to custom code you may have written for distributor.

## External connections require a minimum of version 2.0
## External connections require a minimum of version 2.0.0

It is recommended that both ends of an external connection run the same version of Distributor.

Version 2.0 of Distributor will prevent the pulling of posts from sites running Version 1.9.x or lower of Distributor.
Version 2.0.0 of Distributor will prevent the pulling of posts from sites running Version 1.9.x or lower of Distributor.

### Remove canonical links for both Internal and External Connections

Expand All @@ -27,3 +27,32 @@ add_action( 'plugins_loaded', function() {
remove_filter( 'wpseo_canonical', '\\Distributor\\Hooks\\wpseo_canonical', 10, 2 );
} );
```

### REST API Changes

The distributor REST API endpoint at `/wp/v2/distributor/list-pull-content` has been modified substantially and will now reject connections from 1.x versions of Distributor.

The fields returned by the endpoint have been modified to match the names used by `wp_insert_post` and `wp_update_post`.

#### Additional parameters

* `include` (Array|Int): Ensure result set includes specific Post IDs. Default empty.
* `order` (`asc`|`desc`): Specify order of returned data. Default `desc`.
* `orderby` (`author`|`date`|`id`|`include`|`modified`|`parent`|`relevance`|`slug`|`title`): Field to order results by. Default `date`, `relevance` for search queries.

#### Modified parameters

* `post_type` (String|String[]): Modified to accept multiple post types. Post types are limited to posts the connected account can edit, are public post types and visible in the WordPress REST API's standard endpoints. Default `post`.
* `post_status` (String|String[]): Modified to accept multiple post statuses. Statuses are limited to public statuses only. Default `publish`.

### `dt_push_post` action deprecated

The <a href="./dt_push_post.html">`dt_push_post`</a> action has been deprecated in favor of two actions: <a href="./dt_push_external_post.html">`dt_push_external_post`</a> and <a href="./dt_push_network_post.html">`dt_push_network_post`</a>.

Extenders using the old action are advised to switch to the new actions as a matter of priority. The deprecated action had conflicting arguments so can not be relied upon to pass data consistently.

### Internationalization improvements

The generation of translation files has been updated to include strings included in JavaScript files.

Version 2.0.0 of Distributor has also improved pluralization of strings and combined similar strings to reduce the burden on translators.
10 changes: 7 additions & 3 deletions includes/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@

namespace Distributor;

use YahnisElsts\PluginUpdateChecker\v5\PucFactory;

/**
* PSR-4 autoloading
*/
Expand Down Expand Up @@ -130,7 +132,7 @@ function() {
}
);

if ( class_exists( '\\Puc_v4_Factory' ) ) {
if ( class_exists( '\\YahnisElsts\PluginUpdateChecker\v5\PucFactory' ) ) {
/**
* Enable updates if we have a valid license
*/
Expand All @@ -144,7 +146,7 @@ function() {

if ( $valid_license ) {
// @codingStandardsIgnoreStart
$updateChecker = \Puc_v4_Factory::buildUpdateChecker(
$updateChecker = PucFactory::buildUpdateChecker(
'https://github.com/10up/distributor/',
DT_PLUGIN_FULL_FILE,
'distributor'
Expand Down Expand Up @@ -174,7 +176,9 @@ function( $transient ) use ( $updateChecker ) {
$update = $updateChecker->getUpdateState()->getUpdate();
// Adding the plugin info to the `no_update` property is required
// for the enable/disable auto-updates links to correctly appear in UI.
$transient->no_update[ $update->filename ] = $update;
if ( $update ) {
$transient->no_update[ $update->filename ] = $update;
}
}

return $transient;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ public function remote_post( $url = '', $args = array() ) {
&& isset( $response_headers['x-distributor'] )
&& (
! isset( $response_headers['x-distributor-version'] )
|| version_compare( $response_headers['x-distributor-version'], '2.0.0-alpha', '<' )
|| version_compare( $response_headers['x-distributor-version'], '2.0.0', '<' )
)
) {
$version_error = new \WP_Error();
Expand Down
2 changes: 1 addition & 1 deletion includes/rest-api.php
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ function get_pull_content_permissions( $request ) {
&& null !== $request->get_param( 'distributor_request' )
&& (
null === $request->get_header( 'X-Distributor-Version' )
|| version_compare( $request->get_header( 'X-Distributor-Version' ), '2.0.0-alpha', '<' )
|| version_compare( $request->get_header( 'X-Distributor-Version' ), '2.0.0', '<' )
)
) {
return new \WP_Error(
Expand Down
Loading

0 comments on commit 7c7856f

Please sign in to comment.