77% block-referer-spam

Code Review | Block Referer Spam

WordPress plugin Block Referer Spam scored 77% from 54 tests.

About plugin

  • Plugin page: block-referer-spam
  • Plugin version: 1.1.9.4
  • PHP version: 7.4.16
  • WordPress compatibility: 3.0.2-5.8
  • WordPress version: 5.8.1
  • First release: Jul 16, 2015
  • Latest release: Jun 27, 2021
  • Number of updates: 65
  • Update frequency: every 33.4 days
  • Top authors: supersoju (52.31%)codestic (49.23%)

Code review

54 tests

User reviews

20 reviews

Install metrics

1,000+ active / 19,226 total downloads

Benchmarks

Plugin footprint 82% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
This plugin's installer ran successfully

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

Server-side resources used by Block Referer Spam
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /2.85 ▲0.1329.57 ▲3.24
Dashboard /wp-admin3.09 ▲0.0344.14 ▲1.40
Posts /wp-admin/edit.php3.15 ▲0.0544.65 ▲4.14
Add New Post /wp-admin/post-new.php5.46 ▲0.0387.41 ▼557.70
Media Library /wp-admin/upload.php3.04 ▲0.0431.65 ▼0.22
All Blocked Sites /wp-admin/admin.php?page=ref-spam-list3.0833.15
Referer Spam /wp-admin/admin.php?page=ref-spam-block3.1231.27

Server storage [IO: ▲0.65MB] [DB: ▲0.02MB] 67% from 3 tests

Input-output and database impact of this plugin
These are issues you should consider
  • You have illegally modified 2 files (119.90KB) outside of "wp-content/plugins/block-referer-spam/" and "wp-content/uploads/"
    • (modified) .htaccess
    • (new file) .htaccess.bak
Filesystem: 28 new files
Database: no new tables, 2 new options
New WordPress options
ref-blocker-list
ref-blocker-updated

Browser metrics Passed 4 tests

An overview of browser requirements for Block Referer Spam
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,713 ▲11715.95 ▲0.329.13 ▲0.3047.48 ▼5.31
Dashboard /wp-admin2,998 ▲645.90 ▼0.09138.32 ▼4.48107.64 ▼12.92
Posts /wp-admin/edit.php2,773 ▲342.71 ▼0.0169.46 ▲3.4793.44 ▲2.10
Add New Post /wp-admin/post-new.php1,694 ▲2218.80 ▲0.04365.96 ▲5.78112.16 ▲7.11
Media Library /wp-admin/upload.php1,844 ▲375.05 ▼0.01151.07 ▲3.06120.62 ▼1.99
All Blocked Sites /wp-admin/admin.php?page=ref-spam-list11,3802.3070.28110.72
Referer Spam /wp-admin/admin.php?page=ref-spam-block1,4552.0956.4787.16

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

🔸 Tests weight: 35 | All plugins must uninstall correctly, removing their source code and extra database tables they might have created
Please fix the following items
  • Zombie WordPress options detected upon uninstall: 2 options
    • ref-blocker-updated
    • ref-blocker-list

Smoke tests 50% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | This is a short smoke test looking for server-side errors
These errors were triggered by the plugin
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=ref-spam-block
    • > Notice in wp-content/plugins/block-referer-spam/admin/dashboard.php+206
    Undefined variable: _SESSION

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
The following issues need your attention
  • 7× GET requests to PHP files have triggered server-side errors or warnings:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function _e() in wp-content/plugins/block-referer-spam/admin/pro-options.php:2
    • > PHP Fatal error
      Uncaught Error: Call to undefined function _e() in wp-content/plugins/block-referer-spam/admin/blocked-list.php:2
    • > PHP Fatal error
      Uncaught Error: Call to undefined function _e() in wp-content/plugins/block-referer-spam/admin/dashboard.php:2
    • > PHP Warning
      Use of undefined constant REFSPAMBLOCKER_PATH - assumed 'REFSPAMBLOCKER_PATH' (this will throw an Error in a future version of PHP) in wp-content/plugins/block-referer-spam/ref-spam-blocker.php on line 43
    • > PHP Fatal error
      require_once(): Failed opening required 'REFSPAMBLOCKER_PATHlib/RefSpamBlocker.php' (include_path='.:/usr/share/php') in wp-content/plugins/block-referer-spam/ref-spam-blocker.php on line 43
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_attr_e() in wp-content/plugins/block-referer-spam/admin/_sidebar.php:2
    • > PHP Warning
      require_once(REFSPAMBLOCKER_PATHlib/RefSpamBlocker.php): failed to open stream: No such file or directory in wp-content/plugins/block-referer-spam/ref-spam-blocker.php on line 43

User-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the browser (console and network errors and warnings)
No browser errors were detected

Optimizations

Plugin configuration 83% from 29 tests

readme.txt 88% from 16 tests

The readme.txt file describes your plugin functionality and requirements and it is parsed to prepare the your plugin's listing
Attributes that need to be fixed:
  • Tags: There are too many tags (33 tag instead of maximum 10)
  • Screenshots: Screenshot #1 (Admin Interface) image required
You can look at the official readme.txt

block-referer-spam/ref-spam-blocker.php 77% from 13 tests

The entry point to "Block Referer Spam" version 1.1.9.4 is a PHP file that has certain tags in its header comment area
The following require your attention:
  • Text Domain: If you choose to specify the text domain, it must be the same as the plugin slug; optional since WordPress version 4.6
  • Domain Path: The domain path folder does not exist ("/languages")
  • Main file name: The principal plugin file should be the same as the plugin slug ("block-referer-spam.php" instead of "ref-spam-blocker.php")

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 detected2,600 lines of code in 15 files:
LanguageFilesBlank linesComment linesLines of code
PHP122345732,191
PO File28483386
CSS14323

PHP code Passed 2 tests

An short overview of logical lines of code, cyclomatic complexity, and other code metrics
This plugin has no cyclomatic complexity issues
Cyclomatic complexity
Average complexity per logical line of code0.47
Average class complexity103.67
▷ Minimum class complexity33.00
▷ Maximum class complexity211.00
Average method complexity6.60
▷ Minimum method complexity1.00
▷ Maximum method complexity33.00
Code structure
Namespaces1
Interfaces0
Traits0
Classes3
▷ Abstract classes00.00%
▷ Concrete classes3100.00%
▷ Final classes00.00%
Methods55
▷ Static methods1018.18%
▷ Public methods2443.64%
▷ Protected methods1730.91%
▷ Private methods1425.45%
Functions4
▷ Named functions4100.00%
▷ Anonymous functions00.00%
Constants8
▷ Global constants8100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

PNG files should be compressed to save space and minimize bandwidth usage
2 PNG files occupy 0.41MB with 0.24MB in potential savings
Potential savings
Compression of 2 random PNG files using pngquant
FileSize - originalSize - compressedSavings
screenshot-1.png407.50KB134.26KB▼ 67.05%
assets/images/brand.png10.70KB5.52KB▼ 48.46%