Code Duplication    Length = 3-5 lines in 2 locations

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

@@ 151-153 (lines=3) @@
148
			return new WP_Error( 'unknown_post', 'Unknown post', 404 );
149
		}
150
151
		if ( ! $this->is_post_type_allowed( $post->post_type ) && ( ! function_exists( 'is_post_freshly_pressed' ) || ! is_post_freshly_pressed( $post->ID ) ) ) {
152
			return new WP_Error( 'unknown_post', 'Unknown post', 404 );
153
		}
154
155
		// Permissions
156
		$capabilities = $this->get_current_user_capabilities( $post );

sal/class.json-api-site-base.php 1 location

@@ 122-126 (lines=5) @@
119
	private function validate_access( $post ) {
120
		$context = $post->context;
121
122
		if ( ! $this->is_post_type_allowed( $post->post_type ) 
123
			&& 
124
			( ! function_exists( 'is_post_freshly_pressed' ) || ! is_post_freshly_pressed( $post->ID ) ) ) {
125
			return new WP_Error( 'unknown_post', 'Unknown post', 404 );
126
		}
127
128
		switch ( $context ) {
129
		case 'edit' :