Code Duplication    Length = 16-16 lines in 3 locations

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

@@ 397-412 (lines=16) @@
394
		// WPCOM Specific (Jetpack's will get bumped elsewhere
395
		// Tracks how many posts are published and sets meta
396
		// so we can track some other cool stats (like likes & comments on posts published)
397
		if ( defined( 'IS_WPCOM' ) && IS_WPCOM ) {
398
			if (
399
				( $new && 'publish' == $input['status'] )
400
				|| (
401
					! $new && isset( $last_status )
402
					&& 'publish' != $last_status
403
					&& isset( $new_status )
404
					&& 'publish' == $new_status
405
				)
406
			) {
407
				/** This action is documented in modules/widgets/social-media-icons.php */
408
				do_action( 'jetpack_bump_stats_extras', 'api-insights-posts', $this->api->token_details['client_id'] );
409
				update_post_meta( $post_id, '_rest_api_published', 1 );
410
				update_post_meta( $post_id, '_rest_api_client_id', $this->api->token_details['client_id'] );
411
			}
412
		}
413
414
415
		// We ask the user/dev to pass Publicize services he/she wants activated for the post, but Publicize expects us

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

@@ 410-425 (lines=16) @@
407
		// WPCOM Specific (Jetpack's will get bumped elsewhere
408
		// Tracks how many posts are published and sets meta
409
		// so we can track some other cool stats (like likes & comments on posts published)
410
		if ( defined( 'IS_WPCOM' ) && IS_WPCOM ) {
411
			if (
412
				( $new && 'publish' == $input['status'] )
413
				|| (
414
					! $new && isset( $last_status )
415
					&& 'publish' != $last_status
416
					&& isset( $new_status )
417
					&& 'publish' == $new_status
418
				)
419
			) {
420
				/** This action is documented in modules/widgets/social-media-icons.php */
421
				do_action( 'jetpack_bump_stats_extras', 'api-insights-posts', $this->api->token_details['client_id'] );
422
				update_post_meta( $post_id, '_rest_api_published', 1 );
423
				update_post_meta( $post_id, '_rest_api_client_id', $this->api->token_details['client_id'] );
424
			}
425
		}
426
427
428
		// We ask the user/dev to pass Publicize services he/she wants activated for the post, but Publicize expects us

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

@@ 410-425 (lines=16) @@
407
		// WPCOM Specific (Jetpack's will get bumped elsewhere
408
		// Tracks how many posts are published and sets meta
409
		// so we can track some other cool stats (like likes & comments on posts published)
410
		if ( defined( 'IS_WPCOM' ) && IS_WPCOM ) {
411
			if (
412
				( $new && 'publish' == $input['status'] )
413
				|| (
414
					!$new && isset( $last_status )
415
					&& 'publish' != $last_status
416
					&& isset( $new_status )
417
					&& 'publish' == $new_status
418
				)
419
			) {
420
				/** This action is documented in modules/widgets/social-media-icons.php */
421
				do_action( 'jetpack_bump_stats_extras', 'api-insights-posts', $this->api->token_details['client_id'] );
422
				update_post_meta( $post_id, '_rest_api_published', 1 );
423
				update_post_meta( $post_id, '_rest_api_client_id', $this->api->token_details['client_id'] );
424
			}
425
		}
426
427
428
		// We ask the user/dev to pass Publicize services he/she wants activated for the post, but Publicize expects us