88% bot-block-stop-spam-google-analytics-referrals

Code Review | Bot Block - Stop Spam Referrals in Google Analytics

WordPress plugin Bot Block - Stop Spam Referrals in Google Analytics scored 88% from 54 tests.

About plugin

  • Plugin page: bot-block-stop-sp...
  • Plugin version: 2.6
  • PHP version: 7.4.16
  • WordPress compatibility: 3.9-4.4.2
  • WordPress version: 5.8.1
  • First release: Jul 27, 2015
  • Latest release: Feb 24, 2016
  • Number of updates: 37
  • Update frequency: every 6.8 days
  • Top authors: ThisWebGuy (100%)

Code review

54 tests

User reviews

17 reviews

Install metrics

2,000+ active / 16,642 total downloads

Benchmarks

Plugin footprint Passed 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | It is important to correctly install your plugin, without throwing errors or notices
Installer ran successfully

Server metrics [RAM: ▲0.08MB] [CPU: ▼138.93ms] Passed 4 tests

A check of server-side resources used by Bot Block - Stop Spam Referrals in Google Analytics
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /3.01 ▲0.1831.33 ▲0.94
Dashboard /wp-admin3.14 ▲0.0847.04 ▲1.13
Posts /wp-admin/edit.php3.19 ▲0.0845.34 ▲0.05
Add New Post /wp-admin/post-new.php5.50 ▲0.0689.31 ▼551.77
Media Library /wp-admin/upload.php3.08 ▲0.0830.83 ▼4.94
Bot Block Options /wp-admin/options-general.php?page=bot_block3.0334.00

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

Input-output and database impact of this plugin
This plugin installed successfully
Filesystem: 4 new files
Database: 2 new tables, 1 new option
New tables
wp_bot_block_log
wp_bot_block_block_list
New WordPress options
bot_block

Browser metrics Passed 4 tests

Checking browser requirements for Bot Block - Stop Spam Referrals in Google Analytics
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,697 ▲10115.81 ▲0.127.79 ▼4.4452.56 ▲4.82
Dashboard /wp-admin2,972 ▲415.96 ▼0.03144.08 ▼0.11108.38 ▼2.02
Posts /wp-admin/edit.php2,744 ▲52.72 ▲0.0068.89 ▲2.2291.23 ▲9.75
Add New Post /wp-admin/post-new.php1,503 ▼18018.58 ▼0.15379.99 ▼23.59114.54 ▲8.41
Media Library /wp-admin/upload.php1,815 ▲85.04 ▼0.00160.47 ▼7.62112.32 ▼8.09
Bot Block Options /wp-admin/options-general.php?page=bot_block2,1154.8881.60102.36

Uninstaller [IO: ▲0.00MB] [DB: ▲0.00MB] Passed 4 tests

🔸 Tests weight: 35 | The uninstall procedure must remove all plugin files and extra database tables
Uninstall script ran successfully

Smoke tests 50% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the server (in the Apache logs)
These server-side errors were triggered
    • > GET request to /wp-admin/options-general.php?page=bot_block
    • > Warning in wp-content/plugins/bot-block-stop-spam-google-analytics-referrals/bot-block.php+566
    date() expects parameter 2 to be int, string given

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
  • 3× PHP files trigger server-side errors or warnings when accessed directly:
    • > PHP Warning
      require_once(ABSPATHwp-admin/includes/upgrade.php): failed to open stream: No such file or directory in wp-content/plugins/bot-block-stop-spam-google-analytics-referrals/bot-block.php on line 21
    • > PHP Fatal error
      require_once(): Failed opening required 'ABSPATHwp-admin/includes/upgrade.php' (include_path='.:/usr/share/php') in wp-content/plugins/bot-block-stop-spam-google-analytics-referrals/bot-block.php on line 21
    • > PHP Warning
      Use of undefined constant ABSPATH - assumed 'ABSPATH' (this will throw an Error in a future version of PHP) in wp-content/plugins/bot-block-stop-spam-google-analytics-referrals/bot-block.php on line 21

User-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
Everything seems fine, but this is not an exhaustive test

Optimizations

Plugin configuration 93% 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 delete some tags, you are using 14 tag instead of maximum 10
Please take inspiration from this readme.txt

bot-block-stop-spam-google-analytics-referrals/bot-block.php 92% from 13 tests

"Bot Block - Stop Spam Referrals in Google Analytics" version 2.6's main PHP file describes plugin functionality and also serves as the entry point to any WordPress functionality
It is important to fix the following:
  • Main file name: Even though not officially enforced, the main plugin file should be the same as the plugin slug ("bot-block-stop-spam-google-analytics-referrals.php" instead of "bot-block.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | Executable files are not allowed as they can serve as attack vectors
Good job! No executable or dangerous file extensions detected596 lines of code in 2 files:
LanguageFilesBlank linesComment linesLines of code
PHP1124111566
CSS14030

PHP code Passed 2 tests

Analyzing logical lines of code, cyclomatic complexity, and other code metrics
No complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.26
Average class complexity46.00
▷ Minimum class complexity46.00
▷ Maximum class complexity46.00
Average method complexity3.14
▷ Minimum method complexity1.00
▷ Maximum method complexity10.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes1
▷ Abstract classes00.00%
▷ Concrete classes1100.00%
▷ Final classes00.00%
Methods21
▷ Static methods00.00%
▷ Public methods21100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions2
▷ Named functions2100.00%
▷ Anonymous functions00.00%
Constants3
▷ Global constants3100.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
1 PNG file occupies 0.03MB with 0.01MB in potential savings
Potential savings
Compression of 1 random PNG file using pngquant
FileSize - originalSize - compressedSavings
analyticsbanner.png27.32KB12.17KB▼ 55.47%