|
@@ 180-187 (lines=8) @@
|
| 177 |
|
* |
| 178 |
|
* @return void |
| 179 |
|
*/ |
| 180 |
|
public function setup_filters() { |
| 181 |
|
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. |
| 182 |
|
add_filter( 'post_thumbnail_html', array( $this, 'add_image_placeholders' ), PHP_INT_MAX ); |
| 183 |
|
add_filter( 'get_avatar', array( $this, 'add_image_placeholders' ), PHP_INT_MAX ); |
| 184 |
|
add_filter( 'widget_text', array( $this, 'add_image_placeholders' ), PHP_INT_MAX ); |
| 185 |
|
add_filter( 'get_image_tag', array( $this, 'add_image_placeholders' ), PHP_INT_MAX ); |
| 186 |
|
add_filter( 'wp_get_attachment_image_attributes', array( __CLASS__, 'process_image_attributes' ), PHP_INT_MAX ); |
| 187 |
|
} |
| 188 |
|
|
| 189 |
|
/** |
| 190 |
|
* Remove filters. |
|
@@ 196-203 (lines=8) @@
|
| 193 |
|
* |
| 194 |
|
* @return void |
| 195 |
|
*/ |
| 196 |
|
public function remove_filters() { |
| 197 |
|
remove_filter( 'the_content', array( $this, 'add_image_placeholders' ), PHP_INT_MAX ); |
| 198 |
|
remove_filter( 'post_thumbnail_html', array( $this, 'add_image_placeholders' ), PHP_INT_MAX ); |
| 199 |
|
remove_filter( 'get_avatar', array( $this, 'add_image_placeholders' ), PHP_INT_MAX ); |
| 200 |
|
remove_filter( 'widget_text', array( $this, 'add_image_placeholders' ), PHP_INT_MAX ); |
| 201 |
|
remove_filter( 'get_image_tag', array( $this, 'add_image_placeholders' ), PHP_INT_MAX ); |
| 202 |
|
remove_filter( 'wp_get_attachment_image_attributes', array( __CLASS__, 'process_image_attributes' ), PHP_INT_MAX ); |
| 203 |
|
} |
| 204 |
|
|
| 205 |
|
/** |
| 206 |
|
* Ensure that our lazy image attributes are not filtered out of image tags. |