| @@ -4,8 +4,12 @@ | ||
| 4 | 4 | * |
| 5 | 5 | * @package automattic/jetpack |
| 6 | 6 | */ |
| 7 | 7 | |
| 8 | +if ( ! defined( 'ABSPATH' ) ) { | |
| 9 | + exit( 0 ); | |
| 10 | +} | |
| 11 | + | |
| 8 | 12 | /** |
| 9 | 13 | * Base class for WPCOM_JSON_API_Metadata |
| 10 | 14 | */ |
| 11 | 15 | class WPCOM_JSON_API_Metadata { |
| @@ -30,13 +34,13 @@ | ||
| 30 | 34 | if ( in_array( $key, apply_filters( 'rest_api_allowed_public_metadata', $whitelisted_meta ), true ) ) { |
| 31 | 35 | return true; |
| 32 | 36 | } |
| 33 | 37 | |
| 34 | - if ( 0 === strpos( $key, 'geo_' ) ) { | |
| 38 | + if ( str_starts_with( $key, 'geo_' ) ) { | |
| 35 | 39 | return true; |
| 36 | 40 | } |
| 37 | 41 | |
| 38 | - if ( 0 === strpos( $key, '_wpas_' ) ) { | |
| 42 | + if ( str_starts_with( $key, '_wpas_' ) ) { | |
| 39 | 43 | return true; |
| 40 | 44 | } |
| 41 | 45 | |
| 42 | 46 | return false; |
| @@ -58,8 +62,9 @@ | ||
| 58 | 62 | // display the correct newsletter access in Calypso. |
| 59 | 63 | $whitelist = array( |
| 60 | 64 | '_jetpack_newsletter_access', |
| 61 | 65 | '_jetpack_newsletter_tier_id', |
| 66 | + '_jetpack_dont_email_post_to_subs', | |
| 62 | 67 | ); |
| 63 | 68 | |
| 64 | 69 | if ( in_array( $key, $whitelist, true ) ) { |
| 65 | 70 | return false; |
| @@ -64,13 +69,13 @@ | ||
| 64 | 69 | if ( in_array( $key, $whitelist, true ) ) { |
| 65 | 70 | return false; |
| 66 | 71 | } |
| 67 | 72 | |
| 68 | - if ( 0 === strpos( $key, '_jetpack_' ) ) { | |
| 73 | + if ( str_starts_with( $key, '_jetpack_' ) ) { | |
| 69 | 74 | return true; |
| 70 | 75 | } |
| 71 | 76 | |
| 72 | - if ( 0 === strpos( $key, '_elasticsearch_' ) ) { | |
| 77 | + if ( str_starts_with( $key, '_elasticsearch_' ) ) { | |
| 73 | 78 | return true; |
| 74 | 79 | } |
| 75 | 80 | |
| 76 | 81 | return false; |