78% stop-referrer-spam

Code Review | Stop Referrer Spam

WordPress plugin Stop Referrer Spam scored78%from 54 tests.

About plugin

  • Plugin page: stop-referrer-spam
  • Plugin version: 1.3.2
  • PHP version: 7.4.16
  • WordPress compatibility: 4.0-6.3.1
  • WordPress version: 6.3.1
  • First release: Aug 7, 2015
  • Latest release: Sep 16, 2023
  • Number of updates: 36
  • Update frequency: every 82.3 days
  • Top authors: kwielo (100%)

Code review

54 tests

User reviews

14 reviews

Install metrics

1,000+ active /14,674 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: ▼6.69ms] Passed 4 tests

An overview of server-side resources used by Stop Referrer Spam
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /3.58 ▲0.1245.97 ▲5.46
Dashboard /wp-admin3.42 ▲0.0753.54 ▼14.23
Posts /wp-admin/edit.php3.53 ▲0.1751.90 ▼2.35
Add New Post /wp-admin/post-new.php6.00 ▲0.1189.64 ▼13.03
Media Library /wp-admin/upload.php3.34 ▲0.1143.35 ▲2.85
Referral Spam /wp-admin/options-general.php?page=srs-config3.7740.69

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

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

Browser metrics Passed 4 tests

Stop Referrer Spam: an overview of browser usage
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,793 ▲3214.17 ▼0.111.76 ▼0.1243.39 ▲2.12
Dashboard /wp-admin2,199 ▲195.70 ▲0.1286.10 ▼10.7137.14 ▼3.17
Posts /wp-admin/edit.php2,104 ▲41.98 ▲0.0434.79 ▼8.9634.92 ▼0.73
Add New Post /wp-admin/post-new.php1,531 ▲322.88 ▼0.26704.88 ▲19.2661.20 ▲10.84
Media Library /wp-admin/upload.php1,404 ▲74.19 ▲0.00100.31 ▼5.8944.33 ▼5.25
Referral Spam /wp-admin/options-general.php?page=srs-config5,4802.2628.7258.88

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
It is recommended to fix the following
  • Zombie WordPress options detected upon uninstall: 7 options
    • can_compress_scripts
    • theysaidso_admin_options
    • widget_recent-comments
    • db_upgraded
    • widget_recent-posts
    • widget_theysaidso_widget
    • WSRS_csrf_token

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the server (in the Apache logs)
Good news, no errors were detected

SRP 0% from 2 tests

🔹 Tests weight: 20 | It is important to ensure that your PHP files perform no action when accessed directly, respecting the single-responsibility principle
The following issues need your attention
  • 1× PHP files perform the action of outputting non-empty strings when accessed directly:
    • > /wp-content/plugins/stop-referrer-spam/stop-referrer-spam.php
  • 7× GET requests to PHP files trigger server-side errors or Error 500 responses:
    • > PHP Notice
      Undefined variable: data in wp-content/plugins/stop-referrer-spam/views/config-page.php on line 38
    • > PHP Warning
      array_key_exists() expects parameter 2 to be array, unknown given in wp-content/plugins/stop-referrer-spam/views/config-page.php on line 41
    • > PHP Notice
      Undefined variable: data in wp-content/plugins/stop-referrer-spam/views/config-page.php on line 41
    • > PHP Notice
      Undefined variable: data in wp-content/plugins/stop-referrer-spam/views/config-page.php on line 35
    • > PHP Warning
      array_key_exists() expects parameter 2 to be array, unknown given in wp-content/plugins/stop-referrer-spam/views/config-page.php on line 38
    • > PHP Warning
      array_key_exists() expects parameter 2 to be array, unknown given in wp-content/plugins/stop-referrer-spam/views/config-page.php on line 35
    • > PHP Fatal error
      Uncaught Error: Class 'WSRS_Helper' not found in wp-content/plugins/stop-referrer-spam/views/config-page.php:51

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
Everything seems fine, but this is not an exhaustive test

Optimizations

Plugin configuration 97% 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 your attention:
  • Tags: Please reduce the number of tags, currently 35 tag instead of maximum 10
You can look at the official readme.txt

stop-referrer-spam/stop-referrer-spam.php Passed 13 tests

The principal PHP file in "Stop Referrer Spam" v. 1.3.2 is loaded by WordPress automatically on each request
63 characters long description:
Blocks unwanted referral spam that mess up your analytics data!

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is an overview of programming languages used in this plugin; dangerous file extensions are not allowed
Good job! No executable or dangerous file extensions detected572 lines of code in 9 files:
LanguageFilesBlank linesComment linesLines of code
PHP9108110572

PHP code Passed 2 tests

This plugin's cyclomatic complexity and code structure detailed below
There are no cyclomatic complexity problems detected for this plugin
Cyclomatic complexity
Average complexity per logical line of code0.28
Average class complexity7.29
▷ Minimum class complexity1.00
▷ Maximum class complexity15.00
Average method complexity2.05
▷ Minimum method complexity1.00
▷ Maximum method complexity6.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes7
▷ Abstract classes00.00%
▷ Concrete classes7100.00%
▷ Final classes00.00%
Methods42
▷ Static methods1330.95%
▷ Public methods3992.86%
▷ Protected methods00.00%
▷ Private methods37.14%
Functions0
▷ Named functions00.00%
▷ Anonymous functions00.00%
Constants10
▷ Global constants220.00%
▷ Class constants880.00%
▷ Public constants787.50%

Plugin size Passed 2 tests

Image compression Passed 2 tests

PNG files should be compressed to save space and minimize bandwidth usage
No PNG files were detected