summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/jetpack/json-endpoints/class.wpcom-json-api-update-post-v1-2-endpoint.php')
-rw-r--r--plugins/jetpack/json-endpoints/class.wpcom-json-api-update-post-v1-2-endpoint.php14
1 files changed, 5 insertions, 9 deletions
diff --git a/plugins/jetpack/json-endpoints/class.wpcom-json-api-update-post-v1-2-endpoint.php b/plugins/jetpack/json-endpoints/class.wpcom-json-api-update-post-v1-2-endpoint.php
index 4ad5e26c..113766a1 100644
--- a/plugins/jetpack/json-endpoints/class.wpcom-json-api-update-post-v1-2-endpoint.php
+++ b/plugins/jetpack/json-endpoints/class.wpcom-json-api-update-post-v1-2-endpoint.php
@@ -518,7 +518,7 @@ class WPCOM_JSON_API_Update_Post_v1_2_Endpoint extends WPCOM_JSON_API_Update_Pos
default :
// Several images - 3 column gallery
$insert['post_content'] = $input['content'] = sprintf(
- "[gallery ids='%s']\n\n",
+ "[gallery ids='%s']\n\n",
$media_id_string
) . $input['content'];
break;
@@ -586,7 +586,7 @@ class WPCOM_JSON_API_Update_Post_v1_2_Endpoint extends WPCOM_JSON_API_Update_Pos
if ( $new ) {
if ( $sitewide_likes_enabled ) {
if ( false === $likes ) {
- update_post_meta( $post_id, 'switch_like_status', 1 );
+ update_post_meta( $post_id, 'switch_like_status', 0 );
} else {
delete_post_meta( $post_id, 'switch_like_status' );
}
@@ -601,7 +601,7 @@ class WPCOM_JSON_API_Update_Post_v1_2_Endpoint extends WPCOM_JSON_API_Update_Pos
if ( isset( $likes ) ) {
if ( $sitewide_likes_enabled ) {
if ( false === $likes ) {
- update_post_meta( $post_id, 'switch_like_status', 1 );
+ update_post_meta( $post_id, 'switch_like_status', 0 );
} else {
delete_post_meta( $post_id, 'switch_like_status' );
}
@@ -796,7 +796,6 @@ class WPCOM_JSON_API_Update_Post_v1_2_Endpoint extends WPCOM_JSON_API_Update_Pos
switch ( $meta->operation ) {
case 'delete':
-
if ( ! empty( $meta->id ) && ! empty( $existing_meta_item->meta_key ) && current_user_can( 'delete_post_meta', $post_id, $unslashed_existing_meta_key ) ) {
delete_metadata_by_mid( 'post', $meta->id );
} elseif ( ! empty( $meta->key ) && ! empty( $meta->previous_value ) && current_user_can( 'delete_post_meta', $post_id, $unslashed_meta_key ) ) {
@@ -807,18 +806,16 @@ class WPCOM_JSON_API_Update_Post_v1_2_Endpoint extends WPCOM_JSON_API_Update_Pos
break;
case 'add':
-
if ( ! empty( $meta->id ) || ! empty( $meta->previous_value ) ) {
- continue;
+ break;
} elseif ( ! empty( $meta->key ) && ! empty( $meta->value ) && ( current_user_can( 'add_post_meta', $post_id, $unslashed_meta_key ) ) || WPCOM_JSON_API_Metadata::is_public( $meta->key ) ) {
add_post_meta( $post_id, $meta->key, $meta->value );
}
break;
case 'update':
-
if ( ! isset( $meta->value ) ) {
- continue;
+ break;
} elseif ( ! empty( $meta->id ) && ! empty( $existing_meta_item->meta_key ) && ( current_user_can( 'edit_post_meta', $post_id, $unslashed_existing_meta_key ) || WPCOM_JSON_API_Metadata::is_public( $meta->key ) ) ) {
update_metadata_by_mid( 'post', $meta->id, $meta->value );
} elseif ( ! empty( $meta->key ) && ! empty( $meta->previous_value ) && ( current_user_can( 'edit_post_meta', $post_id, $unslashed_meta_key ) || WPCOM_JSON_API_Metadata::is_public( $meta->key ) ) ) {
@@ -829,7 +826,6 @@ class WPCOM_JSON_API_Update_Post_v1_2_Endpoint extends WPCOM_JSON_API_Update_Pos
break;
}
-
}
}