| Conditions | 5 |
| Paths | 5 |
| Total Lines | 20 |
| Code Lines | 11 |
| Lines | 20 |
| Ratio | 100 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 8 | View Code Duplication | 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 | |||
| 39 | } |