Code Duplication    Length = 5-5 lines in 3 locations

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

@@ 124-128 (lines=5) @@
121
		}
122
123
		// If date is set, $this->input will set date_gmt, date still needs to be adjusted for the blog's offset
124
		if ( isset( $input['date_gmt'] ) ) {
125
			$gmt_offset = get_option( 'gmt_offset' );
126
			$time_with_offset = strtotime( $input['date_gmt'] ) + $gmt_offset * HOUR_IN_SECONDS;
127
			$input['date'] = date( 'Y-m-d H:i:s', $time_with_offset );
128
		}
129
130
		if ( ! empty( $author_id ) && get_current_user_id() != $author_id ) {
131
			if ( ! current_user_can( $post_type->cap->edit_others_posts ) ) {

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

@@ 129-133 (lines=5) @@
126
		}
127
128
		// If date is set, $this->input will set date_gmt, date still needs to be adjusted for the blog's offset
129
		if ( isset( $input['date_gmt'] ) ) {
130
			$gmt_offset = get_option( 'gmt_offset' );
131
			$time_with_offset = strtotime( $input['date_gmt'] ) + $gmt_offset * HOUR_IN_SECONDS;
132
			$input['date'] = date( 'Y-m-d H:i:s', $time_with_offset );
133
		}
134
135
		if ( ! empty( $author_id ) && get_current_user_id() != $author_id ) {
136
			if ( ! current_user_can( $post_type->cap->edit_others_posts ) ) {

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

@@ 104-108 (lines=5) @@
101
		}
102
103
		// If date is set, $this->input will set date_gmt, date still needs to be adjusted for the blog's offset
104
		if ( isset( $input['date_gmt'] ) ) {
105
			$gmt_offset = get_option( 'gmt_offset' );
106
			$time_with_offset = strtotime( $input['date_gmt'] ) + $gmt_offset * HOUR_IN_SECONDS;
107
			$input['date'] = date( 'Y-m-d H:i:s', $time_with_offset );
108
		}
109
110
		if ( ! empty( $author_id ) && get_current_user_id() != $author_id ) {
111
			if ( ! current_user_can( $post_type->cap->edit_others_posts ) ) {