79% wp-consent-api

Code Review | WP Consent API

WordPress plugin WP Consent API scored79%from 54 tests.

About plugin

  • Plugin page: wp-consent-api
  • Plugin version: 1.0.7
  • PHP compatiblity: 5.6+
  • PHP version: 7.4.16
  • WordPress compatibility: 5.0-6.3
  • WordPress version: 6.3.1
  • First release: Feb 6, 2020
  • Latest release: Sep 20, 2023
  • Number of updates: 18
  • Update frequency: every 73.6 days
  • Top authors: RogierLankhorst (100%)

Code review

54 tests

User reviews

1 review

Install metrics

900+ active /7,155 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
This plugin's installer ran successfully

Server metrics [RAM: ▲0.06MB] [CPU: ▼5.10ms] Passed 4 tests

Server-side resources used by WP Consent API
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /3.54 ▲0.0842.87 ▲2.61
Dashboard /wp-admin3.38 ▲0.0355.33 ▼4.00
Posts /wp-admin/edit.php3.49 ▲0.1345.90 ▲5.04
Add New Post /wp-admin/post-new.php5.96 ▲0.0782.54 ▼21.35
Media Library /wp-admin/upload.php3.30 ▲0.0735.15 ▲2.34

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

Analyzing filesystem and database footprints of this plugin
This plugin was installed successfully
Filesystem: 15 new files
Database: no new tables, 6 new options
New WordPress options
db_upgraded
widget_theysaidso_widget
widget_recent-comments
can_compress_scripts
theysaidso_admin_options
widget_recent-posts

Browser metrics Passed 4 tests

WP Consent API: an overview of browser usage
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,805 ▲5913.67 ▼0.921.94 ▲0.2242.38 ▲0.20
Dashboard /wp-admin2,209 ▲214.90 ▼0.04103.11 ▼3.7939.94 ▲1.92
Posts /wp-admin/edit.php2,092 ▲32.04 ▼0.0134.85 ▼6.2731.61 ▼6.37
Add New Post /wp-admin/post-new.php1,521 ▲423.47 ▲5.97665.36 ▲50.4158.46 ▲8.22
Media Library /wp-admin/upload.php1,388 ▼04.17 ▼0.0297.78 ▼1.3342.47 ▲1.75

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
You still need to fix the following
  • This plugin did not uninstall successfully, leaving 6 options in the database
    • widget_recent-comments
    • can_compress_scripts
    • theysaidso_admin_options
    • db_upgraded
    • widget_theysaidso_widget
    • widget_recent-posts

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no server-side errors were triggered
Everything seems fine, however this is by no means an exhaustive test

SRP 0% from 2 tests

🔹 Tests weight: 20 | A shallow check of the single-responsibility principle; PHP files should perform no action - including output of placeholder text - and trigger no errors when accessed directly
Please fix the following items
  • 5× PHP files output text when accessed directly:
    • > /wp-content/plugins/wp-consent-api/config.php
    • > /wp-content/plugins/wp-consent-api/site-health.php
    • > /wp-content/plugins/wp-consent-api/api.php
    • > /wp-content/plugins/wp-consent-api/wp-consent-api.php
    • > /wp-content/plugins/wp-consent-api/cookie-info.php
  • 1× PHP files trigger server-side errors or warnings when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/wp-consent-api/wordpress-comments.php:45

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
There were no browser issues found

Optimizations

Plugin configuration Passed 29 tests

readme.txt Passed 16 tests

It's important to format your readme.txt file correctly as it is parsed for the public listing of your plugin
5 plugin tags: compliance, privacy, consent, cookies, api

wp-consent-api/wp-consent-api.php Passed 13 tests

"WP Consent API" version 1.0.7's main PHP file describes plugin functionality and also serves as the entry point to any WordPress functionality
130 characters long description:
Consent Level API to read and register the current consent level for cookie management and improving compliance with privacy laws.

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short review of files and their extensions; it is not recommended to include executable files
There were no executable files found in this plugin637 lines of code in 13 files:
LanguageFilesBlank linesComment linesLines of code
PHP693492335
Markdown1610148
JavaScript2244258
JSON22047
XML171331
CSS13018

PHP code Passed 2 tests

A brief analysis of cyclomatic complexity and code structure for this plugin
No cyclomatic complexity issues were detected for this plugin
Cyclomatic complexity
Average complexity per logical line of code0.31
Average class complexity4.25
▷ Minimum class complexity2.00
▷ Maximum class complexity5.00
Average method complexity1.72
▷ Minimum method complexity1.00
▷ Maximum method complexity4.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes4
▷ Abstract classes00.00%
▷ Concrete classes4100.00%
▷ Final classes00.00%
Methods18
▷ Static methods211.11%
▷ Public methods1477.78%
▷ Protected methods00.00%
▷ Private methods422.22%
Functions18
▷ Named functions18100.00%
▷ Anonymous functions00.00%
Constants5
▷ Global constants5100.00%
▷ Class constants00.00%
▷ Public constants00.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