83% defer-media

Code Review | Defer Media

WordPress plugin Defer Media scored83%from 54 tests.

About plugin

  • Plugin page: defer-media
  • Plugin version: 1.0.0
  • PHP compatiblity: 5.6+
  • PHP version: 7.4.16
  • WordPress compatibility: 5.0-5.3.2
  • WordPress version: 6.3.1
  • First release: Mar 31, 2020
  • Latest release: Apr 1, 2020
  • Number of updates: 4
  • Update frequency: every 0.3 days
  • Top authors: molotow (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /464 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
Installer ran successfully

Server metrics [RAM: ▲0.08MB] [CPU: ▼7.94ms] Passed 4 tests

Analyzing server-side resources used by Defer Media
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /3.51 ▲0.0538.33 ▼6.10
Dashboard /wp-admin3.40 ▲0.1044.81 ▼5.02
Posts /wp-admin/edit.php3.43 ▲0.0844.29 ▼3.86
Add New Post /wp-admin/post-new.php6.07 ▲0.1973.78 ▼16.78
Media Library /wp-admin/upload.php3.34 ▲0.1133.61 ▼0.88
Defer Media /wp-admin/options-general.php?page=defer-media-options3.2630.30

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

Input-output and database impact of this plugin
The plugin installed successfully
Filesystem: 12 new files
Database: no new tables, 6 new options
New WordPress options
can_compress_scripts
db_upgraded
widget_theysaidso_widget
theysaidso_admin_options
widget_recent-posts
widget_recent-comments

Browser metrics Passed 4 tests

An overview of browser requirements for Defer Media
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,833 ▲7613.19 ▼1.107.14 ▲4.9344.48 ▼2.73
Dashboard /wp-admin2,213 ▲255.90 ▲0.9895.97 ▼22.6436.67 ▼7.50
Posts /wp-admin/edit.php2,090 ▲11.96 ▼0.0734.03 ▼1.6337.36 ▲3.83
Add New Post /wp-admin/post-new.php1,536 ▲222.80 ▼0.40578.76 ▼45.5650.17 ▲1.61
Media Library /wp-admin/upload.php1,383 ▼54.23 ▲0.0199.90 ▼2.7143.09 ▲1.37
Defer Media /wp-admin/options-general.php?page=defer-media-options8172.0323.8428.82

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

🔸 Tests weight: 35 | All plugins must uninstall correctly, removing their source code and extra database tables they might have created
You still need to fix the following
  • This plugin does not fully uninstall, leaving 6 options in the database
    • widget_theysaidso_widget
    • widget_recent-comments
    • widget_recent-posts
    • can_compress_scripts
    • db_upgraded
    • theysaidso_admin_options

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no server-side errors were triggered
Good news, no errors were detected

SRP 50% from 2 tests

🔹 Tests weight: 20 | A shallow check of the single-responsibility principle; PHP files should perform no action - including output of placeholder text - and trigger no errors when accessed directly
Please fix the following
  • 2× GET requests to PHP files return non-empty strings:
    • > /wp-content/plugins/defer-media/lib/Optimize.php
    • > /wp-content/plugins/defer-media/DeferMedia.php

User-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
Everything seems fine, but this is not an exhaustive test

Optimizations

Plugin configuration 96% from 29 tests

readme.txt Passed 16 tests

Perhaps the most important file in your plugin readme.txt gets parsed in order to generate the public listing of your plugin
6 plugin tags: speed, optimize, lazy, images, gallery...

defer-media/DeferMedia.php 92% from 13 tests

Analyzing the main PHP file in "Defer Media" version 1.0.0
The following require your attention:
  • Main file name: Name the main plugin file the same as the plugin slug ("defer-media.php" instead of "DeferMedia.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is an overview of file extensions present in this plugin and a short test that no dangerous files are bundled with this plugin
Everything looks great! No dangerous files found in this plugin458 lines of code in 3 files:
LanguageFilesBlank linesComment linesLines of code
PHP25724457
HTML1001

PHP code Passed 2 tests

Cyclomatic complexity and code structure are the fingerprint of this plugin
Everything seems fine, there were no complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.33
Average class complexity12.00
▷ Minimum class complexity12.00
▷ Maximum class complexity12.00
Average method complexity3.67
▷ Minimum method complexity1.00
▷ Maximum method complexity6.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes1
▷ Abstract classes00.00%
▷ Concrete classes1100.00%
▷ Final classes00.00%
Methods4
▷ Static methods00.00%
▷ Public methods4100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions6
▷ Named functions466.67%
▷ Anonymous functions233.33%
Constants0
▷ Global constants00.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size 0% from 2 tests

Image compression 0% from 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
7 PNG files occupy 2.84MB with 2.16MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
docs/screenshot2-after.png472.09KB147.52KB▼ 68.75%
docs/screenshot2-before.png479.01KB152.18KB▼ 68.23%
(invalid) lib/loading.png23.73KB0.00KB▼ 100.00%
docs/uberhumor-post-before.png760.42KB218.88KB▼ 71.22%
docs/screenshot1-after.png186.50KB52.45KB▼ 71.88%