PluginProbe
Jetpack – WP Security, Backup, Speed, & Growth / 6.2
Jetpack – WP Security, Backup, Speed, & Growth v6.2
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-attachments.php
class.jetpack-sync-module-attachments.php
44 lines 1.3 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_Attachments extends Jetpack_Sync_Module {
4 function name() {
5 return 'attachments';
6 }
7
8 public function init_listeners( $callable ) {
9 add_action( 'edit_attachment', array( $this, 'send_attachment_info' ) );
10 // Once we don't have to support 4.3 we can start using add_action( 'attachment_updated', $handler, 10, 3 ); instead
11 add_action( 'add_attachment', array( $this, 'send_attachment_info' ) );
12 add_action( 'jetpack_sync_save_update_attachment', $callable, 10, 2 );
13 add_action( 'jetpack_sync_save_add_attachment', $callable, 10, 2 );
14 }
15
16 function send_attachment_info( $attachment_id ) {
17 $attachment = get_post( $attachment_id );
18 if ( 'add_attachment' === current_filter() ) {
19 /**
20 * Fires when the client needs to sync an new attachment
21 *
22 * @since 4.2.0
23 *
24 * @param int The attachment ID
25 * @param object The attachment
26 */
27 do_action( 'jetpack_sync_save_add_attachment', $attachment_id, $attachment );
28 } else {
29 /**
30 * Fires when the client needs to sync an updated attachment
31 *
32 * @since 4.9.0
33 *
34 * @param int The attachment ID
35 * @param object The attachment
36 *
37 * Previously this action was synced using jetpack_sync_save_add_attachment action.
38 */
39 do_action( 'jetpack_sync_save_update_attachment', $attachment_id, $attachment );
40 }
41
42 }
43 }
44