Code Duplication    Length = 17-17 lines in 2 locations

modules/sharedaddy/sharing.php 1 location

@@ 592-608 (lines=17) @@
589
 * @uses register_rest_field
590
 * @link https://developer.wordpress.org/rest-api/extending-the-rest-api/modifying-responses/
591
 */
592
function jetpack_post_sharing_register_rest_field() {
593
	$post_types = get_post_types( array( 'public' => true ) );
594
	foreach ( $post_types as $post_type ) {
595
		register_rest_field(
596
			$post_type,
597
			'jetpack_sharing_enabled',
598
			array(
599
				'get_callback'    => 'jetpack_post_sharing_get_value',
600
				'update_callback' => 'jetpack_post_sharing_update_value',
601
				'schema'          => array(
602
					'description' => __( 'Are sharing buttons enabled?', 'jetpack' ),
603
					'type'        => 'boolean',
604
				),
605
			)
606
		);
607
	}
608
}
609
610
// Add Sharing post_meta to the REST API Post response.
611
add_action( 'rest_api_init', 'jetpack_post_sharing_register_rest_field' );

modules/likes.php 1 location

@@ 614-630 (lines=17) @@
611
 * @uses register_rest_field
612
 * @link https://developer.wordpress.org/rest-api/extending-the-rest-api/modifying-responses/
613
 */
614
function jetpack_post_likes_register_rest_field() {
615
	$post_types = get_post_types( array( 'public' => true ) );
616
	foreach ( $post_types as $post_type ) {
617
		register_rest_field(
618
			$post_type,
619
			'jetpack_likes_enabled',
620
			array(
621
				'get_callback'    => 'jetpack_post_likes_get_value',
622
				'update_callback' => 'jetpack_post_likes_update_value',
623
				'schema'          => array(
624
					'description' => __( 'Are Likes enabled?', 'jetpack' ),
625
					'type'        => 'boolean',
626
				),
627
			)
628
		);
629
	}
630
}
631
632
// Add Likes post_meta to the REST API Post response.
633
add_action( 'rest_api_init', 'jetpack_post_likes_register_rest_field' );