72% lawful-cookie-consent

Code Review | Lawful Cookie Consent

WordPress plugin Lawful Cookie Consent scored72%from 54 tests.

About plugin

  • Plugin page: lawful-cookie-con...
  • Plugin version: 2.0
  • PHP compatiblity: 5.2.4+
  • PHP version: 7.4.16
  • WordPress compatibility: 5.4-6.1.1
  • WordPress version: 6.3.1
  • First release: Apr 7, 2022
  • Latest release: Jun 14, 2023
  • Number of updates: 18
  • Update frequency: every 24.1 days
  • Top authors: walexconcepts (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /324 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
Installer ran successfully

Server metrics [RAM: ▲0.01MB] [CPU: ▼11.80ms] Passed 4 tests

Analyzing server-side resources used by Lawful Cookie Consent
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /3.49 ▲0.0336.48 ▼3.24
Dashboard /wp-admin3.32 ▼0.0246.34 ▼21.08
Posts /wp-admin/edit.php3.38 ▲0.0246.67 ▼7.04
Add New Post /wp-admin/post-new.php5.91 ▲0.0289.84 ▼15.82
Media Library /wp-admin/upload.php3.25 ▲0.0235.36 ▼0.55
Settings /wp-admin/admin.php?page=settings_lawful_cookie_consent3.2334.51
Help /wp-admin/admin.php?page=help_lawful_cookie_consent3.2133.99

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

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

Browser metrics Passed 4 tests

An overview of browser requirements for Lawful Cookie Consent
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,897 ▲13614.30 ▼0.306.38 ▲4.7949.55 ▲7.41
Dashboard /wp-admin2,224 ▲445.64 ▼0.0189.91 ▼1.4339.99 ▼5.21
Posts /wp-admin/edit.php2,129 ▲262.03 ▼0.0139.45 ▼3.2236.15 ▲0.99
Add New Post /wp-admin/post-new.php1,550 ▲2423.02 ▲1.54684.58 ▲4.9551.06 ▼2.27
Media Library /wp-admin/upload.php1,429 ▲264.19 ▼0.0396.52 ▼5.5942.83 ▼6.76
Settings /wp-admin/admin.php?page=settings_lawful_cookie_consent9411.9922.9326.94
Help /wp-admin/admin.php?page=help_lawful_cookie_consent8401.9921.5325.07

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
  • The uninstall procedure has failed, leaving 6 options in the database
    • widget_recent-posts
    • db_upgraded
    • can_compress_scripts
    • widget_recent-comments
    • theysaidso_admin_options
    • widget_theysaidso_widget

Smoke tests 25% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
Smoke test failed, please fix the following
    • > GET request to /wp-admin/admin.php?page=settings_lawful_cookie_consent
    • > User notice in wp-includes/functions.php+5905
    Function wpdb::prepare was called incorrectly. The query argument of wpdb::prepare() must have a placeholder. Please see Debugging in WordPress for more information. (This message was added in version 3.9.0.)

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
  • 1× PHP files output text when accessed directly:
    • > /wp-content/plugins/lawful-cookie-consent/admin/lawful_cookie_consent_help.php
  • 3× PHP files trigger server-side errors or warnings when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function register_activation_hook() in wp-content/plugins/lawful-cookie-consent/index.php:20
    • > PHP Fatal error
      Uncaught Error: Call to a member function get_results() on null in wp-content/plugins/lawful-cookie-consent/include/lawful_cookie_consent_myform.php:3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function admin_url() in wp-content/plugins/lawful-cookie-consent/admin/lawful_cookie_consent_myform.php:2

User-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
There were no browser issues found

Optimizations

Plugin configuration 93% from 29 tests

readme.txt Passed 16 tests

Don't ignore readme.txt as it is the file that instructs WordPress.org on how to present your plugin to the world
8 plugin tags: ccpa, cookie law, cookie banner, cookie consent, eu cookie law...

lawful-cookie-consent/index.php 85% from 13 tests

The main PHP script in "Lawful Cookie Consent" version 2.0 is automatically included on every request by WordPress
Please make the necessary changes and fix the following:
  • Main file name: Even though not officially enforced, the main plugin file should be the same as the plugin slug ("lawful-cookie-consent.php" instead of "index.php")
  • Description: Please don't use more than 140 characters for the plugin description (currently 207 characters long)

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
There were no executable files found in this plugin669 lines of code in 10 files:
LanguageFilesBlank linesComment linesLines of code
CSS2630354
PHP53412195
JavaScript2272108
SQL16012

PHP code Passed 2 tests

This is a very shot review of cyclomatic complexity and code structure
No cyclomatic complexity issues were detected for this plugin
Cyclomatic complexity
Average complexity per logical line of code0.16
Average class complexity0.00
▷ Minimum class complexity0.00
▷ Maximum class complexity0.00
Average method complexity0.00
▷ Minimum method complexity0.00
▷ Maximum method complexity0.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes0
▷ Abstract classes00.00%
▷ Concrete classes00.00%
▷ Final classes00.00%
Methods0
▷ Static methods00.00%
▷ Public methods00.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions7
▷ Named functions7100.00%
▷ Anonymous functions00.00%
Constants2
▷ Global constants2100.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 were not PNG files found in your plugin