78% a3-lazy-load

Code Review | a3 Lazy Load

WordPress plugin a3 Lazy Load scored 78% from 54 tests.

About plugin

  • Plugin page: a3-lazy-load
  • Plugin version: 2.4.9
  • PHP version: 7.4.16
  • WordPress compatibility: 5.6-5.9
  • WordPress version: 5.9.2
  • First release: Dec 20, 2014
  • Latest release: Jan 24, 2022
  • Number of updates: 119
  • Update frequency: every 21.8 days
  • Top authors: a3rev (100%)

Code review

54 tests

User reviews

133 reviews

Install metrics

200,000+ active / 2,980,692 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
This plugin's installer ran successfully

Server metrics [RAM: ▲1.54MB] [CPU: ▼291.41ms] Passed 4 tests

A check of server-side resources used by a3 Lazy Load
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /5.25 ▲1.7462.79 ▲12.98
Dashboard /wp-admin4.94 ▲1.5438.47 ▲4.63
Posts /wp-admin/edit.php5.29 ▲1.6543.78 ▲5.82
Add New Post /wp-admin/post-new.php8.41 ▲1.4499.11 ▼1,175.02
Media Library /wp-admin/upload.php4.83 ▲1.5330.36 ▼1.07
a3 Lazy Load /wp-admin/options-general.php?page=a3-lazy-load4.8841.53

Server storage [IO: ▲2.95MB] [DB: ▲0.00MB] Passed 3 tests

Input-output and database impact of this plugin
There were no storage issued detected upon installing this plugin
Filesystem: 169 new files
Database: no new tables, 3 new options
New WordPress options
a3_lazy_load_global_settings
a3_lazy_load_clean_on_deletion
a3_lazy_load_version

Browser metrics Passed 4 tests

a3 Lazy Load: an overview of browser usage
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,901 ▲15716.41 ▲0.7413.25 ▲6.742.59 ▼0.06
Dashboard /wp-admin2,901 ▲476.10 ▼0.07114.79 ▼15.27150.15 ▼10.05
Posts /wp-admin/edit.php2,697 ▲93.23 ▼0.0162.57 ▲0.64139.56 ▲0.74
Add New Post /wp-admin/post-new.php1,668 ▼8416.21 ▼5.02387.73 ▼43.83157.52 ▲1.14
Media Library /wp-admin/upload.php1,704 ▲65.47 ▲0.01150.96 ▲1.52193.43 ▲3.40
a3 Lazy Load /wp-admin/options-general.php?page=a3-lazy-load4,5806.66136.39225.34

Uninstaller [IO: ▲0.00MB] [DB: ▲0.00MB] 75% from 4 tests

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
You still need to fix the following
  • Zombie WordPress options detected upon uninstall: 3 options
    • a3_lazy_load_global_settings
    • a3_lazy_load_version
    • a3_lazy_load_clean_on_deletion

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a short smoke test looking for server-side errors
Everything seems fine, however this is by no means an exhaustive test

SRP 0% from 2 tests

🔹 Tests weight: 20 | The single-responsibility principle: PHP files have to remain inert when accessed directly, throwing no errors and performing no actions
Almost there! Just fix the following items
  • 1× PHP files output text when accessed directly:
    • > /wp-content/plugins/a3-lazy-load/includes/customized_style.php
  • 4× GET requests to PHP files trigger server-side errors or Error 500 responses:
    • > PHP Fatal error
      Uncaught Error: Call to a member function init() on null in wp-content/plugins/a3-lazy-load/admin/a3-lazy-load-admin.php:28
    • > PHP Notice
      Undefined index: A3_LAZY_LOAD_PREFIXadmin_init in wp-content/plugins/a3-lazy-load/admin/a3-lazy-load-admin.php on line 28
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_basename() in wp-content/plugins/a3-lazy-load/a3-lazy-load.php:24
    • > PHP Warning
      Use of undefined constant A3_LAZY_LOAD_PREFIX - assumed 'A3_LAZY_LOAD_PREFIX' (this will throw an Error in a future version of PHP) in wp-content/plugins/a3-lazy-load/admin/a3-lazy-load-admin.php on line 28

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
No browser issues were found

Optimizations

Plugin configuration Passed 29 tests

readme.txt Passed 16 tests

Often overlooked, readme.txt is one of the most important files in your plugin
4 plugin tags: a3 lazy load, lazy loading, image lazy load, lazyload

a3-lazy-load/a3-lazy-load.php Passed 13 tests

Analyzing the main PHP file in "a3 Lazy Load" version 2.4.9
111 characters long description:
Speed up your site and enhance frontend user's visual experience in PC's, Tablets and mobile with a3 Lazy Load.

Code Analysis 97% from 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short check of programming languages and file extensions; no executable files are allowed
Everything looks great! No dangerous files found in this plugin42,834 lines of code in 102 files:
LanguageFilesBlank linesComment linesLines of code
JSON10013,203
JavaScript312,1101,58412,774
PHP292,2741,7979,323
CSS272971685,366
SVG5311,085
LESS78826734
PO File1131171320
HTML12029

PHP code 50% from 2 tests

This is a short overview of cyclomatic complexity and code structure for this plugin
Please fix the following
  • Cyclomatic complexity of methods has to be reduced to less than 100 (currently 412)
Cyclomatic complexity
Average complexity per logical line of code0.47
Average class complexity80.20
▷ Minimum class complexity1.00
▷ Maximum class complexity786.00
Average method complexity6.00
▷ Minimum method complexity1.00
▷ Maximum method complexity412.00
Code structure
Namespaces8
Interfaces0
Traits0
Classes25
▷ Abstract classes00.00%
▷ Concrete classes25100.00%
▷ Final classes00.00%
Methods397
▷ Static methods5313.35%
▷ Public methods22857.43%
▷ Protected methods14536.52%
▷ Private methods246.05%
Functions14
▷ Named functions1392.86%
▷ Anonymous functions17.14%
Constants20
▷ Global constants1365.00%
▷ Class constants735.00%
▷ Public constants7100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

It is recommended to compress PNG files in your plugin to minimize bandwidth usage
32 PNG files occupy 0.26MB with 0.05MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
admin/assets/js/chosen/chosen-sprite.png0.53KB0.88KB0.00%
admin/assets/images/slider-handle-disable.png2.64KB1.81KB▼ 31.61%
assets/images/free-woocommerce-plugins.png70.55KB26.85KB▼ 61.94%
admin/assets/images/slider-handle1.png1.14KB1.17KB0.00%
admin/assets/images/ico-delete.png0.13KB0.13KB0.00%