Skip to content

Commit ba809c5

Browse files
committed
Release new version 2.0.0
= 2.0.0 - 2019/11/19 = * This feature release has a lot. PHP is upgraded to Composer PHP Dependency Manager, Compatibility with Jetpack Accelerator, a full security review, and compatibility with with WordPress 5.3.0 * Feature - Plugin fully refactored to Composer for cleaner and faster PHP code * Feature - Add Jetpack Accelerator (Proton CDN images) compatibility. Props [@ KZeni](https://github.com/KZeni) * Tweak - Define new option box so that you can turn ON|OFF Jetpack Compatibility * Tweak - Remove the hard coded PHP error_reporting display errors false from compile sass to css * Tweak - Test for compatibility with WordPress 5.3.0 * Tweak - Support for backward compatibility for 3rd party plugin use some functions from old class A3_Lazy_Load * Tweak - Allow the "skip" class to have single or double quotes. Props [@joneslloyd](https://github.com/joneslloyd) * Dev - Support new filter tag 'a3_lazy_load_placeholder_url' for change value of placeholder_url Props [@joneslloyd](https://github.com/joneslloyd) * Dev - Support new filter tag 'a3_lazy_load_iframe_placeholder_url' for change value of iframe_placeholder_url * Dev - Replace file_get_contents with HTTP API wp_remote_get * Dev - Ensure that all inputs are sanitized and all outputs are escaped
1 parent b35ffeb commit ba809c5

23 files changed

+1151
-225
lines changed

a3-lazy-load.php

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22
/*
33
Plugin Name: a3 Lazy Load
44
Description: Speed up your site and enhance frontend user's visual experience in PC's, Tablets and mobile with a3 Lazy Load.
5-
Version: 1.9.3
5+
Version: 2.0.0
66
Author: a3rev Software
77
Author URI: https://a3rev.com/
88
Requires at least: 4.0
9-
Tested up to: 5.2.2
9+
Tested up to: 5.3.0
1010
Text Domain: a3-lazy-load
1111
Domain Path: /languages
1212
WC requires at least: 2.0.0
13-
WC tested up to: 3.6.4
13+
WC tested up to: 3.8.0
1414
License: GPLv2 or later
1515
Copyright © 2011 a3 Revolution Software Development team
1616
a3 Revolution Software Development team
@@ -32,9 +32,19 @@
3232
define('A3_LAZY_LOAD_IMAGES_URL', A3_LAZY_LOAD_URL . '/assets/images');
3333

3434
define( 'A3_LAZY_LOAD_KEY', 'a3_lazy_load' );
35-
define( 'A3_LAZY_VERSION', '1.9.3' );
35+
define( 'A3_LAZY_VERSION', '2.0.0' );
3636
define( 'A3_LAZY_LOAD_G_FONTS', false );
3737

38+
if ( version_compare( PHP_VERSION, '5.6.0', '>=' ) ) {
39+
require __DIR__ . '/vendor/autoload.php';
40+
41+
global $a3_lazy_load_excludes;
42+
$a3_lazy_load_excludes = new \A3Rev\LazyLoad\Excludes();
43+
44+
} else {
45+
return;
46+
}
47+
3848
/**
3949
* Load Localisation files.
4050
*
@@ -60,13 +70,12 @@ function a3_lazy_load_plugin_textdomain() {
6070

6171
include( 'admin/admin-pages/admin-settings-page.php' );
6272

73+
// Backwards compatibility for 3rd party plugin use functions from this plugin
74+
include( 'classes/classes-backwards-compatibility.php' );
75+
6376
include( 'admin/admin-init.php' );
6477
include( 'admin/less/sass.php' );
6578

66-
include( 'classes/class-a3-lazy-load-excludes.php' );
67-
include( 'classes/class-a3-lazy-load.php' );
68-
include( 'classes/class-a3-lazy-load-filter.php' );
69-
7079
include( 'admin/a3-lazy-load-admin.php' );
7180

7281
// Defined this function for check Lazy Load is enabled that 3rd party plugins or theme can use to check
@@ -91,5 +100,3 @@ function a3_lazy_load_video_enable() {
91100
* Call when the plugin is activated
92101
*/
93102
register_activation_hook(__FILE__, 'a3_lazy_load_activated');
94-
95-
?>

admin/a3-lazy-load-admin.php

Lines changed: 28 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,22 +31,45 @@ function a3_lazy_load_init() {
3131
$a3_lazy_load_admin_init->init();
3232

3333
// Add upgrade notice to Dashboard pages
34-
add_filter( $a3_lazy_load_admin_init->plugin_name . '_plugin_extension_boxes', array( 'A3_Lazy_Load_Hook_Filter', 'plugin_extension_box' ) );
34+
add_filter( $a3_lazy_load_admin_init->plugin_name . '_plugin_extension_boxes', array( '\A3Rev\LazyLoad\Hook_Filter', 'plugin_extension_box' ) );
3535

3636
// Add language
3737
add_action('init', 'a3_lazy_load_init', 105);
3838

3939
// Add custom style to dashboard
40-
add_action( 'admin_enqueue_scripts', array( 'A3_Lazy_Load_Hook_Filter', 'a3_wp_admin' ) );
40+
add_action( 'admin_enqueue_scripts', array( '\A3Rev\LazyLoad\Hook_Filter', 'a3_wp_admin' ) );
4141

4242
// Add extra link on left of Deactivate link on Plugin manager page
43-
add_action( 'plugin_action_links_'.A3_LAZY_LOAD_NAME, array( 'A3_Lazy_Load_Hook_Filter', 'settings_plugin_links' ) );
43+
add_action( 'plugin_action_links_'.A3_LAZY_LOAD_NAME, array( '\A3Rev\LazyLoad\Hook_Filter', 'settings_plugin_links' ) );
4444

4545
// Add text on right of Visit the plugin on Plugin manager page
46-
add_filter( 'plugin_row_meta', array( 'A3_Lazy_Load_Hook_Filter', 'plugin_extra_links'), 10, 2 );
46+
add_filter( 'plugin_row_meta', array( '\A3Rev\LazyLoad\Hook_Filter', 'plugin_extra_links'), 10, 2 );
4747

4848
// Add admin sidebar menu css
49-
add_action( 'admin_enqueue_scripts', array( 'A3_Lazy_Load_Hook_Filter', 'admin_sidebar_menu_css' ) );
49+
add_action( 'admin_enqueue_scripts', array( '\A3Rev\LazyLoad\Hook_Filter', 'admin_sidebar_menu_css' ) );
50+
51+
// Init lazy load Instance
52+
add_action( 'wp', 'a3_lazy_load_instance', 10, 0 );
53+
function a3_lazy_load_instance() {
54+
$allow_instance = true;
55+
56+
if ( is_feed() ) {
57+
$allow_instance = false;
58+
}
59+
60+
if ( function_exists( 'is_amp_endpoint' ) && is_amp_endpoint() ) {
61+
$allow_instance = false;
62+
}
63+
64+
// Compatibility with Better AMP plugin
65+
if ( function_exists( 'is_better_amp' ) && is_better_amp() ) {
66+
$allow_instance = false;
67+
}
68+
69+
if ( $allow_instance ) {
70+
\A3Rev\LazyLoad::_instance();
71+
}
72+
}
5073

5174
// Check upgrade functions
5275
function a3_lazy_load_upgrade_plugin() {
@@ -64,5 +87,3 @@ function a3_lazy_load_upgrade_plugin() {
6487

6588
update_option('a3_lazy_load_version', A3_LAZY_VERSION );
6689
}
67-
68-
?>

admin/admin-init.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ public function admin_settings_page( $page_data = array() ) {
187187

188188
?>
189189
<div class="wrap">
190-
<div class="icon32 icon32-a3rev-ui-settings icon32-a3rev<?php echo $current_page; ?>" id="icon32-a3rev<?php echo $current_page; ?>"><br /></div>
190+
<div class="icon32 icon32-a3rev-ui-settings icon32-a3rev<?php echo esc_attr( $current_page ); ?>" id="icon32-a3rev<?php echo esc_attr( $current_page ); ?>"><br /></div>
191191
<?php
192192
$tabs = apply_filters( $this->plugin_name . '-' . $current_page . '_settings_tabs_array', array() );
193193

@@ -299,7 +299,7 @@ public function admin_settings_tab( $current_page = '', $tab_data = array() ) {
299299
<?php
300300
foreach ( $subtabs as $subtab ) {
301301
?>
302-
<div class="section" id="<?php echo trim( $subtab['name'] ); ?>">
302+
<div class="section" id="<?php echo trim( esc_attr( $subtab['name'] ) ); ?>">
303303
<?php if ( isset( $subtab['callback_function'] ) && !empty( $subtab['callback_function'] ) ) call_user_func( $subtab['callback_function'] ); ?>
304304
</div>
305305
<?php

0 commit comments

Comments
 (0)