Code Duplication    Length = 5-5 lines in 3 locations

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

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

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

@@ 150-154 (lines=5) @@
147
		}
148
149
		// If date was set, $this->input will set date_gmt, date still needs to be adjusted for the blog's offset
150
		if ( isset( $input['date_gmt'] ) ) {
151
			$gmt_offset = get_option( 'gmt_offset' );
152
			$time_with_offset = strtotime( $input['date_gmt'] ) + $gmt_offset * HOUR_IN_SECONDS;
153
			$input['date'] = date( 'Y-m-d H:i:s', $time_with_offset );
154
		}
155
156
		if ( ! empty( $author_id ) && get_current_user_id() != $author_id ) {
157
			if ( ! current_user_can( $post_type->cap->edit_others_posts ) ) {

json-endpoints/class.wpcom-json-api-update-post-v1-2-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 f
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 ) ) {