Code Duplication    Length = 8-8 lines in 2 locations

modules/lazy-images/lazy-images.php 2 locations

@@ 59-66 (lines=8) @@
56
		add_action( 'wp_head', array( $this, 'add_nojs_fallback' ) );
57
	}
58
59
	public function setup_filters() {
60
		add_filter( 'the_content', array( $this, 'add_image_placeholders' ), PHP_INT_MAX ); // run this later, so other content filters have run, including image_add_wh on WP.com
61
		add_filter( 'post_thumbnail_html', array( $this, 'add_image_placeholders' ), PHP_INT_MAX );
62
		add_filter( 'get_avatar', array( $this, 'add_image_placeholders' ), PHP_INT_MAX );
63
		add_filter( 'widget_text', array( $this, 'add_image_placeholders' ), PHP_INT_MAX );
64
		add_filter( 'get_image_tag', array( $this, 'add_image_placeholders' ), PHP_INT_MAX);
65
		add_filter( 'wp_get_attachment_image_attributes', array( __CLASS__, 'process_image_attributes' ), PHP_INT_MAX );
66
	}
67
68
	public function remove_filters() {
69
		remove_filter( 'the_content', array( $this, 'add_image_placeholders' ), PHP_INT_MAX );
@@ 68-75 (lines=8) @@
65
		add_filter( 'wp_get_attachment_image_attributes', array( __CLASS__, 'process_image_attributes' ), PHP_INT_MAX );
66
	}
67
68
	public function remove_filters() {
69
		remove_filter( 'the_content', array( $this, 'add_image_placeholders' ), PHP_INT_MAX );
70
		remove_filter( 'post_thumbnail_html', array( $this, 'add_image_placeholders' ), PHP_INT_MAX );
71
		remove_filter( 'get_avatar', array( $this, 'add_image_placeholders' ), PHP_INT_MAX );
72
		remove_filter( 'widget_text', array( $this, 'add_image_placeholders' ), PHP_INT_MAX );
73
		remove_filter( 'get_image_tag', array( $this, 'add_image_placeholders' ), PHP_INT_MAX);
74
		remove_filter( 'wp_get_attachment_image_attributes', array( __CLASS__, 'process_image_attributes' ), PHP_INT_MAX );
75
	}
76
77
	/**
78
	 * Ensure that our lazy image attributes are not filtered out of image tags.