@@ 138-145 (lines=8) @@ | ||
135 | * |
|
136 | * @return void |
|
137 | */ |
|
138 | public function setup_filters() { |
|
139 | 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. |
|
140 | add_filter( 'post_thumbnail_html', array( $this, 'add_image_placeholders' ), PHP_INT_MAX ); |
|
141 | add_filter( 'get_avatar', array( $this, 'add_image_placeholders' ), PHP_INT_MAX ); |
|
142 | add_filter( 'widget_text', array( $this, 'add_image_placeholders' ), PHP_INT_MAX ); |
|
143 | add_filter( 'get_image_tag', array( $this, 'add_image_placeholders' ), PHP_INT_MAX ); |
|
144 | add_filter( 'wp_get_attachment_image_attributes', array( __CLASS__, 'process_image_attributes' ), PHP_INT_MAX ); |
|
145 | } |
|
146 | ||
147 | /** |
|
148 | * Remove filters. |
|
@@ 154-161 (lines=8) @@ | ||
151 | * |
|
152 | * @return void |
|
153 | */ |
|
154 | public function remove_filters() { |
|
155 | remove_filter( 'the_content', array( $this, 'add_image_placeholders' ), PHP_INT_MAX ); |
|
156 | remove_filter( 'post_thumbnail_html', array( $this, 'add_image_placeholders' ), PHP_INT_MAX ); |
|
157 | remove_filter( 'get_avatar', array( $this, 'add_image_placeholders' ), PHP_INT_MAX ); |
|
158 | remove_filter( 'widget_text', array( $this, 'add_image_placeholders' ), PHP_INT_MAX ); |
|
159 | remove_filter( 'get_image_tag', array( $this, 'add_image_placeholders' ), PHP_INT_MAX ); |
|
160 | remove_filter( 'wp_get_attachment_image_attributes', array( __CLASS__, 'process_image_attributes' ), PHP_INT_MAX ); |
|
161 | } |
|
162 | ||
163 | /** |
|
164 | * Ensure that our lazy image attributes are not filtered out of image tags. |