Code Duplication    Length = 5-5 lines in 3 locations

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

@@ 322-326 (lines=5) @@
319
		}
320
321
		// If date was set, $this->input will set date_gmt, date still needs to be adjusted for the blog's offset
322
		if ( isset( $input['date_gmt'] ) ) {
323
			$gmt_offset = get_option( 'gmt_offset' );
324
			$time_with_offset = strtotime( $input['date_gmt'] ) + $gmt_offset * HOUR_IN_SECONDS;
325
			$input['date'] = date( 'Y-m-d H:i:s', $time_with_offset );
326
		}
327
328
		if ( ! empty( $author_id ) && get_current_user_id() != $author_id ) {
329
			if ( ! current_user_can( $post_type->cap->edit_others_posts ) ) {

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

@@ 345-349 (lines=5) @@
342
		}
343
344
		// If date was set, $this->input will set date_gmt, date still needs to be adjusted for the blog's offset
345
		if ( isset( $input['date_gmt'] ) ) {
346
			$gmt_offset = get_option( 'gmt_offset' );
347
			$time_with_offset = strtotime( $input['date_gmt'] ) + $gmt_offset * HOUR_IN_SECONDS;
348
			$input['date'] = date( 'Y-m-d H:i:s', $time_with_offset );
349
		}
350
351
		if ( ! empty( $author_id ) && get_current_user_id() != $author_id ) {
352
			if ( ! current_user_can( $post_type->cap->edit_others_posts ) ) {

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

@@ 289-293 (lines=5) @@
286
		}
287
288
		 // If date is set, $this->input will set date_gmt, date still needs to be adjusted f
289
		if ( isset( $input['date_gmt'] ) ) {
290
			$gmt_offset = get_option( 'gmt_offset' );
291
			$time_with_offset = strtotime( $input['date_gmt'] ) + $gmt_offset * HOUR_IN_SECONDS;
292
			$input['date'] = date( 'Y-m-d H:i:s', $time_with_offset );
293
		}
294
295
		if ( ! empty( $author_id ) && get_current_user_id() != $author_id ) {
296
			if ( ! current_user_can( $post_type->cap->edit_others_posts ) ) {