Completed
Push — add/plugin_name ( 40fc07 )
by
unknown
11:13
created

Jetpack_Sync_Module_Plugins::name()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
c 0
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
3
class Jetpack_Sync_Module_Plugins extends Jetpack_Sync_Module {
4
5
	public function name() {
6
		return 'plugins';
7
	}
8
9
	public function init_listeners( $callable ) {
10
		add_action( 'deleted_plugin', $callable, 10, 2 );
11
		add_action( 'activated_plugin', $callable, 10, 2 );
12
		add_action( 'deactivated_plugin', $callable, 10, 2 );
13
	}
14
15
	public function init_before_send() {
16
		add_filter( 'jetpack_sync_before_send_deleted_plugin', array( $this, 'expand_plugin_data' ) );
17
		add_filter( 'jetpack_sync_before_send_activated_plugin', array( $this, 'expand_plugin_data' ) );
18
		add_filter( 'jetpack_sync_before_send_deactivated_plugin', array( $this, 'expand_plugin_data' ) );
19
	}
20
21
	public function expand_plugin_data( $args ) {
22
		$plugin_data = get_plugin_data( $args[0] );
23
		return array( $args[0], $args[1], $plugin_data );
24
	}
25
}
26