Code Duplication    Length = 16-16 lines in 3 locations

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

@@ 416-431 (lines=16) @@
413
		// WPCOM Specific (Jetpack's will get bumped elsewhere
414
		// Tracks how many posts are published and sets meta
415
		// so we can track some other cool stats (like likes & comments on posts published)
416
		if ( defined( 'IS_WPCOM' ) && IS_WPCOM ) {
417
			if (
418
				( $new && 'publish' == $input['status'] )
419
				|| (
420
					! $new && isset( $last_status )
421
					&& 'publish' != $last_status
422
					&& isset( $new_status )
423
					&& 'publish' == $new_status
424
				)
425
			) {
426
				/** This action is documented in modules/widgets/social-media-icons.php */
427
				do_action( 'jetpack_bump_stats_extras', 'api-insights-posts', $this->api->token_details['client_id'] );
428
				update_post_meta( $post_id, '_rest_api_published', 1 );
429
				update_post_meta( $post_id, '_rest_api_client_id', $this->api->token_details['client_id'] );
430
			}
431
		}
432
433
434
		// 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

@@ 483-498 (lines=16) @@
480
		// WPCOM Specific (Jetpack's will get bumped elsewhere
481
		// Tracks how many posts are published and sets meta
482
		// so we can track some other cool stats (like likes & comments on posts published)
483
		if ( defined( 'IS_WPCOM' ) && IS_WPCOM ) {
484
			if (
485
				( $new && 'publish' == $input['status'] )
486
				|| (
487
					! $new && isset( $last_status )
488
					&& 'publish' != $last_status
489
					&& isset( $new_status )
490
					&& 'publish' == $new_status
491
				)
492
			) {
493
				/** This action is documented in modules/widgets/social-media-icons.php */
494
				do_action( 'jetpack_bump_stats_extras', 'api-insights-posts', $this->api->token_details['client_id'] );
495
				update_post_meta( $post_id, '_rest_api_published', 1 );
496
				update_post_meta( $post_id, '_rest_api_client_id', $this->api->token_details['client_id'] );
497
			}
498
		}
499
500
501
		// 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

@@ 484-499 (lines=16) @@
481
		// WPCOM Specific (Jetpack's will get bumped elsewhere
482
		// Tracks how many posts are published and sets meta
483
		// so we can track some other cool stats (like likes & comments on posts published)
484
		if ( defined( 'IS_WPCOM' ) && IS_WPCOM ) {
485
			if (
486
				( $new && 'publish' == $input['status'] )
487
				|| (
488
					!$new && isset( $last_status )
489
					&& 'publish' != $last_status
490
					&& isset( $new_status )
491
					&& 'publish' == $new_status
492
				)
493
			) {
494
				/** This action is documented in modules/widgets/social-media-icons.php */
495
				do_action( 'jetpack_bump_stats_extras', 'api-insights-posts', $this->api->token_details['client_id'] );
496
				update_post_meta( $post_id, '_rest_api_published', 1 );
497
				update_post_meta( $post_id, '_rest_api_client_id', $this->api->token_details['client_id'] );
498
			}
499
		}
500
501
502
		// We ask the user/dev to pass Publicize services he/she wants activated for the post, but Publicize expects us