84% mcm-protected-file-view

Code Review | MCM Protected File View

WordPress plugin MCM Protected File View scored84%from 54 tests.

About plugin

  • Plugin page: mcm-protected-fil...
  • Plugin version: 2.0
  • PHP compatiblity: 5.6+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.6-6.1
  • WordPress version: 6.3.1
  • First release: Mar 23, 2017
  • Latest release: Jul 28, 2023
  • Number of updates: 33
  • Update frequency: every 70.2 days
  • Top authors: mcmwebsol (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /1,766 total downloads

Benchmarks

Plugin footprint 83% from 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.05MB] [CPU: ▼7.59ms] Passed 4 tests

Server-side resources used by MCM Protected File View
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /3.51 ▲0.0540.89 ▲2.39
Dashboard /wp-admin3.36 ▲0.0545.27 ▼5.35
Posts /wp-admin/edit.php3.41 ▲0.0543.45 ▼5.55
Add New Post /wp-admin/post-new.php5.94 ▲0.0580.09 ▼20.55
Media Library /wp-admin/upload.php3.28 ▲0.0535.75 ▲1.10
MCM Protected File View /wp-admin/options-general.php?page=mcm_protected_file_view3.2530.74

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

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

Browser metrics Passed 4 tests

MCM Protected File View: an overview of browser usage
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,804 ▲6913.29 ▼1.271.77 ▲0.1343.55 ▼2.72
Dashboard /wp-admin2,213 ▲255.86 ▼0.04102.37 ▲2.0839.41 ▼3.95
Posts /wp-admin/edit.php2,093 ▲41.99 ▼0.0835.28 ▼5.7931.88 ▼4.20
Add New Post /wp-admin/post-new.php1,517 ▼2517.70 ▼0.73599.66 ▼44.2550.83 ▼4.89
Media Library /wp-admin/upload.php1,392 ▲104.22 ▼0.1192.90 ▼5.1440.77 ▼4.06
MCM Protected File View /wp-admin/options-general.php?page=mcm_protected_file_view7842.0223.8438.87

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
You still need to fix the following
  • This plugin does not fully uninstall, leaving 6 options in the database
    • widget_recent-comments
    • db_upgraded
    • widget_recent-posts
    • widget_theysaidso_widget
    • theysaidso_admin_options
    • can_compress_scripts

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
The smoke test was a success, however most plugin functionality was not tested

SRP 50% 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
Please take a closer look at the following
  • 1× 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/mcm-protected-file-view/mcm-protected-file-view.php:16

User-side errors Passed 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
No browser errors were detected

Optimizations

Plugin configuration Passed 29 tests

readme.txt Passed 16 tests

The readme.txt file describes your plugin functionality and requirements and it is parsed to prepare the your plugin's listing
2 plugin tags: plugin, file

mcm-protected-file-view/mcm-protected-file-view.php Passed 13 tests

"MCM Protected File View" version 2.0's primary PHP file adds more information about the plugin and serves as the entry point for WordPress
68 characters long description:
Protect uploaded files so they can only be viewed by logged-in users

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
Good job! No executable or dangerous file extensions detected378 lines of code in 1 file:
LanguageFilesBlank linesComment linesLines of code
PHP115430378

PHP code Passed 2 tests

This is a very shot review of cyclomatic complexity and code structure
All good! No complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.39
Average class complexity62.00
▷ Minimum class complexity62.00
▷ Maximum class complexity62.00
Average method complexity4.81
▷ Minimum method complexity1.00
▷ Maximum method complexity25.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes1
▷ Abstract classes00.00%
▷ Concrete classes1100.00%
▷ Final classes00.00%
Methods16
▷ Static methods00.00%
▷ Public methods16100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions1
▷ Named functions1100.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
There are no PNG files in this plugin