Code Duplication    Length = 15-15 lines in 2 locations

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

@@ 155-169 (lines=15) @@
152
	}
153
154
	// copied from class.json-api-endpoints.php
155
	private function is_post_type_allowed( $post_type ) {
156
		// if the post type is empty, that's fine, WordPress will default to post
157
		if ( empty( $post_type ) )
158
			return true;
159
160
		// allow special 'any' type
161
		if ( 'any' == $post_type )
162
			return true;
163
164
		// check for allowed types
165
		if ( in_array( $post_type, $this->_get_whitelisted_post_types() ) )
166
			return true;
167
168
		return false;
169
	}
170
171
	// copied from class.json-api-endpoints.php
172
	/**

class.json-api-endpoints.php 1 location

@@ 1554-1568 (lines=15) @@
1551
		}
1552
	}
1553
1554
	function is_post_type_allowed( $post_type ) {
1555
		// if the post type is empty, that's fine, WordPress will default to post
1556
		if ( empty( $post_type ) )
1557
			return true;
1558
1559
		// allow special 'any' type
1560
		if ( 'any' == $post_type )
1561
			return true;
1562
1563
		// check for allowed types
1564
		if ( in_array( $post_type, $this->_get_whitelisted_post_types() ) )
1565
			return true;
1566
1567
		return false;
1568
	}
1569
1570
	/**
1571
	 * Gets the whitelisted post types that JP should allow access to.