| @@ 1791-1805 (lines=15) @@ | ||
| 1788 | } |
|
| 1789 | } |
|
| 1790 | ||
| 1791 | function is_post_type_allowed( $post_type ) { |
|
| 1792 | // if the post type is empty, that's fine, WordPress will default to post |
|
| 1793 | if ( empty( $post_type ) ) |
|
| 1794 | return true; |
|
| 1795 | ||
| 1796 | // allow special 'any' type |
|
| 1797 | if ( 'any' == $post_type ) |
|
| 1798 | return true; |
|
| 1799 | ||
| 1800 | // check for allowed types |
|
| 1801 | if ( in_array( $post_type, $this->_get_whitelisted_post_types() ) ) |
|
| 1802 | return true; |
|
| 1803 | ||
| 1804 | return false; |
|
| 1805 | } |
|
| 1806 | ||
| 1807 | /** |
|
| 1808 | * Gets the whitelisted post types that JP should allow access to. |
|
| @@ 142-156 (lines=15) @@ | ||
| 139 | } |
|
| 140 | ||
| 141 | // copied from class.json-api-endpoints.php |
|
| 142 | private function is_post_type_allowed( $post_type ) { |
|
| 143 | // if the post type is empty, that's fine, WordPress will default to post |
|
| 144 | if ( empty( $post_type ) ) |
|
| 145 | return true; |
|
| 146 | ||
| 147 | // allow special 'any' type |
|
| 148 | if ( 'any' == $post_type ) |
|
| 149 | return true; |
|
| 150 | ||
| 151 | // check for allowed types |
|
| 152 | if ( in_array( $post_type, $this->_get_whitelisted_post_types() ) ) |
|
| 153 | return true; |
|
| 154 | ||
| 155 | return false; |
|
| 156 | } |
|
| 157 | ||
| 158 | // copied from class.json-api-endpoints.php |
|
| 159 | /** |
|