summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnthony G. Basile <blueness@gentoo.org>2016-08-23 20:02:23 -0400
committerAnthony G. Basile <blueness@gentoo.org>2016-08-23 20:02:50 -0400
commitad3f35663e4e2b80a92166b590d3e2052b5aab91 (patch)
tree94f987efbdb50e1426956c1c04ac459a19c77e53 /plugins/jetpack/sync/class.jetpack-sync-module-meta.php
parentbin/update-wordpress: also update twentyfourteen twentyfifteen twentysixteen (diff)
downloadblogs-gentoo-ad3f35663e4e2b80a92166b590d3e2052b5aab91.tar.gz
blogs-gentoo-ad3f35663e4e2b80a92166b590d3e2052b5aab91.tar.bz2
blogs-gentoo-ad3f35663e4e2b80a92166b590d3e2052b5aab91.zip
Update plugin jetpack to 4.2.2
Diffstat (limited to 'plugins/jetpack/sync/class.jetpack-sync-module-meta.php')
-rw-r--r--plugins/jetpack/sync/class.jetpack-sync-module-meta.php38
1 files changed, 38 insertions, 0 deletions
diff --git a/plugins/jetpack/sync/class.jetpack-sync-module-meta.php b/plugins/jetpack/sync/class.jetpack-sync-module-meta.php
new file mode 100644
index 00000000..5fff16a3
--- /dev/null
+++ b/plugins/jetpack/sync/class.jetpack-sync-module-meta.php
@@ -0,0 +1,38 @@
+<?php
+
+class Jetpack_Sync_Module_Meta extends Jetpack_Sync_Module {
+ private $meta_types = array( 'post', 'comment' );
+
+ public function name() {
+ return 'meta';
+ }
+
+ public function init_listeners( $callable ) {
+ $whitelist_handler = array( $this, 'filter_meta' );
+
+ foreach ( $this->meta_types as $meta_type ) {
+ add_action( "added_{$meta_type}_meta", $callable, 10, 4 );
+ add_action( "updated_{$meta_type}_meta", $callable, 10, 4 );
+ add_action( "deleted_{$meta_type}_meta", $callable, 10, 4 );
+
+ add_filter( "jetpack_sync_before_enqueue_added_{$meta_type}_meta", $whitelist_handler );
+ add_filter( "jetpack_sync_before_enqueue_updated_{$meta_type}_meta", $whitelist_handler );
+ add_filter( "jetpack_sync_before_enqueue_deleted_{$meta_type}_meta", $whitelist_handler );
+ }
+ }
+
+ function filter_meta( $args ) {
+ if ( '_' === $args[2][0] &&
+ ! in_array( $args[2], Jetpack_Sync_Defaults::$default_whitelist_meta_keys ) &&
+ ! wp_startswith( $args[2], '_wpas_skip_' )
+ ) {
+ return false;
+ }
+
+ if ( in_array( $args[2], Jetpack_Sync_Settings::get_setting( 'meta_blacklist' ) ) ) {
+ return false;
+ }
+
+ return $args;
+ }
+}