| @@ 1789-1803 (lines=15) @@ | ||
| 1786 | } |
|
| 1787 | } |
|
| 1788 | ||
| 1789 | function is_post_type_allowed( $post_type ) { |
|
| 1790 | // if the post type is empty, that's fine, WordPress will default to post |
|
| 1791 | if ( empty( $post_type ) ) |
|
| 1792 | return true; |
|
| 1793 | ||
| 1794 | // allow special 'any' type |
|
| 1795 | if ( 'any' == $post_type ) |
|
| 1796 | return true; |
|
| 1797 | ||
| 1798 | // check for allowed types |
|
| 1799 | if ( in_array( $post_type, $this->_get_whitelisted_post_types() ) ) |
|
| 1800 | return true; |
|
| 1801 | ||
| 1802 | return false; |
|
| 1803 | } |
|
| 1804 | ||
| 1805 | /** |
|
| 1806 | * Gets the whitelisted post types that JP should allow access to. |
|
| @@ 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 | /** |
|