10% wp-block-referrer-spam

Code Review | WP Block Referrer Spam

WordPress plugin WP Block Referrer Spam scored10%from 54 tests.

About plugin

  • Plugin page: wp-block-referrer...
  • Plugin version: 1.4
  • PHP version: 7.4.16
  • WordPress compatibility: 3.2-4.2.2
  • WordPress version: 6.3.1
  • First release: Jul 11, 2015
  • Latest release: Jul 20, 2015
  • Number of updates: 23
  • Update frequency: every 0.5 days
  • Top authors: barragan (100%)

Code review

54 tests

User reviews

4 reviews

Install metrics

100+ active /3,855 total downloads

Benchmarks

Plugin footprint 57% from 16 tests

Installer 0% from 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
It is recommended to fix the following installer errors
  • Install procedure validation failed for this plugin
    • > Deprecated in wp-content/plugins/wp-block-referrer-spam/controllers/wpbrs-controller-blocker.php+188
    Array and string offset access syntax with curly braces is deprecated

Server metrics [RAM: ▲0.37MB] [CPU: ▼6.47ms] Passed 4 tests

A check of server-side resources used by WP Block Referrer Spam
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /3.83 ▲0.3743.64 ▼1.11
Dashboard /wp-admin3.73 ▲0.3946.81 ▼14.27
Posts /wp-admin/edit.php3.78 ▲0.4253.33 ▲7.59
Add New Post /wp-admin/post-new.php6.25 ▲0.3687.64 ▼12.09
Media Library /wp-admin/upload.php3.59 ▲0.3636.56 ▲1.61
Block Referrer Spam /wp-admin/tools.php?page=wp-block-referrer-spam3.6834.06

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

Analyzing filesystem and database footprints of this plugin
These are issues you should consider
  • The plugin illegally modified 1 file (118.15KB) outside of "wp-content/plugins/wp-block-referrer-spam/" and "wp-content/uploads/"
    • (modified) .htaccess
Filesystem: 24 new files
Database: no new tables, 7 new options
New WordPress options
wp-block-referrer-spam
widget_theysaidso_widget
widget_recent-comments
theysaidso_admin_options
can_compress_scripts
widget_recent-posts
db_upgraded

Browser metrics Passed 4 tests

A check of browser resources used by WP Block Referrer Spam
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,818 ▲3214.27 ▼0.082.03 ▼0.0446.06 ▲4.07
Dashboard /wp-admin2,199 ▲195.61 ▼0.0389.99 ▲1.9138.94 ▲1.97
Posts /wp-admin/edit.php2,104 ▲41.97 ▼0.0434.21 ▼3.6533.77 ▼1.99
Add New Post /wp-admin/post-new.php1,529 ▲323.20 ▲0.22680.67 ▲7.7650.63 ▼6.72
Media Library /wp-admin/upload.php1,404 ▲44.19 ▼0.0594.68 ▼7.7444.92 ▼2.16
Block Referrer Spam /wp-admin/tools.php?page=wp-block-referrer-spam8881.7527.6345.32

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
Please fix the following items
  • This plugin does not fully uninstall, leaving 6 options in the database
    • can_compress_scripts
    • widget_recent-posts
    • db_upgraded
    • widget_theysaidso_widget
    • theysaidso_admin_options
    • widget_recent-comments

Smoke tests 75% 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 50% from 2 tests

🔹 Tests weight: 20 | The single-responsibility principle applies for WordPress plugins as well - please make sure your PHP files perform no actions when accessed directly
Please fix the following
  • 13× GET requests to PHP files have triggered server-side errors or warnings (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_html_e() in wp-content/plugins/wp-block-referrer-spam/views/page-settings/page-settings.php:7
    • > PHP Fatal error
      Uncaught Error: Class 'WPBRS_Controller' not found in wp-content/plugins/wp-block-referrer-spam/controllers/wpbrs-controller-admin-notices.php:14
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_html() in wp-content/plugins/wp-block-referrer-spam/views/errors/requirements-error.php:13
    • > PHP Fatal error
      Uncaught Error: Class 'WPBRS_Model' not found in wp-content/plugins/wp-block-referrer-spam/models/wpbrs-model-admin-notices.php:14
    • > PHP Fatal error
      Uncaught Error: Class 'WPBRS_Controller' not found in wp-content/plugins/wp-block-referrer-spam/controllers/wpbrs-controller-settings.php:14
    • > PHP Fatal error
      Uncaught Error: Call to undefined function __() in wp-content/plugins/wp-block-referrer-spam/views/errors/htaccess-error.php:3
    • > PHP Fatal error
      Uncaught Error: Class 'WPBRS_Controller' not found in wp-content/plugins/wp-block-referrer-spam/controllers/wpbrs-controller-cron.php:14
    • > PHP Warning
      Use of undefined constant WPBRS_REQUIRED_WP_VERSION - assumed 'WPBRS_REQUIRED_WP_VERSION' (this will throw an Error in a future version of PHP) in wp-content/plugins/wp-block-referrer-spam/views/errors/requirements-error.php on line 12
    • > PHP Fatal error
      Uncaught Error: Class 'WPBRS_Controller' not found in wp-content/plugins/wp-block-referrer-spam/controllers/wpbrs-controller-blocker.php:14
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_attr_e() in wp-content/plugins/wp-block-referrer-spam/views/page-settings/page-settings-fields.php:1

User-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
No browser errors were detected

Optimizations

Plugin configuration 97% from 29 tests

readme.txt 94% from 16 tests

Perhaps the most important file in your plugin readme.txt gets parsed in order to generate the public listing of your plugin
These attributes need to be fixed:
  • Tags: Too many tags (33 tag instead of maximum 10); only the first 5 tags are used in your directory listing
You can look at the official readme.txt

wp-block-referrer-spam/wp-block-referrer-spam.php Passed 13 tests

The main file in "WP Block Referrer Spam" v. 1.4 serves as a complement to information provided in readme.txt and as the entry point to the plugin
104 characters long description:
Blocks referrer spammers from a community-contributed list. Keep your analytics data clean and accurate.

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short check of programming languages and file extensions; no executable files are allowed
No dangerous file extensions were detected819 lines of code in 20 files:
LanguageFilesBlank linesComment linesLines of code
PHP19396650724
JavaScript148095

PHP code Passed 2 tests

This is a very shot review of cyclomatic complexity and code structure
Great job! No cyclomatic complexity issues were detected in this plugin
Cyclomatic complexity
Average complexity per logical line of code0.36
Average class complexity8.55
▷ Minimum class complexity1.00
▷ Maximum class complexity34.00
Average method complexity2.26
▷ Minimum method complexity1.00
▷ Maximum method complexity11.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes11
▷ Abstract classes218.18%
▷ Concrete classes981.82%
▷ Final classes00.00%
Methods71
▷ Static methods3042.25%
▷ Public methods4259.15%
▷ Protected methods2129.58%
▷ Private methods811.27%
Functions4
▷ Named functions4100.00%
▷ Anonymous functions00.00%
Constants16
▷ Global constants212.50%
▷ Class constants1487.50%
▷ Public constants14100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Using a strong compression for your PNG files is a great way to speed-up your plugin
There are no PNG files in this plugin