Code Duplication    Length = 5-7 lines in 4 locations

json-endpoints/class.wpcom-json-api-update-post-endpoint.php 1 location

@@ 682-688 (lines=7) @@
679
			}
680
		}
681
682
		if ( ! is_null( $publicize_custom_message ) ) {
683
			if ( empty( $publicize_custom_message ) ) {
684
				delete_post_meta( $post_id, $GLOBALS['publicize_ui']->publicize->POST_MESS );
685
			} else {
686
				update_post_meta( $post_id, $GLOBALS['publicize_ui']->publicize->POST_MESS, trim( $publicize_custom_message ) );
687
			}
688
		}
689
690
		if ( ! empty( $insert['post_format'] ) ) {
691
			if ( 'default' !== strtolower( $insert['post_format'] ) ) {

json-endpoints/class.wpcom-json-api-update-post-v1-1-endpoint.php 1 location

@@ 761-767 (lines=7) @@
758
			}
759
		}
760
761
		if ( ! is_null( $publicize_custom_message ) ) {
762
			if ( empty( $publicize_custom_message ) ) {
763
				delete_post_meta( $post_id, $GLOBALS['publicize_ui']->publicize->POST_MESS );
764
			} else {
765
				update_post_meta( $post_id, $GLOBALS['publicize_ui']->publicize->POST_MESS, trim( $publicize_custom_message ) );
766
			}
767
		}
768
769
		if ( ! empty( $insert['post_format'] ) ) {
770
			if ( 'default' !== strtolower( $insert['post_format'] ) ) {

json-endpoints/class.wpcom-json-api-update-post-v1-2-endpoint.php 1 location

@@ 732-738 (lines=7) @@
729
			}
730
		}
731
732
		if ( ! is_null( $publicize_custom_message ) ) {
733
			if ( empty( $publicize_custom_message ) ) {
734
				delete_post_meta( $post_id, $GLOBALS['publicize_ui']->publicize->POST_MESS );
735
			} else {
736
				update_post_meta( $post_id, $GLOBALS['publicize_ui']->publicize->POST_MESS, trim( $publicize_custom_message ) );
737
			}
738
		}
739
740
		if ( ! empty( $insert['post_format'] ) ) {
741
			if ( 'default' !== strtolower( $insert['post_format'] ) ) {

modules/publicize/class-jetpack-publicize-gutenberg.php 1 location

@@ 190-194 (lines=5) @@
187
188
			$publicize_field = $request['publicize'];
189
190
			if ( empty( $publicize_field['title'] ) ) {
191
				delete_post_meta( $post->ID, $publicize->POST_MESS );
192
			} else {
193
				update_post_meta( $post->ID, $publicize->POST_MESS, trim( stripslashes( $publicize_field['title'] ) ) );
194
			}
195
			if ( isset( $publicize_field['connections'] ) ) {
196
				foreach ( (array) $publicize->get_services( 'connected' ) as $service_name => $connections ) {
197
					foreach ( $connections as $connection ) {