Completed
Push — update/non-admin-view ( b1ee9d...762240 )
by
unknown
10:19
created

Jetpack_Sync_Module_Themes   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 3
Bugs 0 Features 0
Metric Value
c 3
b 0
f 0
dl 0
loc 39
rs 10
wmc 6
lcom 0
cbo 2

4 Methods

Rating   Name   Duplication   Size   Complexity  
B enqueue_full_sync_actions() 0 24 3
A get_full_sync_actions() 0 3 1
A name() 0 3 1
A init_listeners() 0 4 1
1
<?php
2
3
class Jetpack_Sync_Module_Themes extends Jetpack_Sync_Module {
4
	function name() {
5
		return 'themes';
6
	}
7
8
	public function init_listeners( $handler ) {
9
		add_action( 'switch_theme', array( $this, 'enqueue_full_sync_actions' ) );
10
		add_action( 'jetpack_sync_current_theme_support', $handler, 10 );
11
	}
12
13
	function enqueue_full_sync_actions() {
14
		global $_wp_theme_features;
15
16
		$theme_support = array();
17
18
		foreach ( Jetpack_Sync_Defaults::$default_theme_support_whitelist as $theme_feature ) {
0 ignored issues
show
Bug introduced by
The property default_theme_support_whitelist cannot be accessed from this context as it is declared private in class Jetpack_Sync_Defaults.

This check looks for access to properties that are not accessible from the current context.

If you need to make a property accessible to another context you can either raise its visibility level or provide an accessible getter in the defining class.

Loading history...
19
			$has_support = current_theme_supports( $theme_feature );
20
			if ( $has_support ) {
21
				$theme_support[ $theme_feature ] = $_wp_theme_features[ $theme_feature ];
22
			}
23
24
		}
25
26
		/**
27
		 * Fires when the client needs to sync theme support info
28
		 * Only sends theme support attributes whitelisted in Jetpack_Sync_Defaults::$default_theme_support_whitelist
29
		 *
30
		 * @since 4.2.0
31
		 *
32
		 * @param object the theme support hash
33
		 */
34
		do_action( 'jetpack_sync_current_theme_support', $theme_support );
35
		return 1; // The number of actions enqueued
36
	}
37
38
	function get_full_sync_actions() {
39
		return array( 'jetpack_sync_current_theme_support' );
40
	}
41
}
42