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-attachments.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-attachments.php')
-rw-r--r--plugins/jetpack/sync/class.jetpack-sync-module-attachments.php28
1 files changed, 28 insertions, 0 deletions
diff --git a/plugins/jetpack/sync/class.jetpack-sync-module-attachments.php b/plugins/jetpack/sync/class.jetpack-sync-module-attachments.php
new file mode 100644
index 00000000..4cee033e
--- /dev/null
+++ b/plugins/jetpack/sync/class.jetpack-sync-module-attachments.php
@@ -0,0 +1,28 @@
+<?php
+
+class Jetpack_Sync_Module_Attachments extends Jetpack_Sync_Module {
+ function name() {
+ return 'attachments';
+ }
+
+ public function init_listeners( $callable ) {
+ add_action( 'edit_attachment', array( $this, 'send_attachment_info' ) );
+ // Once we don't have to support 4.3 we can start using add_action( 'attachment_updated', $handler, 10, 3 ); instead
+ add_action( 'add_attachment', array( $this, 'send_attachment_info' ) );
+ add_action( 'jetpack_sync_save_add_attachment', $callable, 10, 2 );
+ }
+
+ function send_attachment_info( $attachment_id ) {
+ $attachment = get_post( $attachment_id );
+
+ /**
+ * Fires when the client needs to sync an attachment for a post
+ *
+ * @since 4.2.0
+ *
+ * @param int The attachment ID
+ * @param object The attachment
+ */
+ do_action( 'jetpack_sync_save_add_attachment', $attachment_id, $attachment );
+ }
+}