Code Duplication    Length = 13-13 lines in 3 locations

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

@@ 580-592 (lines=13) @@
577
		}
578
579
		// Set sharing status of the post
580
		if ( $new ) {
581
			$sharing_enabled = isset( $sharing ) ? (bool) $sharing : true;
582
			if ( false === $sharing_enabled ) {
583
				update_post_meta( $post_id, 'sharing_disabled', 1 );
584
			}
585
		}
586
		else {
587
			if ( isset( $sharing ) && true === $sharing ) {
588
				delete_post_meta( $post_id, 'sharing_disabled' );
589
			} else if ( isset( $sharing ) && false == $sharing ) {
590
				update_post_meta( $post_id, 'sharing_disabled', 1 );
591
			}
592
		}
593
594
		if ( isset( $sticky ) ) {
595
			if ( true === $sticky ) {

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

@@ 653-665 (lines=13) @@
650
		}
651
652
		// Set sharing status of the post
653
		if ( $new ) {
654
			$sharing_enabled = isset( $sharing ) ? (bool) $sharing : true;
655
			if ( false === $sharing_enabled ) {
656
				update_post_meta( $post_id, 'sharing_disabled', 1 );
657
			}
658
		}
659
		else {
660
			if ( isset( $sharing ) && true === $sharing ) {
661
				delete_post_meta( $post_id, 'sharing_disabled' );
662
			} else if ( isset( $sharing ) && false == $sharing ) {
663
				update_post_meta( $post_id, 'sharing_disabled', 1 );
664
			}
665
		}
666
667
		if ( isset( $sticky ) ) {
668
			if ( true === $sticky ) {

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

@@ 624-636 (lines=13) @@
621
		}
622
623
		// Set sharing status of the post
624
		if ( $new ) {
625
			$sharing_enabled = isset( $sharing ) ? (bool) $sharing : true;
626
			if ( false === $sharing_enabled ) {
627
				update_post_meta( $post_id, 'sharing_disabled', 1 );
628
			}
629
		}
630
		else {
631
			if ( isset( $sharing ) && true === $sharing ) {
632
				delete_post_meta( $post_id, 'sharing_disabled' );
633
			} else if ( isset( $sharing ) && false == $sharing ) {
634
				update_post_meta( $post_id, 'sharing_disabled', 1 );
635
			}
636
		}
637
638
		if ( isset( $sticky ) ) {
639
			if ( true === $sticky ) {