1 | <?php |
||
3 | class Jetpack_Sync_Module_Terms extends Jetpack_Sync_Module { |
||
4 | private $taxonomy_whitelist; |
||
5 | |||
6 | function name() { |
||
7 | return 'terms'; |
||
8 | } |
||
9 | |||
10 | function init_listeners( $callable ) { |
||
11 | add_action( 'created_term', array( $this, 'save_term_handler' ), 10, 3 ); |
||
12 | add_action( 'edited_term', array( $this, 'save_term_handler' ), 10, 3 ); |
||
13 | add_action( 'jetpack_sync_save_term', $callable, 10, 4 ); |
||
14 | add_action( 'delete_term', $callable, 10, 4 ); |
||
15 | add_action( 'set_object_terms', $callable, 10, 6 ); |
||
16 | add_action( 'deleted_term_relationships', $callable, 10, 2 ); |
||
17 | |||
18 | //full sync |
||
19 | add_action( 'jetpack_full_sync_terms', $callable, 10, 2 ); |
||
20 | } |
||
21 | |||
22 | function init_before_send() { |
||
26 | |||
27 | function enqueue_full_sync_actions() { |
||
47 | |||
48 | function get_full_sync_actions() { |
||
51 | |||
52 | function save_term_handler( $term_id, $tt_id, $taxonomy ) { |
||
53 | if ( class_exists( 'WP_Term' ) ) { |
||
54 | $term_object = WP_Term::get_instance( $term_id, $taxonomy ); |
||
55 | } else { |
||
56 | $term_object = get_term_by( 'id', $term_id, $taxonomy ); |
||
57 | } |
||
58 | |||
59 | /** |
||
60 | * Fires when the client needs to sync a new term |
||
61 | * |
||
62 | * @since 4.2.0 |
||
63 | * |
||
64 | * @param object the Term object |
||
65 | */ |
||
66 | do_action( 'jetpack_sync_save_term', $term_object ); |
||
67 | } |
||
68 | |||
69 | function set_taxonomy_whitelist( $taxonomies ) { |
||
70 | $this->taxonomy_whitelist = $taxonomies; |
||
71 | } |
||
72 | |||
73 | function set_defaults() { |
||
74 | $this->taxonomy_whitelist = Jetpack_Sync_Defaults::$default_taxonomy_whitelist; |
||
|
|||
75 | } |
||
76 | |||
77 | public function expand_term_ids( $args ) { |
||
97 | } |
||
98 |
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.