Code Duplication    Length = 9-9 lines in 2 locations

php/class-widget-cache.php 2 locations

@@ 13-21 (lines=9) @@
10
	/**
11
	 * @inheritDoc
12
	 */
13
	public function enable() {
14
15
		if ( is_admin() ) {
16
			add_filter( 'widget_update_callback', array( $this, 'widget_update_callback' ) );
17
			add_action( 'wp_ajax_update-widget', array( $this, 'update_widget' ), 0 );
18
		} else {
19
			add_filter( 'widget_display_callback', array( $this, 'widget_display_callback' ), 10, 3 );
20
		}
21
	}
22
23
	/**
24
	 * @inheritDoc
@@ 26-34 (lines=9) @@
23
	/**
24
	 * @inheritDoc
25
	 */
26
	public function disable() {
27
28
		if ( is_admin() ) {
29
			remove_filter( 'widget_update_callback', array( $this, 'widget_update_callback' ) );
30
			remove_action( 'wp_ajax_update-widget', array( $this, 'update_widget' ), 0 );
31
		} else {
32
			remove_filter( 'widget_display_callback', array( $this, 'widget_display_callback' ), 10 );
33
		}
34
	}
35
36
	/**
37
	 * Adds timestamp to widget instance to use as salt.