PluginProbe
Jetpack – WP Security, Backup, Speed, & Growth / 4.2.5
Jetpack – WP Security, Backup, Speed, & Growth v4.2.5
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 / sync / class.jetpack-sync-module-meta.php
class.jetpack-sync-module-meta.php
39 lines 1.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 class Jetpack_Sync_Module_Meta extends Jetpack_Sync_Module {
4 private $meta_types = array( 'post', 'comment' );
5
6 public function name() {
7 return 'meta';
8 }
9
10 public function init_listeners( $callable ) {
11 $whitelist_handler = array( $this, 'filter_meta' );
12
13 foreach ( $this->meta_types as $meta_type ) {
14 add_action( "added_{$meta_type}_meta", $callable, 10, 4 );
15 add_action( "updated_{$meta_type}_meta", $callable, 10, 4 );
16 add_action( "deleted_{$meta_type}_meta", $callable, 10, 4 );
17
18 add_filter( "jetpack_sync_before_enqueue_added_{$meta_type}_meta", $whitelist_handler );
19 add_filter( "jetpack_sync_before_enqueue_updated_{$meta_type}_meta", $whitelist_handler );
20 add_filter( "jetpack_sync_before_enqueue_deleted_{$meta_type}_meta", $whitelist_handler );
21 }
22 }
23
24 function filter_meta( $args ) {
25 if ( '_' === $args[2][0] &&
26 ! in_array( $args[2], Jetpack_Sync_Defaults::$default_whitelist_meta_keys ) &&
27 ! wp_startswith( $args[2], '_wpas_skip_' )
28 ) {
29 return false;
30 }
31
32 if ( in_array( $args[2], Jetpack_Sync_Settings::get_setting( 'meta_blacklist' ) ) ) {
33 return false;
34 }
35
36 return $args;
37 }
38 }
39