Skip to content

Commit 4729f24

Browse files
committed
Release new version 2.2.0
= 2.2.0 - 2020/01/13 = * This feature release completes the full refactor (frontend and backend) of the plugins PHP to Composer plus introduces new standardized skip-lazy exclusion class with backward compatibility support for a3-notlazy class * Feature - Plugin Framework fully refactored to Composer for cleaner code and faster PHP code * Tweak - Update plugin for compatibility with new version of plugin Framework * Dev - Add standardized skip-lazy exclusion class thanks to Frank Goossens for initiating this. * Dev - Retain backward compatibility support for old a3-notlazy class for existing users * Tweak - Add using new skip-lazy class instructions to the plugins admin menus * Tweak - Update the plugins description FQAs about the skip-lazy class
1 parent 73965a1 commit 4729f24

20 files changed

+215
-121
lines changed

a3-lazy-load.php

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
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: 2.1.0
5+
Version: 2.2.0
66
Author: a3rev Software
77
Author URI: https://a3rev.com/
8-
Requires at least: 4.0
8+
Requires at least: 4.9
99
Tested up to: 5.3.2
1010
Text Domain: a3-lazy-load
1111
Domain Path: /languages
@@ -32,12 +32,33 @@
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', '2.1.0' );
35+
define( 'A3_LAZY_LOAD_PREFIX', 'a3_lazy_load_' );
36+
define( 'A3_LAZY_VERSION', '2.2.0' );
3637
define( 'A3_LAZY_LOAD_G_FONTS', false );
3738

