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

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