@@ 52-59 (lines=8) @@ | ||
49 | add_filter( 'wp_kses_allowed_html', array( $this, 'allow_lazy_attributes' ) ); |
|
50 | } |
|
51 | ||
52 | public function setup_filters() { |
|
53 | 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 |
|
54 | add_filter( 'post_thumbnail_html', array( $this, 'add_image_placeholders' ), PHP_INT_MAX ); |
|
55 | add_filter( 'get_avatar', array( $this, 'add_image_placeholders' ), PHP_INT_MAX ); |
|
56 | add_filter( 'widget_text', array( $this, 'add_image_placeholders' ), PHP_INT_MAX ); |
|
57 | add_filter( 'get_image_tag', array( $this, 'add_image_placeholders' ), PHP_INT_MAX); |
|
58 | add_filter( 'wp_get_attachment_image_attributes', array( __CLASS__, 'process_image_attributes' ), PHP_INT_MAX ); |
|
59 | } |
|
60 | ||
61 | public function remove_filters() { |
|
62 | remove_filter( 'the_content', array( $this, 'add_image_placeholders' ), PHP_INT_MAX ); |
|
@@ 61-68 (lines=8) @@ | ||
58 | add_filter( 'wp_get_attachment_image_attributes', array( __CLASS__, 'process_image_attributes' ), PHP_INT_MAX ); |
|
59 | } |
|
60 | ||
61 | public function remove_filters() { |
|
62 | remove_filter( 'the_content', array( $this, 'add_image_placeholders' ), PHP_INT_MAX ); |
|
63 | remove_filter( 'post_thumbnail_html', array( $this, 'add_image_placeholders' ), PHP_INT_MAX ); |
|
64 | remove_filter( 'get_avatar', array( $this, 'add_image_placeholders' ), PHP_INT_MAX ); |
|
65 | remove_filter( 'widget_text', array( $this, 'add_image_placeholders' ), PHP_INT_MAX ); |
|
66 | remove_filter( 'get_image_tag', array( $this, 'add_image_placeholders' ), PHP_INT_MAX); |
|
67 | remove_filter( 'wp_get_attachment_image_attributes', array( __CLASS__, 'process_image_attributes' ), PHP_INT_MAX ); |
|
68 | } |
|
69 | ||
70 | /** |
|
71 | * Ensure that our lazy image attributes are not filtered out of image tags. |