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

@@ 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.