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

@@ 1541-1555 (lines=15) @@
1538
		}
1539
	}
1540
1541
	function is_post_type_allowed( $post_type ) {
1542
		// if the post type is empty, that's fine, WordPress will default to post
1543
		if ( empty( $post_type ) )
1544
			return true;
1545
1546
		// allow special 'any' type
1547
		if ( 'any' == $post_type )
1548
			return true;
1549
1550
		// check for allowed types
1551
		if ( in_array( $post_type, $this->_get_whitelisted_post_types() ) )
1552
			return true;
1553
1554
		return false;
1555
	}
1556
1557
	/**
1558
	 * Gets the whitelisted post types that JP should allow access to.