39+
use \A3Rev\LazyLoad\FrameWork;
40+
3841
if ( version_compare( PHP_VERSION, '5.6.0', '>=' ) ) {
3942
require __DIR__ . '/vendor/autoload.php';
4043

44+
/**
45+
* Plugin Framework init
46+
*/
47+
global ${A3_LAZY_LOAD_PREFIX.'admin_interface'};
48+
${A3_LAZY_LOAD_PREFIX.'admin_interface'} = new FrameWork\Admin_Interface();
49+
50+
global $a3_lazy_load_settings_page;
51+
$a3_lazy_load_settings_page = new FrameWork\Pages\Settings();
52+
53+
global ${A3_LAZY_LOAD_PREFIX.'admin_init'};
54+
${A3_LAZY_LOAD_PREFIX.'admin_init'} = new FrameWork\Admin_Init();
55+
56+
global ${A3_LAZY_LOAD_PREFIX.'less'};
57+
${A3_LAZY_LOAD_PREFIX.'less'} = new FrameWork\Less_Sass();
58+
59+
// End - Plugin Framework init
60+
61+
4162
global $a3_lazy_load_excludes;
4263
$a3_lazy_load_excludes = new \A3Rev\LazyLoad\Excludes();
4364

@@ -65,17 +86,9 @@ function a3_lazy_load_plugin_textdomain() {
6586
// Disable for load new google font faces
6687
add_filter( A3_LAZY_LOAD_KEY . '_new_google_fonts_enable', '__return_false' );
6788

68-
include( 'admin/admin-ui.php' );
69-
include( 'admin/admin-interface.php' );
70-
71-
include( 'admin/admin-pages/admin-settings-page.php' );
72-
7389
// Backwards compatibility for 3rd party plugin use functions from this plugin
7490
include( 'classes/classes-backwards-compatibility.php' );
7591

76-
include( 'admin/admin-init.php' );
77-
include( 'admin/less/sass.php' );
78-
7992
include( 'admin/a3-lazy-load-admin.php' );
8093

8194
// Defined this function for check Lazy Load is enabled that 3rd party plugins or theme can use to check

admin/a3-lazy-load-admin.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
function a3_lazy_load_activated(){
44
update_option('a3_lazy_load_version', A3_LAZY_VERSION );
55

6-
global $a3_lazy_load_admin_init;
7-
delete_metadata( 'user', 0, $a3_lazy_load_admin_init->plugin_name . '-' . 'plugin_framework_global_box' . '-' . 'opened', '', true );
6+
global ${A3_LAZY_LOAD_PREFIX.'admin_init'};
7+
delete_metadata( 'user', 0, ${A3_LAZY_LOAD_PREFIX.'admin_init'}->plugin_name . '-' . 'plugin_framework_global_box' . '-' . 'opened', '', true );
88

99
update_option('a3_lazy_load_just_installed', true);
1010
}
@@ -18,20 +18,20 @@ function a3_lazy_load_init() {
1818
delete_option( 'a3_lazy_load_just_installed' );
1919

2020
// Set Settings Default from Admin Init
21-
global $a3_lazy_load_admin_init;
22-
$a3_lazy_load_admin_init->set_default_settings();
21+
global ${A3_LAZY_LOAD_PREFIX.'admin_init'};
22+
${A3_LAZY_LOAD_PREFIX.'admin_init'}->set_default_settings();
2323
}
2424

2525
a3_lazy_load_plugin_textdomain();
2626

2727
a3_lazy_load_upgrade_plugin();
2828
}
2929

30-
global $a3_lazy_load_admin_init;
31-
$a3_lazy_load_admin_init->init();
30+
global ${A3_LAZY_LOAD_PREFIX.'admin_init'};
31+
${A3_LAZY_LOAD_PREFIX.'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( '\A3Rev\LazyLoad\Hook_Filter', 'plugin_extension_box' ) );
34+
add_filter( ${A3_LAZY_LOAD_PREFIX.'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);

admin/admin-init.php

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
<?php
22
/* "Copyright 2012 a3 Revolution Web Design" This software is distributed under the terms of GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 */
3+
4+
namespace A3Rev\LazyLoad\FrameWork {
5+
36
// File Security Check
47
if ( ! defined( 'ABSPATH' ) ) exit;
5-
?>
6-
<?php
8+
79
/*-----------------------------------------------------------------------------------
810
A3rev Plugin Admin Init
911
@@ -20,7 +22,7 @@
2022
2123
-----------------------------------------------------------------------------------*/
2224

23-
class A3_Lazy_Load_Admin_Init extends A3_Lazy_Load_Admin_UI
25+
class Admin_Init extends Admin_UI
2426
{
2527

2628
/**
@@ -317,7 +319,4 @@ public function admin_settings_tab( $current_page = '', $tab_data = array() ) {
317319
}
318320
}
319321

320-
global $a3_lazy_load_admin_init;
321-
$a3_lazy_load_admin_init = new A3_Lazy_Load_Admin_Init();
322-
323-
?>
322+
}

admin/admin-interface.php

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
<?php
22
/* "Copyright 2012 A3 Revolution Web Design" This software is distributed under the terms of GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 */
3+
4+
namespace A3Rev\LazyLoad\FrameWork {
5+
36
// File Security Check
47
if ( ! defined( 'ABSPATH' ) ) exit;
5-
?>
6-
<?php
8+
79
/*-----------------------------------------------------------------------------------
810
A3rev Plugin Admin Interface
911
@@ -32,7 +34,7 @@
3234
3335
-----------------------------------------------------------------------------------*/
3436

35-
class A3_Lazy_Load_Admin_Interface extends A3_Lazy_Load_Admin_UI
37+
class Admin_Interface extends Admin_UI
3638
{
3739

3840
/*-----------------------------------------------------------------------------------*/
@@ -214,7 +216,7 @@ public function a3_admin_ui_event() {
214216
$current_update_plugins = get_site_transient( 'update_plugins' );
215217
if ( isset( $current_update_plugins->response ) ) {
216218
if ( empty( $current_update_plugins->response[$this->plugin_path] ) ) {
217-
$current_update_plugins->response[$this->plugin_path] = new stdClass();
219+
$current_update_plugins->response[$this->plugin_path] = new \stdClass();
218220
}
219221
$current_update_plugins->response[$this->plugin_path]->url = "http://www.a3rev.com";
220222
$current_update_plugins->response[$this->plugin_path]->slug = $this->plugin_name;
@@ -296,10 +298,12 @@ public function get_reset_message( $message = '' ) {
296298
/*-----------------------------------------------------------------------------------*/
297299
public function admin_includes() {
298300
// Includes Font Face Lib
299-
include_once( 'includes/fonts_face.php' );
301+
global ${$this->plugin_prefix.'fonts_face'};
302+
${$this->plugin_prefix.'fonts_face'} = new Fonts_Face();
300303

301304
// Includes Uploader Lib
302-
include_once( 'includes/uploader/class-uploader.php' );
305+
global ${$this->plugin_prefix.'uploader'};
306+
${$this->plugin_prefix.'uploader'} = new Uploader();
303307
}
304308

305309
/*-----------------------------------------------------------------------------------*/
@@ -1356,7 +1360,7 @@ public function settings_get_option( $option_name, $default = '' ) {
13561360
*/
13571361

13581362
public function admin_forms( $options, $form_key, $option_name = '', $form_messages = array() ) {
1359-
global $a3_lazy_load_fonts_face, $a3_lazy_load_uploader, $current_subtab;
1363+
global ${$this->plugin_prefix.'fonts_face'}, ${$this->plugin_prefix.'uploader'}, $current_subtab;
13601364

13611365
$new_settings = array(); $new_single_setting = ''; // :)
13621366
$admin_message = '';
@@ -1886,7 +1890,7 @@ class="a3rev-ui-onoff_checkbox a3rev-ui-onoff_google_api_key_enable"
18861890
<div class="a3rev-ui-google-api-key-description"><?php echo sprintf( __( "Enter your existing Google Fonts API Key below. Don't have a key? Visit <a href='%s' target='_blank'>Google Developer API</a> to create a key", 'a3-lazy-load' ), 'https://developers.google.com/fonts/docs/developer_api#APIKey' ); ?></div>
18871891
<div class="a3rev-ui-google-api-key-inside
18881892
<?php
1889-
if ( $a3_lazy_load_fonts_face->is_valid_google_api_key() ) {
1893+
if ( ${$this->plugin_prefix.'fonts_face'}->is_valid_google_api_key() ) {
18901894
echo 'a3rev-ui-google-valid-key';
18911895
} elseif ( '' != $google_api_key ) {
18921896
echo 'a3rev-ui-google-unvalid-key';
@@ -2708,7 +2712,7 @@ class="a3rev-ui-<?php echo esc_attr( sanitize_title( $value['type'] ) ); ?>-face
27082712
>
27092713
<optgroup label="<?php _e( '-- Default Fonts --', 'a3-lazy-load' ); ?>">
27102714
<?php
2711-
foreach ( $a3_lazy_load_fonts_face->get_default_fonts() as $val => $text ) {
2715+
foreach ( ${$this->plugin_prefix.'fonts_face'}->get_default_fonts() as $val => $text ) {
27122716
?>
27132717
<option value="<?php echo esc_attr( $val ); ?>" <?php
27142718
selected( esc_attr( $val ), esc_attr( $face ) );
@@ -2719,7 +2723,7 @@ class="a3rev-ui-<?php echo esc_attr( sanitize_title( $value['type'] ) ); ?>-face
27192723
</optgroup>
27202724
<optgroup label="<?php _e( '-- Google Fonts --', 'a3-lazy-load' ); ?>">
27212725
<?php
2722-
foreach ( $a3_lazy_load_fonts_face->get_google_fonts() as $font ) {
2726+
foreach ( ${$this->plugin_prefix.'fonts_face'}->get_google_fonts() as $font ) {
27232727
?>
27242728
<option value="<?php echo esc_attr( $font['name'] ); ?>" <?php
27252729
selected( esc_attr( $font['name'] ), esc_attr( $face ) );
@@ -3392,7 +3396,7 @@ class="a3rev-ui-slider"
33923396
</th>
33933397
<td class="forminp forminp-<?php echo esc_attr( sanitize_title( $value['type'] ) ); ?>">
33943398
<?php echo $description; ?>
3395-
<?php echo $a3_lazy_load_uploader->upload_input( $name_attribute, $id_attribute, $option_value, $attachment_id, $value['default'], $value['name'], $class, esc_attr( $value['css'] ) , '', $strip_methods );?>
3399+
<?php echo ${$this->plugin_prefix.'uploader'}->upload_input( $name_attribute, $id_attribute, $option_value, $attachment_id, $value['default'], $value['name'], $class, esc_attr( $value['css'] ) , '', $strip_methods );?>
33963400
</td>
33973401
</tr><?php
33983402

@@ -3927,7 +3931,4 @@ public function generate_background_color_css( $option, $transparency = 100 ) {
39273931

39283932
}
39293933

3930-
global $a3_lazy_load_admin_interface;
3931-
$a3_lazy_load_admin_interface = new A3_Lazy_Load_Admin_Interface();
3932-
3933-
?>
3934+
}

admin/admin-pages/admin-settings-page.php

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
<?php
22
/* "Copyright 2012 a3 Revolution Web Design" This software is distributed under the terms of GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 */
3+
4+
namespace A3Rev\LazyLoad\FrameWork\Pages {
5+
6+
use A3Rev\LazyLoad\FrameWork;
7+
38
// File Security Check
49
if ( ! defined( 'ABSPATH' ) ) exit;
5-
?>
6-
<?php
10+
711
/*-----------------------------------------------------------------------------------
812
a3 LazyLoad Settings Page
913
@@ -21,7 +25,7 @@
2125
2226
-----------------------------------------------------------------------------------*/
2327

24-
class A3_Lazy_Load_Settings_Page extends A3_Lazy_Load_Admin_UI
28+
class Settings extends FrameWork\Admin_UI
2529
{
2630
/**
2731
* @var string
@@ -92,21 +96,22 @@ public function add_admin_menu( $admin_menu ) {
9296
/* Include all tabs into this page
9397
/*-----------------------------------------------------------------------------------*/
9498
public function tabs_include() {
95-
include_once( $this->admin_plugin_dir() . '/tabs/template-settings/global-settings-tab.php' );
99+
global $a3_lazy_load_global_settings_tab;
100+
$a3_lazy_load_global_settings_tab = new FrameWork\Tabs\Global_Settings();
96101
}
97102

98103
/*-----------------------------------------------------------------------------------*/
99104
/* admin_settings_page() */
100105
/* Show Settings Page */
101106
/*-----------------------------------------------------------------------------------*/
102107
public function admin_settings_page() {
103-
global $a3_lazy_load_admin_init;
108+
global ${$this->plugin_prefix.'admin_init'};
104109

105-
$a3_lazy_load_admin_init->admin_settings_page( $this->page_data() );
110+
${$this->plugin_prefix.'admin_init'}->admin_settings_page( $this->page_data() );
106111

107112
//$my_page_data = $this->page_data();
108113
//$my_page_data = array_values( $my_page_data );
109-
//$a3_lazy_load_admin_init->admin_settings_page( $my_page_data[1] );
114+
//${$this->plugin_prefix.'admin_init'}->admin_settings_page( $my_page_data[1] );
110115
}
111116

112117
/*-----------------------------------------------------------------------------------*/
@@ -123,8 +128,10 @@ public function callback_admin_settings_page() {
123128

124129
}
125130

126-
global $a3_lazy_load_settings_page;
127-
$a3_lazy_load_settings_page = new A3_Lazy_Load_Settings_Page();
131+
}
132+
133+
// global code
134+
namespace {
128135

129136
/**
130137
* a3_lazy_load_settings_page_show()
@@ -140,4 +147,4 @@ function callback_a3_lazy_load_settings_page_show() {
140147
$a3_lazy_load_settings_page->callback_admin_settings_page();
141148
}
142149

143-
?>
150+
}

admin/admin-ui.php

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
<?php
22
/* "Copyright 2012 a3 Revolution Web Design" This software is distributed under the terms of GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 */
3+
4+
namespace A3Rev\LazyLoad\FrameWork {
5+
36
// File Security Check
47
if ( ! defined( 'ABSPATH' ) ) exit;
5-
?>
6-
<?php
8+
79
/*-----------------------------------------------------------------------------------
810
A3rev Plugin Admin UI
911
@@ -24,14 +26,14 @@
2426
2527
-----------------------------------------------------------------------------------*/
2628

27-
class A3_Lazy_Load_Admin_UI
29+
class Admin_UI
2830
{
2931
/**
3032
* @var string
3133
* You must change to correct plugin name that you are working
3234
*/
3335

34-
public $framework_version = '2.2.0';
36+
public $framework_version = '2.3.0';
3537
public $plugin_name = A3_LAZY_LOAD_KEY;
3638
public $plugin_path = A3_LAZY_LOAD_NAME;
3739
public $google_api_key_option = '';
@@ -50,6 +52,8 @@ class A3_Lazy_Load_Admin_UI
5052
*/
5153
public $class_name = 'A3_Lazy_Load';
5254

55+
public $plugin_prefix = A3_LAZY_LOAD_PREFIX;
56+
5357
/**
5458
* @var string
5559
* You must change to correct pro plugin page url on a3rev site
@@ -445,4 +449,4 @@ public function get_version_message() {
445449

446450
}
447451

448-
?>
452+
}

admin/includes/fonts_face.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
<?php
22
/* "Copyright 2012 A3 Revolution Web Design" This software is distributed under the terms of GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 */
3+
4+
namespace A3Rev\LazyLoad\FrameWork {
5+
36
// File Security Check
47
if ( ! defined( 'ABSPATH' ) ) exit;
5-
?>
6-
<?php
8+
79
/*-----------------------------------------------------------------------------------
810
A3rev Plugin Fonts Face
911
@@ -19,7 +21,7 @@
1921
2022
-----------------------------------------------------------------------------------*/
2123

22-
class A3_Lazy_Load_Fonts_Face extends A3_Lazy_Load_Admin_UI
24+
class Fonts_Face extends Admin_UI
2325
{
2426

2527
/**
@@ -642,6 +644,4 @@ public function generate_google_webfonts( $my_google_fonts = array(), $echo = tr
642644

643645
}
644646

645-
global $a3_lazy_load_fonts_face;
646-
$a3_lazy_load_fonts_face = new A3_Lazy_Load_Fonts_Face();
647-
?>
647+
}

0 commit comments

Comments
 (0)