Skip to content

Commit

Permalink
Merge pull request #890 from amalajith/fix/issue-889
Browse files Browse the repository at this point in the history
Fix issue 889 - Unicode characters not escaped
  • Loading branch information
peterwilsoncc authored Jul 21, 2022
2 parents 25b2642 + c609b53 commit 6cab43d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,7 @@ public function pull( $items ) {
* @return {array} The post data to be inserted.
*/
$new_post_args = Utils\post_args_allow_list( apply_filters( 'dt_pull_post_args', $post_array, $item_array['remote_post_id'], $post, $this ) );
$new_post = wp_insert_post( $new_post_args );
$new_post = wp_insert_post( wp_slash( $new_post_args ) );

update_post_meta( $new_post, 'dt_original_post_id', (int) $item_array['remote_post_id'] );
update_post_meta( $new_post, 'dt_original_source_id', (int) $this->id );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public function push( $post_id, $args = array() ) {
add_filter( 'wp_insert_post_data', array( '\Distributor\InternalConnections\NetworkSiteConnection', 'maybe_set_modified_date' ), 10, 2 );
// Filter documented in includes/classes/ExternalConnections/WordPressExternalConnection.php
$new_post_args = Utils\post_args_allow_list( apply_filters( 'dt_push_post_args', $new_post_args, $post, $args, $this ) );
$new_post_id = wp_insert_post( $new_post_args );
$new_post_id = wp_insert_post( wp_slash( $new_post_args ) );

remove_filter( 'wp_insert_post_data', array( '\Distributor\InternalConnections\NetworkSiteConnection', 'maybe_set_modified_date' ), 10, 2 );

Expand Down Expand Up @@ -269,7 +269,7 @@ public function pull( $items ) {

// Filter documented in includes/classes/ExternalConnections/WordPressExternalConnection.php
$new_post_args = Utils\post_args_allow_list( apply_filters( 'dt_pull_post_args', $post_array, $item_array['remote_post_id'], $post, $this ) );
$new_post_id = wp_insert_post( $new_post_args );
$new_post_id = wp_insert_post( wp_slash( $new_post_args ) );

remove_filter( 'wp_insert_post_data', array( '\Distributor\InternalConnections\NetworkSiteConnection', 'maybe_set_modified_date' ), 10, 2 );

Expand Down
2 changes: 2 additions & 0 deletions tests/php/NetworkSiteConnectionsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ public function test_push() {
\WP_Mock::userFunction( 'get_the_title' );
\WP_Mock::userFunction( 'remove_filter' );
\WP_Mock::userFunction( 'get_option' );
\WP_Mock::passthruFunction( 'wp_slash' );

$this->connection_obj->site->blog_id = 2;

Expand Down Expand Up @@ -153,6 +154,7 @@ public function test_pull() {
\WP_Mock::userFunction( 'restore_current_blog' );
\WP_Mock::userFunction( 'get_current_blog_id' );
\WP_Mock::userFunction( 'remove_filter' );
\WP_Mock::passthruFunction( 'wp_slash' );

\WP_Mock::userFunction(
'get_post', [
Expand Down

0 comments on commit 6cab43d

Please sign in to comment.