84% download-restriction

Code Review | Download Attachments by User Restrictions

WordPress plugin Download Attachments by User Restrictions scored84%from 54 tests.

About plugin

  • Plugin page: download-restriction
  • Plugin version: 1.7
  • PHP version: 7.4.16
  • WordPress compatibility: 3.0.1-4.6
  • WordPress version: 6.3.1
  • First release: Jun 15, 2016
  • Latest release: Sep 19, 2016
  • Number of updates: 19
  • Update frequency: every 5.5 days
  • Top authors: webroods (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /650 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.01MB] [CPU: ▼5.22ms] Passed 4 tests

Analyzing server-side resources used by Download Attachments by User Restrictions
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /3.46 ▲0.0038.92 ▼4.04
Dashboard /wp-admin3.33 ▲0.0253.41 ▼1.18
Posts /wp-admin/edit.php3.45 ▲0.0955.06 ▼0.94
Add New Post /wp-admin/post-new.php5.89 ▲0.0085.80 ▼14.70
Media Library /wp-admin/upload.php3.23 ▲0.0041.80 ▲1.87

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

How much does this plugin use your filesystem and database?
This plugin was installed successfully
Filesystem: 2 new files
Database: no new tables, 6 new options
New WordPress options
widget_recent-comments
widget_recent-posts
widget_theysaidso_widget
can_compress_scripts
theysaidso_admin_options
db_upgraded

Browser metrics Passed 4 tests

Download Attachments by User Restrictions: an overview of browser usage
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,953 ▲20714.92 ▲0.541.91 ▲0.0943.61 ▼10.22
Dashboard /wp-admin2,362 ▲1746.42 ▲1.41130.41 ▲21.1737.32 ▼5.54
Posts /wp-admin/edit.php2,262 ▲1703.34 ▲1.3447.66 ▲6.5732.11 ▼5.93
Add New Post /wp-admin/post-new.php1,546 ▲1323.32 ▲0.07600.67 ▼107.6035.52 ▼13.55
Media Library /wp-admin/upload.php1,398 ▲104.12 ▼0.0781.08 ▼21.3843.86 ▼1.15

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
You still need to fix the following
  • The uninstall procedure has failed, leaving 6 options in the database
    • db_upgraded
    • can_compress_scripts
    • theysaidso_admin_options
    • widget_theysaidso_widget
    • widget_recent-posts
    • widget_recent-comments

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A smoke test targeting 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 | The single-responsibility principle applies for WordPress plugins as well - please make sure your PHP files perform no actions when accessed directly
The following issues need your attention
  • 3× 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/download-restriction/ab_download.php:18
    • > PHP Notice
      Trying to get property 'prefix' of non-object in wp-content/plugins/download-restriction/ab_download.php on line 12
    • > PHP Notice
      Trying to get property 'prefix' of non-object in wp-content/plugins/download-restriction/ab_download.php on line 13

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

readme.txt 94% from 16 tests

It's important to format your readme.txt file correctly as it is parsed for the public listing of your plugin
These attributes need to be fixed: You can take inspiration from this readme.txt

download-restriction/ab_download.php 92% from 13 tests

The primary PHP file in "Download Attachments by User Restrictions" version 1.7 is used by WordPress to initiate all plugin functionality
It is important to fix the following:
  • Main file name: Name the main plugin file the same as the plugin slug ("download-restriction.php" instead of "ab_download.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | An overview of files in this plugin; executable files are not allowed
There were no executable files found in this plugin268 lines of code in 1 file:
LanguageFilesBlank linesComment linesLines of code
PHP1617268

PHP code Passed 2 tests

A short review of cyclomatic complexity and code structure
No complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.24
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%
Functions5
▷ Named functions5100.00%
▷ Anonymous functions00.00%
Constants0
▷ Global constants00.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
There are no PNG files in this plugin