PluginProbe
Jetpack – WP Security, Backup, Speed, & Growth / 7.1
Jetpack – WP Security, Backup, Speed, & Growth v7.1
16.2-beta 12.0.3 12.1.3 12.2.3 12.3.2 12.4.2 12.5.2 12.6.4 12.7.3 12.8.3 12.9.5 13.0.2 13.1.5 13.2.4 13.3.3 13.4.5 13.5.2 13.6.2 13.7.2 13.8.3 13.9.2 14.0.1 14.1.1 14.2.2 14.3.1 All 501 releases
jetpack / sal / class.json-api-metadata.php

class.json-api-metadata.php in Jetpack – WP Security, Backup, Speed, & Growth 7.1, at sal/class.json-api-metadata.php

39 lines 859 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * Utility classes that don't necessarily have a home yet
5 */
6
7 class WPCOM_JSON_API_Metadata {
8 public static function is_public( $key ) {
9 if ( empty( $key ) )
10 return false;
11
12 // Default whitelisted meta keys.
13 $whitelisted_meta = array( '_thumbnail_id' );
14
15 // whitelist of metadata that can be accessed
16 /** This filter is documented in json-endpoints/class.wpcom-json-api-post-endpoint.php */
17 if ( in_array( $key, apply_filters( 'rest_api_allowed_public_metadata', $whitelisted_meta ) ) )
18 return true;
19
20 if ( 0 === strpos( $key, 'geo_' ) )
21 return true;
22
23 if ( 0 === strpos( $key, '_wpas_' ) )
24 return true;
25
26 return false;
27 }
28
29 public static function is_internal_only( $key ) {
30
31 if ( 0 === strpos( $key, '_jetpack_') )
32 return true;
33
34 if ( 0 === strpos( $key, '_elasticsearch_') )
35 return true;
36
37 return false;
38 }
39 }