94% media-file-sizes

Code Review | Media File Sizes

WordPress plugin Media File Sizes scored 94% from 54 tests.

About plugin

  • Plugin page: media-file-sizes
  • Plugin version: 1.8
  • PHP version: 7.4.16
  • WordPress compatibility: 2.8.6-5.7
  • WordPress version: 5.8.1
  • First release: Nov 3, 2010
  • Latest release: Mar 24, 2021
  • Number of updates: 37
  • Update frequency: every 102.5 days
  • Top authors: MadtownLems (100%)

Code review

54 tests

User reviews

13 reviews

Install metrics

1,000+ active / 14,628 total downloads

Benchmarks

Plugin footprint Passed 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | All plugins must install correctly, without throwing any errors, warnings, or notices
The plugin installed successfully, without throwing any errors or notices

Server metrics [RAM: ▲0.01MB] [CPU: ▼149.28ms] Passed 4 tests

Server-side resources used by Media File Sizes
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /2.84 ▲0.1244.77 ▲19.11
Dashboard /wp-admin3.07 ▲0.0145.73 ▼9.58
Posts /wp-admin/edit.php3.12 ▲0.0149.52 ▲0.17
Add New Post /wp-admin/post-new.php5.42 ▼0.0196.06 ▼595.24
Media Library /wp-admin/upload.php3.01 ▲0.0143.66 ▲7.53

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

A short overview of filesystem and database impact
There were no storage issued detected upon installing this plugin
Filesystem: 3 new files
Database: no new tables, 1 new option
New WordPress options
mediafilesize_version

Browser metrics Passed 4 tests

Checking browser requirements for Media File Sizes
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,713 ▲11715.84 ▲0.3110.58 ▲0.6452.04 ▲3.00
Dashboard /wp-admin2,970 ▲335.97 ▼0.15149.19 ▼6.37120.03 ▼3.30
Posts /wp-admin/edit.php2,739 ▼02.72 ▲0.0165.55 ▼18.49100.95 ▲0.88
Add New Post /wp-admin/post-new.php1,604 ▲2318.78 ▼1.49407.76 ▲3.81115.90 ▼0.27
Media Library /wp-admin/upload.php1,812 ▲25.06 ▲0.02150.09 ▼0.26131.41 ▲0.55

Uninstaller [IO: ▲0.00MB] [DB: ▲0.00MB] Passed 4 tests

🔸 Tests weight: 35 | It is important to correctly uninstall your plugin, without leaving any traces
This plugin's uninstaller ran successfully

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for server-side errors
Even though no errors were found, this is by no means an exhaustive test

SRP 50% from 2 tests

🔹 Tests weight: 20 | SRP (Single-Responsibility Principle) - PHP files must act as libraries and never output text or perform any action when accessed directly in a browser
The following issues need your attention
  • 1× PHP files trigger errors when accessed directly with GET requests:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function is_admin() in wp-content/plugins/media-file-sizes/media_file_sizes.php:26

User-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
Everything seems fine on the user side

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file is important because it is parsed by WordPress.org for the public listing of your plugin
Please fix the following attributes:
  • Screenshots: Add an image for screenshot #1 (A sortable column is added to the Media Library which displays the total space used by this media item (including generated sizes for image files). If a quota is in effect, a color-coded percentage is displayed, based on what percent of the quota this media item is using.)
You can look at the official readme.txt

media-file-sizes/media_file_sizes.php 92% from 13 tests

The main file in "Media File Sizes" v. 1.8 serves as a complement to information provided in readme.txt and as the entry point to the plugin
You should first fix the following items:
  • Main file name: The principal plugin file should be the same as the plugin slug ("media-file-sizes.php" instead of "media_file_sizes.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | Executable files are considered dangerous and should not be included with any WordPress plugin
Success! There were no dangerous files found in this plugin171 lines of code in 1 file:
LanguageFilesBlank linesComment linesLines of code
PHP16763171

PHP code Passed 2 tests

Analyzing logical lines of code, cyclomatic complexity, and other code metrics
No cyclomatic complexity issues were detected for this plugin
Cyclomatic complexity
Average complexity per logical line of code0.28
Average class complexity0.00
▷ Minimum class complexity0.00
▷ Maximum class complexity0.00
Average method complexity0.00
▷ Minimum method complexity0.00
▷ Maximum method complexity0.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes0
▷ Abstract classes00.00%
▷ Concrete classes00.00%
▷ Final classes00.00%
Methods0
▷ Static methods00.00%
▷ Public methods00.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions11
▷ Named functions11100.00%
▷ Anonymous functions00.00%
Constants0
▷ Global constants00.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
1 PNG file occupies 0.01MB with 0.00MB in potential savings
Potential savings
Compression of 1 random PNG file using pngquant
FileSize - originalSize - compressedSavings
screenshot-1.png5.70KB4.12KB▼ 27.77%