| @@ 68-95 (lines=28) @@ | ||
| 65 | parent::__construct( $args ); |
|
| 66 | } |
|
| 67 | ||
| 68 | function is_metadata_public( $key ) { |
|
| 69 | if ( empty( $key ) ) |
|
| 70 | return false; |
|
| 71 | ||
| 72 | // Default whitelisted meta keys. |
|
| 73 | $whitelisted_meta = array( '_thumbnail_id' ); |
|
| 74 | ||
| 75 | /** |
|
| 76 | * Filters the meta keys accessible by the REST API. |
|
| 77 | * @see https://developer.wordpress.com/2013/04/26/custom-post-type-and-metadata-support-in-the-rest-api/ |
|
| 78 | * |
|
| 79 | * @module json-api |
|
| 80 | * |
|
| 81 | * @since 2.2.3 |
|
| 82 | * |
|
| 83 | * @param array $whitelisted_meta Array of metadata that is accessible by the REST API. |
|
| 84 | */ |
|
| 85 | if ( in_array( $key, apply_filters( 'rest_api_allowed_public_metadata', $whitelisted_meta ) ) ) |
|
| 86 | return true; |
|
| 87 | ||
| 88 | if ( 0 === strpos( $key, 'geo_' ) ) |
|
| 89 | return true; |
|
| 90 | ||
| 91 | if ( 0 === strpos( $key, '_wpas_' ) ) |
|
| 92 | return true; |
|
| 93 | ||
| 94 | return false; |
|
| 95 | } |
|
| 96 | ||
| 97 | function the_password_form() { |
|
| 98 | return __( 'This post is password protected.', 'jetpack' ); |
|
| @@ 69-88 (lines=20) @@ | ||
| 66 | parent::__construct( $args ); |
|
| 67 | } |
|
| 68 | ||
| 69 | function is_metadata_public( $key ) { |
|
| 70 | if ( empty( $key ) ) |
|
| 71 | return false; |
|
| 72 | ||
| 73 | // Default whitelisted meta keys. |
|
| 74 | $whitelisted_meta = array( '_thumbnail_id' ); |
|
| 75 | ||
| 76 | // whitelist of metadata that can be accessed |
|
| 77 | /** This filter is documented in json-endpoints/class.wpcom-json-api-post-endpoint.php */ |
|
| 78 | if ( in_array( $key, apply_filters( 'rest_api_allowed_public_metadata', $whitelisted_meta ) ) ) |
|
| 79 | return true; |
|
| 80 | ||
| 81 | if ( 0 === strpos( $key, 'geo_' ) ) |
|
| 82 | return true; |
|
| 83 | ||
| 84 | if ( 0 === strpos( $key, '_wpas_' ) ) |
|
| 85 | return true; |
|
| 86 | ||
| 87 | return false; |
|
| 88 | } |
|
| 89 | ||
| 90 | function the_password_form() { |
|
| 91 | return __( 'This post is password protected.', 'jetpack' ); |
|