Code Duplication    Length = 15-15 lines in 2 locations

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

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

class.json-api-endpoints.php 1 location

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