79% referer-spam-blocker

Code Review | Referer Spam Blocker

WordPress plugin Referer Spam Blocker scored79%from 54 tests.

About plugin

  • Plugin page: referer-spam-blocker
  • Plugin version: 0.4
  • PHP version: 7.4.16
  • WordPress compatibility: 4.2-6.4
  • WordPress version: 6.3.1
  • First release: Jul 9, 2015
  • Latest release: Jul 31, 2023
  • Number of updates: 11
  • Update frequency: every 267.6 days
  • Top authors: wpmaintainer (63.64%)theandystratton (45.45%)

Code review

54 tests

User reviews

2 reviews

Install metrics

100+ active /2,460 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Verifying that this plugin installs correctly without errors
Installer ran successfully

Server metrics [RAM: ▲0.03MB] [CPU: ▼1.63ms] Passed 4 tests

A check of server-side resources used by Referer Spam Blocker
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /3.49 ▲0.0336.46 ▼5.86
Dashboard /wp-admin3.34 ▲0.0448.63 ▲0.34
Posts /wp-admin/edit.php3.39 ▲0.0345.91 ▼1.66
Add New Post /wp-admin/post-new.php5.92 ▲0.0393.27 ▲0.66
Media Library /wp-admin/upload.php3.26 ▲0.0337.98 ▲2.55
Referer Spam Blocker /wp-admin/options-general.php?page=wpm-rsb3.2331.74

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

Filesystem and database footprint
The plugin installed successfully
Filesystem: 9 new files
Database: no new tables, 7 new options
New WordPress options
db_upgraded
can_compress_scripts
widget_theysaidso_widget
widget_recent-comments
rsb_domain_list
widget_recent-posts
theysaidso_admin_options

Browser metrics Passed 4 tests

Referer Spam Blocker: an overview of browser usage
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,804 ▲3313.19 ▼1.191.66 ▼0.2339.95 ▼5.83
Dashboard /wp-admin2,213 ▲254.87 ▼1.19110.36 ▼4.1842.08 ▼3.73
Posts /wp-admin/edit.php2,093 ▲41.98 ▼0.0236.49 ▲1.4535.44 ▼0.96
Add New Post /wp-admin/post-new.php1,545 ▲2418.23 ▼5.07643.17 ▼74.0656.72 ▲0.63
Media Library /wp-admin/upload.php1,392 ▲104.20 ▲0.0194.57 ▼13.7642.35 ▼4.14
Referer Spam Blocker /wp-admin/options-general.php?page=wpm-rsb1,2672.0424.3123.71

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

🔸 Tests weight: 35 | All plugins must uninstall correctly, removing their source code and extra database tables they might have created
You still need to fix the following
  • This plugin does not fully uninstall, leaving 7 options in the database
    • theysaidso_admin_options
    • widget_theysaidso_widget
    • widget_recent-posts
    • can_compress_scripts
    • db_upgraded
    • rsb_domain_list
    • widget_recent-comments

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for server-side errors
Even though everything seems fine, this is not an exhaustive test

SRP 0% 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 fix the following items
  • 2× PHP files output text when accessed directly:
    • > /wp-content/plugins/referer-spam-blocker/views/admin-part-delete.php
    • > /wp-content/plugins/referer-spam-blocker/views/access-denied.php
  • 5× 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/referer-spam-blocker/lib/referer-spam-blocker-admin.php:14
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/referer-spam-blocker/lib/referer-spam-blocker.php:35
    • > PHP Fatal error
      Uncaught Error: Call to undefined function wp_nonce_field() in wp-content/plugins/referer-spam-blocker/views/admin-add-item.php:14
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/referer-spam-blocker/lib/referer-spam-blocker-admin.php:14
    • > PHP Fatal error
      Uncaught Error: Call to undefined function wp_nonce_field() in wp-content/plugins/referer-spam-blocker/views/admin-add-item.php:14

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

Often overlooked, readme.txt is one of the most important files in your plugin
6 plugin tags: block, domain, referer spam, referer, blacklist...

referer-spam-blocker/referer-spam-blocker.php Passed 13 tests

The entry point to "Referer Spam Blocker" version 0.4 is a PHP file that has certain tags in its header comment area
89 characters long description:
Blocks most common HTTP referer spam domains and allows you to easily add custom domains.

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is an overview of file extensions present in this plugin and a short test that no dangerous files are bundled with this plugin
There were no executable files found in this plugin315 lines of code in 8 files:
LanguageFilesBlank linesComment linesLines of code
PHP87523315

PHP code Passed 2 tests

An short overview of logical lines of code, cyclomatic complexity, and other code metrics
Everything seems fine, there were no complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.42
Average class complexity17.50
▷ Minimum class complexity10.00
▷ Maximum class complexity25.00
Average method complexity3.54
▷ Minimum method complexity1.00
▷ Maximum method complexity19.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes2
▷ Abstract classes00.00%
▷ Concrete classes2100.00%
▷ Final classes00.00%
Methods13
▷ Static methods753.85%
▷ Public methods1184.62%
▷ Protected methods00.00%
▷ Private methods215.38%
Functions0
▷ Named functions00.00%
▷ Anonymous functions00.00%
Constants0
▷ Global constants00.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