PluginProbe
Jetpack – WP Security, Backup, Speed, & Growth / 16.3-a.1
Jetpack – WP Security, Backup, Speed, & Growth v16.3-a.1
16.3-a.3 16.3-a.1 16.2 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 All 504 releases
← All changes | sal/class.json-api-metadata.php +18 -6 12.5.216.3-a.1 View file →
@@ -3,8 +3,13 @@
3 3 * WPCOM_JSON_API_Metadata class - Utility classes that don't necessarily have a home yet.
4 4 *
5 5 * @package automattic/jetpack
6 6 */
7 +
8 +if ( ! defined( 'ABSPATH' ) ) {
9 + exit( 0 );
10 +}
11 +
7 12 /**
8 13 * Base class for WPCOM_JSON_API_Metadata
9 14 */
10 15 class WPCOM_JSON_API_Metadata {
@@ -29,13 +34,13 @@
29 34 if ( in_array( $key, apply_filters( 'rest_api_allowed_public_metadata', $whitelisted_meta ), true ) ) {
30 35 return true;
31 36 }
32 37
33 - if ( 0 === strpos( $key, 'geo_' ) ) {
38 + if ( str_starts_with( $key, 'geo_' ) ) {
34 39 return true;
35 40 }
36 41
37 - if ( 0 === strpos( $key, '_wpas_' ) ) {
42 + if ( str_starts_with( $key, '_wpas_' ) ) {
38 43 return true;
39 44 }
40 45
41 46 return false;
@@ -52,18 +57,25 @@
52 57 if ( $key === '_jetpack_blogging_prompt_key' ) {
53 58 return false;
54 59 }
55 60
56 - // We want to always return the `_jetpack_newsletter_access` key to display the correct newsletter access in Calypso.
57 - if ( $key === '_jetpack_newsletter_access' ) {
61 + // We want to always return the `_jetpack_newsletter_access` key to
62 + // display the correct newsletter access in Calypso.
63 + $whitelist = array(
64 + '_jetpack_newsletter_access',
65 + '_jetpack_newsletter_tier_id',
66 + '_jetpack_dont_email_post_to_subs',
67 + );
68 +
69 + if ( in_array( $key, $whitelist, true ) ) {
58 70 return false;
59 71 }
60 72
61 - if ( 0 === strpos( $key, '_jetpack_' ) ) {
73 + if ( str_starts_with( $key, '_jetpack_' ) ) {
62 74 return true;
63 75 }
64 76
65 - if ( 0 === strpos( $key, '_elasticsearch_' ) ) {
77 + if ( str_starts_with( $key, '_elasticsearch_' ) ) {
66 78 return true;
67 79 }
68 80
69 81 return false;