10% watermark-hotlink-protection

Code Review | Watermark Hotlink Protection

WordPress plugin Watermark Hotlink Protection scored10%from 54 tests.

About plugin

  • Plugin page: watermark-hotlink...
  • Plugin version: 1.0
  • PHP version: 7.4.16
  • WordPress compatibility: 3.3-3.5.1
  • WordPress version: 6.3.1
  • First release: May 22, 2013
  • Latest release: May 22, 2013
  • Number of updates: 3
  • Update frequency: every 0.3 days
  • Top authors: MyWebsiteAdvisor (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /1,981 total downloads

Benchmarks

Plugin footprint 40% from 16 tests

Installer 0% from 1 test

🔺 Critical test (weight: 50) | Verifying that this plugin installs correctly without errors
It is recommended to fix the following installer errors
  • The plugin cannot be installed
    • > Notice in wp-content/plugins/watermark-hotlink-protection/watermark-hotlink-protection-loader.php+43
    Undefined index: action

Server metrics [RAM: ▼0.62MB] [CPU: ▼32.51ms] Passed 4 tests

An overview of server-side resources used by Watermark Hotlink Protection
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /3.92 ▲0.4542.80 ▲0.03
Dashboard /wp-admin3.32 ▲0.0227.80 ▼25.84
Posts /wp-admin/edit.php3.32 ▼0.0329.58 ▼25.36
Add New Post /wp-admin/post-new.php3.32 ▼2.5631.04 ▼64.40
Media Library /wp-admin/upload.php3.32 ▲0.0924.68 ▼14.43
Watermark Hotlink Protection /wp-admin/options-general.php?page=watermark-hotlink-protection-settings3.3228.09

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

A short overview of filesystem and database impact
This plugin was installed successfully
Filesystem: 19 new files
Database: no new tables, 6 new options
New WordPress options
can_compress_scripts
db_upgraded
widget_recent-posts
widget_theysaidso_widget
widget_recent-comments
theysaidso_admin_options

Browser metrics Passed 4 tests

This is an overview of browser requirements for Watermark Hotlink Protection
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,829 ▲8313.25 ▼1.342.15 ▲0.2742.72 ▼3.16
Dashboard /wp-admin2,213 ▲224.85 ▼0.25112.27 ▲6.0642.28 ▼0.08
Posts /wp-admin/edit.php2,096 ▲42.00 ▲0.0240.45 ▼1.5834.80 ▼3.57
Add New Post /wp-admin/post-new.php1,517 ▼1617.44 ▼5.80659.43 ▼14.9749.76 ▼2.38
Media Library /wp-admin/upload.php1,392 ▲74.18 ▼0.0299.45 ▼2.7843.95 ▲1.02
Watermark Hotlink Protection /wp-admin/options-general.php?page=watermark-hotlink-protection-settings1,3964.88127.9444.54

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

🔸 Tests weight: 35 | It is important to correctly uninstall your plugin, without leaving any traces
These items require your attention
  • This plugin cannot be uninstalled
    • > Notice in wp-content/plugins/watermark-hotlink-protection/watermark-hotlink-protection-plugin.php+104
    Trying to access array offset on value of type bool
  • Zombie WordPress options were found after uninstall: 6 options
    • widget_recent-comments
    • db_upgraded
    • widget_recent-posts
    • widget_theysaidso_widget
    • theysaidso_admin_options
    • can_compress_scripts

Smoke tests 50% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
Almost there, just fix the following server-side errors
    • > GET request to /wp-admin/options-general.php?page=watermark-hotlink-protection-settings
    • > Notice in wp-content/plugins/watermark-hotlink-protection/watermark-hotlink-protection-plugin.php+104
    Trying to access array offset on value of type bool
    • > GET request to /wp-admin/options-general.php?page=watermark-hotlink-protection-settings
    • > Notice in wp-content/plugins/watermark-hotlink-protection/watermark-hotlink-protection-plugin.php+104
    Trying to access array offset on value of type null

SRP 50% from 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
Please take a closer look at the following
  • 4× PHP files trigger server errors when accessed directly:
    • > PHP Warning
      require_once(ABSPATH/wp-admin/includes/admin.php): failed to open stream: No such file or directory in wp-content/plugins/watermark-hotlink-protection/watermark-hotlink-protection-plugin-installer.php on line 7
    • > PHP Fatal error
      Uncaught Error: Call to undefined function register_activation_hook() in wp-content/plugins/watermark-hotlink-protection/watermark-hotlink-protection-loader.php:11
    • > PHP Fatal error
      require_once(): Failed opening required 'ABSPATH/wp-admin/includes/admin.php' (include_path='.:/usr/share/php') in wp-content/plugins/watermark-hotlink-protection/watermark-hotlink-protection-plugin-installer.php on line 7
    • > PHP Warning
      Use of undefined constant ABSPATH - assumed 'ABSPATH' (this will throw an Error in a future version of PHP) in wp-content/plugins/watermark-hotlink-protection/watermark-hotlink-protection-plugin-installer.php on line 7

User-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
Everything seems fine on the user side

Optimizations

Plugin configuration 90% from 29 tests

readme.txt 88% from 16 tests

The readme.txt file is undoubtedly the most important file in your plugin, preparing it for public listing on WordPress.org
Please fix the following attributes:
  • Screenshots: Add images for these screenshots: #1 (General Watermark Settings Page), #2 (Image Watermark Settings Page), #3 (Text Watermark Settings Page), #4 (Watermark Preview Page)
  • Tags: You are using too many tags: 17 tag instead of maximum 10
You can take inspiration from this readme.txt

watermark-hotlink-protection/watermark-hotlink-protection-loader.php 92% from 13 tests

The main PHP script in "Watermark Hotlink Protection" version 1.0 is automatically included on every request by WordPress
Please take the time to fix the following:
  • Main file name: It is recommended to name the main PHP file as the plugin slug ("watermark-hotlink-protection.php" instead of "watermark-hotlink-protection-loader.php")

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
No dangerous file extensions were detected1,401 lines of code in 5 files:
LanguageFilesBlank linesComment linesLines of code
PHP58802951,401

PHP code Passed 2 tests

Analyzing logical lines of code, cyclomatic complexity, and other code metrics
Although this was not an exhaustive test, there were no cyclomatic complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.28
Average class complexity39.50
▷ Minimum class complexity29.00
▷ Maximum class complexity46.00
Average method complexity3.23
▷ Minimum method complexity1.00
▷ Maximum method complexity19.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes4
▷ Abstract classes00.00%
▷ Concrete classes4100.00%
▷ Final classes00.00%
Methods69
▷ Static methods00.00%
▷ Public methods5275.36%
▷ Protected methods00.00%
▷ Private methods1724.64%
Functions9
▷ Named functions9100.00%
▷ Anonymous functions00.00%
Constants1
▷ Global constants1100.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
1 PNG file occupies 0.06MB with 0.03MB in potential savings
Potential savings
Compression of 1 random PNG file using pngquant
FileSize - originalSize - compressedSavings
watermark-logo.png56.70KB28.29KB▼ 50.10%