79% restrict-wp-upload-type

Code Review | Restrict WP Upload Type

WordPress plugin Restrict WP Upload Type scored 79% from 54 tests.

About plugin

  • Plugin page: restrict-wp-uploa...
  • Plugin version: 1.0.0
  • PHP compatiblity: 5.6+
  • PHP version: 7.4.16
  • WordPress compatibility: 5.4-6.1.1
  • WordPress version: 6.3.1
  • First release: Apr 14, 2022
  • Latest release: Nov 22, 2022
  • Number of updates: 4
  • Update frequency: every 55.5 days
  • Top authors: kushang78 (100%)

Code review

54 tests

User reviews

1 review

Install metrics

100+ active / 1,046 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
Install script ran successfully

Server metrics [RAM: ▲0.10MB] [CPU: ▼0.98ms] Passed 4 tests

Server-side resources used by Restrict WP Upload Type
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /3.56 ▲0.1038.71 ▼2.08
Dashboard /wp-admin3.40 ▲0.0947.50 ▲0.38
Posts /wp-admin/edit.php3.51 ▲0.1544.30 ▼3.62
Add New Post /wp-admin/post-new.php5.99 ▲0.1092.65 ▲7.22
Media Library /wp-admin/upload.php3.32 ▲0.0938.68 ▲1.39

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

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

Browser metrics Passed 4 tests

An overview of browser requirements for Restrict WP Upload Type
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,924 ▲16713.90 ▼0.688.79 ▲6.8743.60 ▲0.95
Dashboard /wp-admin2,219 ▲314.87 ▼0.04117.01 ▲17.5345.20 ▲0.22
Posts /wp-admin/edit.php2,105 ▲162.05 ▲0.0435.66 ▼4.8332.23 ▼3.99
Add New Post /wp-admin/post-new.php1,528 ▼1023.22 ▲0.19780.71 ▲104.1761.32 ▲9.49
Media Library /wp-admin/upload.php1,407 ▲164.18 ▼0.03109.42 ▲1.5450.20 ▲0.87

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
You still need to fix the following
  • The uninstall procedure has failed, leaving 6 options in the database
    • widget_recent-posts
    • db_upgraded
    • theysaidso_admin_options
    • widget_theysaidso_widget
    • widget_recent-comments
    • can_compress_scripts

Smoke tests 50% 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 0% 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 take a closer look at the following
  • 2× PHP files output non-empty strings when accessed directly via GET requests:
    • > /wp-content/plugins/restrict-wp-upload-type/public/partials/restrict-wp-upload-type-public-display.php
    • > /wp-content/plugins/restrict-wp-upload-type/admin/partials/restrict-wp-upload-type-admin-display.php
  • 3× PHP files trigger server-side errors or warnings when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_filter() in wp-content/plugins/restrict-wp-upload-type/includes/class-restrict-wp-upload-type.php:220
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/restrict-wp-upload-type/includes/class-restrict-wp-upload-type-loader.php:149
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_post_meta() in wp-content/plugins/restrict-wp-upload-type/includes/index.php:5

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
Everything seems fine, but this is not an exhaustive test

Optimizations

Plugin configuration Passed 29 tests

readme.txt Passed 16 tests

The readme.txt file is an important file in your plugin as it is parsed by WordPress.org to prepare the public listing of your plugin
6 plugin tags: mime, file type, restrict, files, mime type...

restrict-wp-upload-type/restrict-wp-upload-type.php Passed 13 tests

"Restrict WP Upload Type" version 1.0.0's main PHP file describes plugin functionality and also serves as the entry point to any WordPress functionality
73 characters long description:
Enable and Restrict the upload mime file type accross with 96 extensions.

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | There should be no dangerous file extensions present in any WordPress plugin
Good job! No executable or dangerous file extensions detected937 lines of code in 17 files:
LanguageFilesBlank linesComment linesLines of code
PHP13220523736
CSS21016174
JavaScript285427

PHP code Passed 2 tests

An short overview of logical lines of code, cyclomatic complexity, and other code metrics
There were no cyclomatic complexity issued detected
Cyclomatic complexity
Average complexity per logical line of code0.37
Average class complexity1.43
▷ Minimum class complexity1.00
▷ Maximum class complexity3.00
Average method complexity1.13
▷ Minimum method complexity1.00
▷ Maximum method complexity3.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes7
▷ Abstract classes00.00%
▷ Concrete classes7100.00%
▷ Final classes00.00%
Methods23
▷ Static methods28.70%
▷ Public methods1878.26%
▷ Protected methods00.00%
▷ Private methods521.74%
Functions8
▷ Named functions8100.00%
▷ Anonymous functions00.00%
Constants1
▷ Global constants1100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

It is recommended to compress PNG files in your plugin to minimize bandwidth usage
There are no PNG files in this plugin