90% hotlink-file-prevention

Code Review | Hotlink File Prevention

WordPress plugin Hotlink File Prevention scored90%from 54 tests.

About plugin

  • Plugin page: hotlink-file-prev...
  • Plugin version: 2.0.0
  • PHP compatiblity: 5.6+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.6-6.1
  • WordPress version: 6.3.1
  • First release: Aug 25, 2014
  • Latest release: Oct 29, 2022
  • Number of updates: 13
  • Update frequency: every 230.0 days
  • Top authors: swinggraphics (53.85%)electricmill (53.85%)

Code review

54 tests

User reviews

4 reviews

Install metrics

600+ active /4,649 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
Install script ran successfully

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

A check of server-side resources used by Hotlink File Prevention
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /3.50 ▲0.0441.62 ▼11.08
Dashboard /wp-admin3.34 ▲0.0454.96 ▲2.74
Posts /wp-admin/edit.php3.39 ▲0.0451.35 ▲2.67
Add New Post /wp-admin/post-new.php5.92 ▲0.0497.25 ▲3.66
Media Library /wp-admin/upload.php3.27 ▲0.0434.41 ▼1.49

Server storage [IO: ▲0.01MB] [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
widget_recent-comments
can_compress_scripts
widget_recent-posts
theysaidso_admin_options
widget_theysaidso_widget

Browser metrics Passed 4 tests

Checking browser requirements for Hotlink File Prevention
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,792 ▲3114.37 ▼0.041.80 ▲0.0043.88 ▼1.98
Dashboard /wp-admin2,198 ▲185.82 ▲0.1689.10 ▼13.0540.14 ▼4.21
Posts /wp-admin/edit.php2,103 ▲32.02 ▲0.0147.20 ▲9.8840.19 ▲2.94
Add New Post /wp-admin/post-new.php1,532 ▲623.06 ▼0.02647.68 ▼33.7465.84 ▲11.99
Media Library /wp-admin/upload.php1,406 ▲34.19 ▲0.0696.73 ▼6.6141.92 ▼3.13

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
The following items require your attention
  • This plugin does not fully uninstall, leaving 6 options in the database
    • widget_recent-comments
    • widget_theysaidso_widget
    • theysaidso_admin_options
    • can_compress_scripts
    • widget_recent-posts
    • db_upgraded

Smoke tests Passed 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a short smoke test looking for server-side errors
Good news, no errors were detected

SRP Passed 2 tests

🔹 Tests weight: 20 | The single-responsibility principle: PHP files have to remain inert when accessed directly, throwing no errors and performing no actions
Everything seems fine, however this is by no means an exhaustive test

User-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
No browser errors were detected

Optimizations

Plugin configuration 96% from 29 tests

readme.txt Passed 16 tests

Often overlooked, readme.txt is one of the most important files in your plugin
6 plugin tags: files, images, media, hotlink, attachments...

hotlink-file-prevention/hotlink-file-prevention.php 92% from 13 tests

The main PHP file in "Hotlink File Prevention" ver. 2.0.0 adds more information about the plugin and also serves as the entry point for this plugin
Please make the necessary changes and fix the following:
  • Requires at least: The required version number must match the one declared in readme.txt ("3.8" instead of "4.6")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short glimpse at programming languages used with this plugin and a check that no dangerous files are present
Success! There were no dangerous files found in this plugin127 lines of code in 2 files:
LanguageFilesBlank linesComment linesLines of code
PHP27123127

PHP code Passed 2 tests

A short review of cyclomatic complexity and code structure
Everything seems fine, there were no complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.28
Average class complexity17.00
▷ Minimum class complexity17.00
▷ Maximum class complexity17.00
Average method complexity2.23
▷ Minimum method complexity1.00
▷ Maximum method complexity6.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes1
▷ Abstract classes00.00%
▷ Concrete classes1100.00%
▷ Final classes00.00%
Methods14
▷ Static methods17.14%
▷ Public methods1178.57%
▷ Protected methods00.00%
▷ Private methods321.43%
Functions1
▷ Named functions00.00%
▷ Anonymous functions1100.00%
Constants0
▷ Global constants00.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Using a strong compression for your PNG files is a great way to speed-up your plugin
PNG images were not found in this plugin