78% lazyload-background-images

Code Review | LazyLoad Background Images

WordPress plugin LazyLoad Background Images scored78%from 54 tests.

About plugin

  • Plugin page: lazyload-backgrou...
  • Plugin version: 1.0.5
  • PHP compatiblity: 7.2+
  • PHP version: 7.4.16
  • WordPress compatibility: 5.2-6.2
  • WordPress version: 6.3.1
  • First release: Jul 30, 2022
  • Latest release: Apr 30, 2023
  • Number of updates: 15
  • Update frequency: every 18.3 days
  • Top authors: proloybhaduri (100%)

Code review

54 tests

User reviews

1 review

Install metrics

200+ active /2,650 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | It is important to correctly install your plugin, without throwing errors or notices
This plugin's installer ran successfully

Server metrics [RAM: ▲0.32MB] [CPU: ▲1.18ms] Passed 4 tests

Analyzing server-side resources used by LazyLoad Background Images
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /3.84 ▲0.3841.60 ▼3.33
Dashboard /wp-admin3.66 ▲0.3555.24 ▲5.37
Posts /wp-admin/edit.php3.71 ▲0.3550.38 ▼1.86
Add New Post /wp-admin/post-new.php6.17 ▲0.29131.44 ▲18.63
Media Library /wp-admin/upload.php3.52 ▲0.2938.65 ▲4.52
Lazy Backgrounds /wp-admin/options-general.php?page=lazyload-bg3.5037.81

Server storage [IO: ▲0.31MB] [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: 17 new files
Database: no new tables, 7 new options
New WordPress options
can_compress_scripts
db_upgraded
widget_recent-comments
pb_lazybg_settings
theysaidso_admin_options
widget_recent-posts
widget_theysaidso_widget

Browser metrics Passed 4 tests

Checking browser requirements for LazyLoad Background Images
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,833 ▲8713.23 ▼1.152.40 ▲0.6244.78 ▲2.04
Dashboard /wp-admin2,210 ▲285.85 ▼0.07121.69 ▼3.3842.40 ▼2.16
Posts /wp-admin/edit.php2,096 ▲72.01 ▼0.0135.66 ▼6.9634.02 ▼3.33
Add New Post /wp-admin/post-new.php1,545 ▲1218.26 ▼4.80765.43 ▲126.6262.12 ▼0.37
Media Library /wp-admin/upload.php1,395 ▲74.20 ▲0.0196.59 ▼13.0444.45 ▼0.29
Lazy Backgrounds /wp-admin/options-general.php?page=lazyload-bg9491.7325.3549.93

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

🔸 Tests weight: 35 | It is important to correctly uninstall your plugin, without leaving any traces
Please fix the following items
  • Zombie WordPress options detected upon uninstall: 6 options
    • db_upgraded
    • widget_recent-posts
    • can_compress_scripts
    • widget_theysaidso_widget
    • widget_recent-comments
    • theysaidso_admin_options

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 applies for WordPress plugins as well - please make sure your PHP files perform no actions when accessed directly
The following issues need your attention
  • 3× GET requests to PHP files return non-empty strings:
    • > /wp-content/plugins/lazyload-background-images/admin/templates/more.php
    • > /wp-content/plugins/lazyload-background-images/lazyload-bg.php
    • > /wp-content/plugins/lazyload-background-images/admin/templates/settings.php
  • 9× PHP files trigger server errors when accessed directly:
    • > PHP Warning
      include_once(): Failed opening 'PBLZBG_PLUGIN_DIRinc/html-modifier.php' for inclusion (include_path='.:/usr/share/php') in wp-content/plugins/lazyload-background-images/init.php on line 34
    • > PHP Fatal error
      require_once(): Failed opening required 'PBLZBG_PLUGIN_DIRadmin/core/class-bg-image-processor.php' (include_path='.:/usr/share/php') in wp-content/plugins/lazyload-background-images/init.php on line 36
    • > PHP Fatal error
      Uncaught Error: Call to undefined function current_user_can() in wp-content/plugins/lazyload-background-images/admin/initialize.php:9
    • > PHP Warning
      Use of undefined constant PBLZBG_PLUGIN_DIR - assumed 'PBLZBG_PLUGIN_DIR' (this will throw an Error in a future version of PHP) in wp-content/plugins/lazyload-background-images/init.php on line 34
    • > PHP Warning
      require_once(PBLZBG_PLUGIN_DIRadmin/core/class-bg-image-processor.php): failed to open stream: No such file or directory in wp-content/plugins/lazyload-background-images/init.php on line 36
    • > PHP Warning
      include_once(PBLZBG_PLUGIN_DIRinc/html-modifier.php): failed to open stream: No such file or directory in wp-content/plugins/lazyload-background-images/init.php on line 34
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_option() in wp-content/plugins/lazyload-background-images/admin/core/class-bg-image-processor.php:15
    • > PHP Warning
      Use of undefined constant PBLZBG_PLUGIN_DIR - assumed 'PBLZBG_PLUGIN_DIR' (this will throw an Error in a future version of PHP) in wp-content/plugins/lazyload-background-images/init.php on line 36
    • > PHP Fatal error
      Uncaught Error: Call to undefined function is_admin() in wp-content/plugins/lazyload-background-images/admin/plugin-functions.php:18

User-side errors Passed 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
Everything seems fine on the user side

Optimizations

Plugin configuration 93% from 29 tests

readme.txt Passed 16 tests

Often overlooked, readme.txt is one of the most important files in your plugin
5 plugin tags: backgound-images-lazyload, speed-optimization, lazybg, lazyload, lazyload-bg

lazyload-background-images/lazyload-bg.php 85% from 13 tests

"LazyLoad Background Images" version 1.0.5's primary PHP file adds more information about the plugin and serves as the entry point for WordPress
It is important to fix the following:
  • Text Domain: You no longer need to specify the text domain since WordPress 4.6; it must be the same as the plugin slug
  • Main file name: It is recommended to name the main PHP file as the plugin slug ("lazyload-background-images.php" instead of "lazyload-bg.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is a short overview of programming languages used in this plugin, detecting executable files
Success! There were no dangerous files found in this plugin2,261 lines of code in 14 files:
LanguageFilesBlank linesComment linesLines of code
PHP124293732,120
CSS199140
JavaScript1001

PHP code Passed 2 tests

This is a very shot review of cyclomatic complexity and code structure
This plugin has no cyclomatic complexity problems
Cyclomatic complexity
Average complexity per logical line of code0.57
Average class complexity82.00
▷ Minimum class complexity1.00
▷ Maximum class complexity249.00
Average method complexity4.97
▷ Minimum method complexity1.00
▷ Maximum method complexity66.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes5
▷ Abstract classes00.00%
▷ Concrete classes5100.00%
▷ Final classes00.00%
Methods102
▷ Static methods87.84%
▷ Public methods8785.29%
▷ Protected methods1514.71%
▷ Private methods00.00%
Functions10
▷ Named functions990.00%
▷ Anonymous functions110.00%
Constants27
▷ Global constants27100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

PNG files should be compressed to save space and minimize bandwidth usage
1 PNG file occupies 0.23MB with 0.15MB in potential savings
Potential savings
Compression of 1 random PNG file using pngquant
FileSize - originalSize - compressedSavings
admin/assets/img/Proloy-bhaduri.png238.12KB82.72KB▼ 65.26%