diff --git a/CHANGELOG.md b/CHANGELOG.md index 9512dd055..2efd87811 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,14 @@ All notable changes to this project will be documented in this file, per [the Keep a Changelog standard](http://keepachangelog.com/). +## [ 1.3.8 ] - 2019-01-30 +### Added +* Add `dt_after_set_meta` action. +* Add `dt_process_subscription_attributes` action. + +### Fixed +* Ensure post types without excerpt support can be distributed. + ## [ 1.3.7 ] - 2019-01-16 ### Added * Distribute plaintext URLs instead of full markup for automatic embeds (oEmbeds). This was causing issues for non-privileged users where the markup was subject to sanitization/kses. diff --git a/distributor.php b/distributor.php index 6d0fe1cb3..5b4abd620 100644 --- a/distributor.php +++ b/distributor.php @@ -2,7 +2,7 @@ /** * Plugin Name: Distributor * Description: Makes it easy to syndicate and reuse content across your websites, whether inside of a multisite or across the web. - * Version: 1.3.7 + * Version: 1.3.8 * Author: 10up Inc. * Author URI: https://distributorplugin.com * License: GPLv2 or later @@ -17,7 +17,7 @@ exit; // Exit if accessed directly. } -define( 'DT_VERSION', '1.3.7' ); +define( 'DT_VERSION', '1.3.8' ); define( 'DT_PLUGIN_FILE', preg_replace( '#^.*plugins/(.*)$#i', '$1', __FILE__ ) ); // Define a constant if we're network activated to allow plugin to respond accordingly. diff --git a/includes/classes/API/SubscriptionsController.php b/includes/classes/API/SubscriptionsController.php index 10234df00..20ab9f17f 100644 --- a/includes/classes/API/SubscriptionsController.php +++ b/includes/classes/API/SubscriptionsController.php @@ -282,6 +282,16 @@ public function receive_item( $request ) { \Distributor\Utils\set_media( $request['post_id'], $request['post_data']['distributor_media'] ); } + /** + * Action fired after receiving a subscription update from Distributor + * + * @since 1.3.8 + * + * @param WP_Post $post Updated post object. + * @param WP_REST_Request $request Request object. + */ + do_action( 'dt_process_subscription_attributes', $post, $request ); + $response = new \WP_REST_Response(); $response->set_data( array( 'updated' => true ) ); diff --git a/includes/classes/ExternalConnections/WordPressExternalConnection.php b/includes/classes/ExternalConnections/WordPressExternalConnection.php index 7953258a2..cb3622207 100644 --- a/includes/classes/ExternalConnections/WordPressExternalConnection.php +++ b/includes/classes/ExternalConnections/WordPressExternalConnection.php @@ -887,8 +887,10 @@ private function to_wp_post( $post ) { if ( isset( $post['excerpt']['raw'] ) ) { $obj->post_excerpt = $post['excerpt']['raw']; - } else { + } elseif ( isset( $post['excerpt']['rendered'] ) ) { $obj->post_excerpt = $post['excerpt']['rendered']; + } else { + $obj->post_excerpt = ''; } $obj->post_status = 'draft'; diff --git a/includes/utils.php b/includes/utils.php index 2967a237b..5820f5959 100644 --- a/includes/utils.php +++ b/includes/utils.php @@ -147,6 +147,20 @@ function set_meta( $post_id, $meta ) { } } } + + /** + * Fires after Distributor sets post meta. + * + * Note: All sent meta is included in the `$meta` array, including blacklisted keys. + * Take care to continue to filter out blacklisted keys in any further meta setting. + * + * @param array $meta All received meta for the post + * @param array $existing_meta Existing meta for the post + * @param int $post_id Post ID + * + * @since 1.3.8 + */ + do_action( 'dt_after_set_meta', $meta, $existing_meta, $post_id ); } /** diff --git a/lang/distributor.pot b/lang/distributor.pot index 2c7e26b9e..6b1a52ad3 100644 --- a/lang/distributor.pot +++ b/lang/distributor.pot @@ -2,9 +2,9 @@ # This file is distributed under the GPLv2 or later. msgid "" msgstr "" -"Project-Id-Version: Distributor 1.3.7\n" +"Project-Id-Version: Distributor 1.3.8\n" "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/distributor\n" -"POT-Creation-Date: 2019-01-16 13:42:38+00:00\n" +"POT-Creation-Date: 2019-01-30 17:41:23+00:00\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=utf-8\n" "Content-Transfer-Encoding: 8bit\n" @@ -69,20 +69,20 @@ msgstr "" msgid "No post data for update." msgstr "" -#: includes/classes/API/SubscriptionsController.php:318 +#: includes/classes/API/SubscriptionsController.php:328 msgid "Sorry, you are not allowed to create subscriptions." msgstr "" -#: includes/classes/API/SubscriptionsController.php:333 +#: includes/classes/API/SubscriptionsController.php:343 msgid "Cannot create existing subscription." msgstr "" -#: includes/classes/API/SubscriptionsController.php:337 +#: includes/classes/API/SubscriptionsController.php:347 msgid "Subscription post does not exist." msgstr "" -#: includes/classes/API/SubscriptionsController.php:389 -#: includes/classes/API/SubscriptionsController.php:412 +#: includes/classes/API/SubscriptionsController.php:399 +#: includes/classes/API/SubscriptionsController.php:422 msgid "Invalid post ID." msgstr ""