BJ Lazy Load - Version 0.7.5

Version Description

Also applies to text widgets

Download this release

Release Info

Developer bjornjohansen
Plugin Icon 128x128 BJ Lazy Load
Version 0.7.5
Comparing to
See all releases

Code changes from version 0.7.3 to 0.7.5

Files changed (3) hide show
  1. admin.php +6 -0
  2. bj-lazy-load.php +9 -5
  3. readme.txt +12 -3
admin.php CHANGED
@@ -19,6 +19,12 @@ class BJLL_Admin_Page extends scbAdminPage {
19
  'name' => 'filter_content',
20
  'value' => array( 'yes' => __( 'Yes', 'bj-lazy-load' ), 'no' => __( 'No', 'bj-lazy-load' ) ),
21
  ),
 
 
 
 
 
 
22
  array(
23
  'title' => __( 'Apply to post thumbnails', 'bj-lazy-load' ),
24
  'type' => 'radio',
19
  'name' => 'filter_content',
20
  'value' => array( 'yes' => __( 'Yes', 'bj-lazy-load' ), 'no' => __( 'No', 'bj-lazy-load' ) ),
21
  ),
22
+ array(
23
+ 'title' => __( 'Apply to text widgets', 'bj-lazy-load' ),
24
+ 'type' => 'radio',
25
+ 'name' => 'filter_widget_text',
26
+ 'value' => array( 'yes' => __( 'Yes', 'bj-lazy-load' ), 'no' => __( 'No', 'bj-lazy-load' ) ),
27
+ ),
28
  array(
29
  'title' => __( 'Apply to post thumbnails', 'bj-lazy-load' ),
30
  'type' => 'radio',
bj-lazy-load.php CHANGED
@@ -3,13 +3,13 @@
3
  Plugin Name: BJ Lazy Load
4
  Plugin URI: http://wordpress.org/extend/plugins/bj-lazy-load/
5
  Description: Lazy image loading makes your site load faster and saves bandwidth.
6
- Version: 0.7.3
7
  Author: Bjørn Johansen
8
  Author URI: http://twitter.com/bjornjohansen
9
  Text Domain: bj-lazy-load
10
  License: GPL2
11
 
12
- Copyright 2011–2013 Bjørn Johansen (email : post@bjornjohansen.no)
13
 
14
  This program is free software; you can redistribute it and/or modify
15
  it under the terms of the GNU General Public License, version 2, as
@@ -33,7 +33,7 @@ require_once( dirname(__FILE__) . '/inc/class-bjll-skip-post.php' );
33
  if ( ! class_exists( 'BJLL' ) ) {
34
  class BJLL {
35
 
36
- const version = '0.7.3';
37
  protected $_placeholder_url;
38
  protected $_skip_classes;
39
 
@@ -78,6 +78,9 @@ if ( ! class_exists( 'BJLL' ) ) {
78
  if ( $options->get( 'filter_content' ) == 'yes' ) {
79
  add_filter( 'the_content', array( $this, 'filter' ), 200 );
80
  }
 
 
 
81
  if ( $options->get( 'filter_post_thumbnails' ) == 'yes' ) {
82
  add_filter( 'post_thumbnail_html', array( $this, 'filter' ), 200 );
83
  }
@@ -181,8 +184,8 @@ if ( ! class_exists( 'BJLL' ) ) {
181
 
182
  foreach ( $matches[0] as $imgHTML ) {
183
 
184
- // don't to the replacement if a skip class is provided and the image has the class
185
- if ( ! ( is_array( $this->_skip_classes ) && preg_match( $skip_images_regex, $imgHTML ) ) ) {
186
  // replace the src and add the data-src attribute
187
  $replaceHTML = preg_replace( '/<img(.*?)src=/is', '<img$1src="' . $this->_placeholder_url . '" data-lazy-type="image" data-lazy-src=', $imgHTML );
188
 
@@ -237,6 +240,7 @@ if ( ! class_exists( 'BJLL' ) ) {
237
  protected static function _get_options() {
238
  return new scbOptions( 'bj_lazy_load_options', __FILE__, array(
239
  'filter_content' => 'yes',
 
240
  'filter_post_thumbnails' => 'yes',
241
  'filter_gravatars' => 'yes',
242
  'lazy_load_images' => 'yes',
3
  Plugin Name: BJ Lazy Load
4
  Plugin URI: http://wordpress.org/extend/plugins/bj-lazy-load/
5
  Description: Lazy image loading makes your site load faster and saves bandwidth.
6
+ Version: 0.7.5
7
  Author: Bjørn Johansen
8
  Author URI: http://twitter.com/bjornjohansen
9
  Text Domain: bj-lazy-load
10
  License: GPL2
11
 
12
+ Copyright 2011–2014 Bjørn Johansen (email : post@bjornjohansen.no)
13
 
14
  This program is free software; you can redistribute it and/or modify
15
  it under the terms of the GNU General Public License, version 2, as
33
  if ( ! class_exists( 'BJLL' ) ) {
34
  class BJLL {
35
 
36
+ const version = '0.7.5';
37
  protected $_placeholder_url;
38
  protected $_skip_classes;
39
 
78
  if ( $options->get( 'filter_content' ) == 'yes' ) {
79
  add_filter( 'the_content', array( $this, 'filter' ), 200 );
80
  }
81
+ if ( $options->get( 'filter_widget_text' ) == 'yes' ) {
82
+ add_filter( 'widget_text', array( $this, 'filter' ), 200 );
83
+ }
84
  if ( $options->get( 'filter_post_thumbnails' ) == 'yes' ) {
85
  add_filter( 'post_thumbnail_html', array( $this, 'filter' ), 200 );
86
  }
184
 
185
  foreach ( $matches[0] as $imgHTML ) {
186
 
187
+ // don't to the replacement if a skip class is provided and the image has the class, or if the image is a data-uri
188
+ if ( ! ( is_array( $this->_skip_classes ) && preg_match( $skip_images_regex, $imgHTML ) ) && ! preg_match( "/src=['\"]data:image/is", $imgHTML ) ) {
189
  // replace the src and add the data-src attribute
190
  $replaceHTML = preg_replace( '/<img(.*?)src=/is', '<img$1src="' . $this->_placeholder_url . '" data-lazy-type="image" data-lazy-src=', $imgHTML );
191
 
240
  protected static function _get_options() {
241
  return new scbOptions( 'bj_lazy_load_options', __FILE__, array(
242
  'filter_content' => 'yes',
243
+ 'filter_widget_text' => 'yes',
244
  'filter_post_thumbnails' => 'yes',
245
  'filter_gravatars' => 'yes',
246
  'lazy_load_images' => 'yes',
readme.txt CHANGED
@@ -4,15 +4,15 @@ Donate link: http://www.kiva.org/
4
  Tags: images, iframes, lazy loading, jquery, javascript, optimize, performance, bandwidth, responsive design, hidpi, retina
5
  Author URI: http://twitter.com/bjornjohansen
6
  Requires at least: 3.5
7
- Tested up to: 4.0
8
- Stable tag: 0.7.3
9
 
10
  Lazy loading makes your site load faster and saves bandwidth. Uses jQuery and degrades gracefully for non-js users. Works with both images and iframes.
11
 
12
  == Description ==
13
  Lazy loading makes your site load faster and saves bandwidth.
14
 
15
- This plugin replaces all your post images, post thumbnails, gravatar images and content iframes with a placeholder and loads the content as it gets close to enter the browser window when the visitor scrolls the page.
16
 
17
  You can also lazy load other images and iframes in your theme, by using a simple function.
18
 
@@ -62,6 +62,12 @@ Check your HTML source or see the magic at work in Web Inspector, FireBug or sim
62
 
63
  == Changelog ==
64
 
 
 
 
 
 
 
65
  = Version 0.7.3 =
66
  * Works with newlines in the HTML string for the IMG element
67
 
@@ -193,6 +199,9 @@ Check your HTML source or see the magic at work in Web Inspector, FireBug or sim
193
 
194
  == Upgrade Notice ==
195
 
 
 
 
196
  = 0.7.2 =
197
  Improved minification compability
198
 
4
  Tags: images, iframes, lazy loading, jquery, javascript, optimize, performance, bandwidth, responsive design, hidpi, retina
5
  Author URI: http://twitter.com/bjornjohansen
6
  Requires at least: 3.5
7
+ Tested up to: 4.3
8
+ Stable tag: 0.7.5
9
 
10
  Lazy loading makes your site load faster and saves bandwidth. Uses jQuery and degrades gracefully for non-js users. Works with both images and iframes.
11
 
12
  == Description ==
13
  Lazy loading makes your site load faster and saves bandwidth.
14
 
15
+ This plugin replaces all your post images, post thumbnails, gravatar images and content iframes with a placeholder and loads the content as it gets close to enter the browser window when the visitor scrolls the page. Also works with text widgets.
16
 
17
  You can also lazy load other images and iframes in your theme, by using a simple function.
18
 
62
 
63
  == Changelog ==
64
 
65
+ = Version 0.7.5 =
66
+ * Also applies to text widgets (Thanks to Sigurður Guðbrandsson)
67
+
68
+ = Version 0.7.4 =
69
+ * Skips lazy loading of data-URIs
70
+
71
  = Version 0.7.3 =
72
  * Works with newlines in the HTML string for the IMG element
73
 
199
 
200
  == Upgrade Notice ==
201
 
202
+ = 0.7.5 =
203
+ Also applies to text widgets
204
+
205
  = 0.7.2 =
206
  Improved minification compability
207