84% media-trash-button

Code Review | Media Trash Button

WordPress plugin Media Trash Button scored84%from 54 tests.

About plugin

  • Plugin page: media-trash-button
  • Plugin version: 1.03
  • PHP compatiblity: 8.0+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.7-6.4
  • WordPress version: 6.3.1
  • First release: May 13, 2020
  • Latest release: Oct 29, 2023
  • Number of updates: 19
  • Update frequency: every 66.5 days
  • Top authors: Katsushi Kawamori (100%)

Code review

54 tests

User reviews

3 reviews

Install metrics

200+ active /2,956 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Verifying that this plugin installs correctly without errors
Install script ran successfully

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

Server-side resources used by Media Trash Button
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /3.47 ▲0.0134.76 ▼6.75
Dashboard /wp-admin3.31 ▲0.0145.33 ▼3.42
Posts /wp-admin/edit.php3.36 ▲0.0146.08 ▲1.13
Add New Post /wp-admin/post-new.php5.89 ▲0.0090.89 ▼2.67
Media Library /wp-admin/upload.php3.23 ▲0.0134.01 ▼3.22

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

A short overview of filesystem and database impact
This plugin was installed successfully
Filesystem: 4 new files
Database: no new tables, 6 new options
New WordPress options
theysaidso_admin_options
db_upgraded
widget_recent-posts
widget_recent-comments
can_compress_scripts
widget_theysaidso_widget

Browser metrics Passed 4 tests

A check of browser resources used by Media Trash Button
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,789 ▲314.69 ▲0.411.80 ▼0.3242.98 ▼0.44
Dashboard /wp-admin2,198 ▲215.61 ▼0.0589.79 ▼9.6739.89 ▼1.39
Posts /wp-admin/edit.php2,103 ▲31.97 ▼0.0233.88 ▼4.1833.67 ▼1.88
Add New Post /wp-admin/post-new.php1,526 ▼223.16 ▲0.04614.58 ▼81.2058.20 ▲0.86
Media Library /wp-admin/upload.php1,431 ▲284.23 ▼0.0497.98 ▼10.2143.31 ▼4.45

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
Please fix the following items
  • Zombie WordPress options detected upon uninstall: 6 options
    • widget_recent-comments
    • widget_recent-posts
    • can_compress_scripts
    • theysaidso_admin_options
    • db_upgraded
    • widget_theysaidso_widget

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
Even though everything seems fine, this is not an exhaustive test

SRP 50% from 2 tests

🔹 Tests weight: 20 | It is important to ensure that your PHP files perform no action when accessed directly, respecting the single-responsibility principle
Please take a closer look at the following
  • 2× PHP files trigger errors when accessed directly with GET requests:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/media-trash-button/lib/class-mediatrashbutton.php:37
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/media-trash-button/lib/class-mediatrashbutton.php:37

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 96% from 29 tests

readme.txt Passed 16 tests

The readme.txt file is undoubtedly the most important file in your plugin, preparing it for public listing on WordPress.org
2 plugin tags: trash, media library

media-trash-button/mediatrashbutton.php 92% from 13 tests

The entry point to "Media Trash Button" version 1.03 is a PHP file that has certain tags in its header comment area
Please take the time to fix the following:
  • Main file name: Please rename the main PHP file in this plugin to the plugin slug ("media-trash-button.php" instead of "mediatrashbutton.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | Executable files are not allowed as they can serve as attack vectors
Success! There were no dangerous files found in this plugin59 lines of code in 3 files:
LanguageFilesBlank linesComment linesLines of code
PHP2206951
JavaScript13188

PHP code Passed 2 tests

Analyzing cyclomatic complexity and code structure
There are no cyclomatic complexity problems detected for this plugin
Cyclomatic complexity
Average complexity per logical line of code0.28
Average class complexity5.00
▷ Minimum class complexity5.00
▷ Maximum class complexity5.00
Average method complexity2.00
▷ Minimum method complexity1.00
▷ Maximum method complexity3.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%
Functions0
▷ Named functions00.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
No PNG files were detected