100% protectmedia

Code Review | Protect Media

WordPress plugin Protect Media scored 100% from 53 tests.

About plugin

  • Plugin page: protectmedia
  • Plugin version: 1.0.0
  • PHP version: 7.4.16
  • WordPress compatibility: 5.2-5.7
  • WordPress version: 5.8.1
  • First release: May 17, 2021
  • Latest release: May 19, 2021
  • Number of updates: 6
  • Update frequency: every 0.3 days
  • Top authors: ateliee (100%)

Code review

53 tests

User reviews

1 review

Install metrics

10+ active / 89 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
Install script ran successfully

Server metrics [RAM: ▲0.04MB] [CPU: ▼277.33ms] Passed 4 tests

An overview of server-side resources used by Protect Media
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /2.87 ▲0.1537.97 ▲16.47
Dashboard /wp-admin3.10 ▲0.0547.05 ▼3.11
Posts /wp-admin/edit.php3.15 ▲0.0443.02 ▼0.55
Add New Post /wp-admin/post-new.php5.46 ▲0.0393.82 ▼1,100.14
Media Library /wp-admin/upload.php3.04 ▲0.0332.02 ▼5.50
Protect Media /wp-admin/upload.php?page=protect-media-config3.0129.66

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

Analyzing filesystem and database footprints of this plugin
There were no storage issued detected upon installing this plugin
Filesystem: 7 new files
Database: no new tables, no new options

Browser metrics Passed 4 tests

Checking browser requirements for Protect Media
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,654 ▲7215.96 ▲0.437.56 ▼3.6548.04 ▲1.07
Dashboard /wp-admin2,932 ▲825.89 ▼0.10147.90 ▼5.35106.30 ▼4.48
Posts /wp-admin/edit.php2,711 ▲52.69 ▲0.0067.69 ▼4.12139.81 ▲50.07
Add New Post /wp-admin/post-new.php1,659 ▲818.26 ▲1.21390.83 ▲30.40113.55 ▲6.55
Media Library /wp-admin/upload.php1,780 ▲85.11 ▲0.10147.31 ▼12.14110.54 ▼14.55
Protect Media /wp-admin/upload.php?page=protect-media-config1,0342.1058.5058.42

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
The plugin uninstalled completely, with no zombie files or tables

Smoke tests Passed 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 Passed 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 SRP test was a success

User-side errors Passed 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
Everything seems fine, but this is not an exhaustive test

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
4 plugin tags: protect, japanese, media, uploads

protectmedia/protect-media.php 92% from 13 tests

The main PHP script in "Protect Media" version 1.0.0 is automatically included on every request by WordPress
You should first fix the following items:
  • Main file name: The principal plugin file should be the same as the plugin slug ("protectmedia.php" instead of "protect-media.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is an overview of programming languages used in this plugin; dangerous file extensions are not allowed
Success! There were no dangerous files found in this plugin284 lines of code in 3 files:
LanguageFilesBlank linesComment linesLines of code
PHP22341227
PO File1151857

PHP code Passed 2 tests

An overview of cyclomatic complexity and code structure
Great job! No cyclomatic complexity issues were detected in this plugin
Cyclomatic complexity
Average complexity per logical line of code0.36
Average class complexity36.00
▷ Minimum class complexity36.00
▷ Maximum class complexity36.00
Average method complexity3.92
▷ Minimum method complexity1.00
▷ Maximum method complexity10.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes1
▷ Abstract classes00.00%
▷ Concrete classes1100.00%
▷ Final classes00.00%
Methods12
▷ Static methods325.00%
▷ Public methods975.00%
▷ Protected methods325.00%
▷ Private methods00.00%
Functions0
▷ Named functions00.00%
▷ Anonymous functions00.00%
Constants11
▷ Global constants00.00%
▷ Class constants11100.00%
▷ Public constants11100.00%

Plugin size Passed 1 test

Image compression Passed 1 test

PNG files should be compressed to save space and minimize bandwidth usage
1 PNG file occupies 0.07MB with 0.05MB in potential savings
Potential savings
Compression of 1 random PNG file using pngquant
FileSize - originalSize - compressedSavings
screen.png69.34KB20.95KB▼ 69.78%