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

@@ 1527-1541 (lines=15) @@
1524
		}
1525
	}
1526
1527
	function is_post_type_allowed( $post_type ) {
1528
		// if the post type is empty, that's fine, WordPress will default to post
1529
		if ( empty( $post_type ) )
1530
			return true;
1531
1532
		// allow special 'any' type
1533
		if ( 'any' == $post_type )
1534
			return true;
1535
1536
		// check for allowed types
1537
		if ( in_array( $post_type, $this->_get_whitelisted_post_types() ) )
1538
			return true;
1539
1540
		return false;
1541
	}
1542
1543
	/**
1544
	 * Gets the whitelisted post types that JP should allow access to.