Code Duplication    Length = 5-5 lines in 3 locations

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

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

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

@@ 129-133 (lines=5) @@
126
		}
127
128
		// If date was 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

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