79% cookielay

Code Review | Cookielay

WordPress plugin Cookielay scored79%from 54 tests.

About plugin

  • Plugin page: cookielay
  • Plugin version: 1.2.0
  • PHP compatiblity: 5.4+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.9-6.3
  • WordPress version: 6.3.1
  • First release: Mar 24, 2021
  • Latest release: Aug 9, 2023
  • Number of updates: 35
  • Update frequency: every 24.8 days
  • Top authors: iamjonasmarlo (100%)

Code review

54 tests

User reviews

3 reviews

Install metrics

800+ active /7,574 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
The plugin installed successfully, without throwing any errors or notices

Server metrics [RAM: ▲0.36MB] [CPU: ▲0.86ms] Passed 4 tests

An overview of server-side resources used by Cookielay
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /3.83 ▲0.3742.07 ▲3.59
Dashboard /wp-admin3.73 ▲0.3957.26 ▼0.03
Posts /wp-admin/edit.php3.78 ▲0.4252.07 ▲4.13
Add New Post /wp-admin/post-new.php6.24 ▲0.3693.32 ▼1.58
Media Library /wp-admin/upload.php3.57 ▲0.3435.82 ▲1.48
Settings /wp-admin/admin.php?page=cookielay-settings3.6840.26
Shortcodes /wp-admin/admin.php?page=cookielay-shortcodes3.5838.09
Dashboard /wp-admin/admin.php?page=cookielay3.5837.71
Cookies /wp-admin/admin.php?page=cookielay-cookies3.5838.09
Text /wp-admin/admin.php?page=cookielay-text3.6338.48
Premium /wp-admin/admin.php?page=cookielay-prime3.5835.82
Style /wp-admin/admin.php?page=cookielay-style3.6636.93
Help & Support /wp-admin/admin.php?page=cookielay-help3.5849.22

Server storage [IO: ▲12.13MB] [DB: ▲0.01MB] Passed 3 tests

Filesystem and database footprint
There were no storage issued detected upon installing this plugin
Filesystem: 618 new files
Database: 2 new tables, 12 new options
New tables
wp_cookielay_cookies
wp_cookielay_groups
New WordPress options
db_upgraded
widget_theysaidso_widget
cookielay_status
cookielay_settings_style
theysaidso_admin_options
can_compress_scripts
widget_recent-comments
widget_recent-posts
cookielay_settings_text
cookielay_version
...

Browser metrics Passed 4 tests

This is an overview of browser requirements for Cookielay
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,065 ▲31917.31 ▲2.751.70 ▼0.0244.54 ▲6.51
Dashboard /wp-admin2,465 ▲2778.61 ▲3.73156.92 ▲51.1339.88 ▼3.51
Posts /wp-admin/edit.php2,381 ▲2925.81 ▲3.8093.93 ▲55.9832.05 ▼0.94
Add New Post /wp-admin/post-new.php1,588 ▲7425.19 ▲7.67657.81 ▼15.1734.39 ▼34.23
Media Library /wp-admin/upload.php1,512 ▲1276.05 ▲1.82124.04 ▲13.1344.95 ▼3.58
Settings /wp-admin/admin.php?page=cookielay-settings1,8265.5688.1884.98
Shortcodes /wp-admin/admin.php?page=cookielay-shortcodes1,4605.4153.9889.52
Dashboard /wp-admin/admin.php?page=cookielay1,4705.4453.5991.07
Cookies /wp-admin/admin.php?page=cookielay-cookies1,5065.4454.4166.26
Text /wp-admin/admin.php?page=cookielay-text1,8125.4454.1739.04
Premium /wp-admin/admin.php?page=cookielay-prime1,3395.5553.7874.15
Style /wp-admin/admin.php?page=cookielay-style4,3096.40169.5649.33
Help & Support /wp-admin/admin.php?page=cookielay-help1,4605.5556.3746.29

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

🔸 Tests weight: 35 | The uninstall procedure must remove all plugin files and extra database tables
These items require your attention
  • Zombie WordPress options detected upon uninstall: 6 options
    • widget_theysaidso_widget
    • theysaidso_admin_options
    • can_compress_scripts
    • widget_recent-posts
    • widget_recent-comments
    • db_upgraded

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the server (in the Apache logs)
Everything seems fine, however this is by no means an exhaustive test

SRP 0% from 2 tests

🔹 Tests weight: 20 | It is important to ensure that your PHP files perform no action when accessed directly, respecting the single-responsibility principle
Almost there! Just fix the following items
  • 10× PHP files perform the action of outputting non-empty strings when accessed directly:
    • > /wp-content/plugins/cookielay/includes/admin/scripts/allow/facebook_pixel.php
    • > /wp-content/plugins/cookielay/includes/admin/scripts/allow/matomo.php
    • > /wp-content/plugins/cookielay/includes/admin/scripts/allow/google_adsense.php
    • > /wp-content/plugins/cookielay/includes/admin/scripts/allow/google_analytics.php
    • > /wp-content/plugins/cookielay/includes/admin/scripts/allow/matomo_tag_manager.php
    • > /wp-content/plugins/cookielay/includes/admin/scripts/allow/google_tag_manager.php
    • > /wp-content/plugins/cookielay/includes/admin/scripts/allow/hubspot.php
    • > /wp-content/plugins/cookielay/includes/admin/templates/partials/footer.php
    • > /wp-content/plugins/cookielay/includes/public/styles/styles.php
    • > /wp-content/plugins/cookielay/includes/public/templates/cookie.php
  • 198× PHP files trigger server-side errors or warnings when accessed directly (only 10 are shown):
    • > PHP Notice
      Undefined variable: colors in wp-content/plugins/cookielay/includes/public/styles/styles.php on line 44
    • > PHP Notice
      Undefined variable: text in wp-content/plugins/cookielay/templates/cookielay-template-center.php on line 15
    • > PHP Notice
      Undefined variable: group in wp-content/plugins/cookielay/includes/public/templates/group.php on line 5
    • > PHP Warning
      Use of undefined constant COOKIELAY_ROOT_PATH - assumed 'COOKIELAY_ROOT_PATH' (this will throw an Error in a future version of PHP) in wp-content/plugins/cookielay/includes/admin/templates/group-add.php on line 13
    • > PHP Notice
      Undefined variable: colors in wp-content/plugins/cookielay/includes/public/styles/styles.php on line 78
    • > PHP Warning
      Use of undefined constant COOKIELAY_ROOT_PATH - assumed 'COOKIELAY_ROOT_PATH' (this will throw an Error in a future version of PHP) in wp-content/plugins/cookielay/includes/admin/templates/style.php on line 13
    • > PHP Fatal error
      Uncaught Error: Class 'Cookielay_Public_Frontend' not found in wp-content/plugins/cookielay/includes/public/class-cookielay-public-settings.php:11
    • > PHP Fatal error
      Uncaught Error: Using $this when not in object context in wp-content/plugins/cookielay/includes/public/templates/group.php:18
    • > PHP Notice
      Trying to access array offset on value of type null in wp-content/plugins/cookielay/includes/public/styles/styles.php on line 118
    • > PHP Warning
      Use of undefined constant COOKIELAY_ROOT_PATH - assumed 'COOKIELAY_ROOT_PATH' (this will throw an Error in a future version of PHP) in wp-content/plugins/cookielay/includes/admin/templates/cookie-add.php on line 13

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)
Everything seems fine, but this is not an exhaustive test

Optimizations

Plugin configuration Passed 29 tests

readme.txt Passed 16 tests

The readme.txt file is an important file in your plugin as it is parsed by WordPress.org to prepare the public listing of your plugin
5 plugin tags: overlay, consent, borlabs, gdpr, cookie

cookielay/cookielay.php Passed 13 tests

The main file in "Cookielay" v. 1.2.0 serves as a complement to information provided in readme.txt and as the entry point to the plugin
61 characters long description:
With Cookielay you manage cookies in a privacy compliant way.

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short glimpse at programming languages used with this plugin and a check that no dangerous files are present
There were no executable files found in this plugin89,590 lines of code in 387 files:
LanguageFilesBlank linesComment linesLines of code
CSS193,12519544,917
JavaScript1368,2753,31229,745
Sass1041,4351,2899,298
PHP552853933,894
TypeScript6204487
Markdown31710472
JSON500393
SVG302384

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.13
Average class complexity6.56
▷ Minimum class complexity1.00
▷ Maximum class complexity75.00
Average method complexity1.91
▷ Minimum method complexity1.00
▷ Maximum method complexity47.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes25
▷ Abstract classes28.00%
▷ Concrete classes2392.00%
▷ Final classes00.00%
Methods157
▷ Static methods00.00%
▷ Public methods8956.69%
▷ Protected methods42.55%
▷ Private methods6440.76%
Functions8
▷ Named functions8100.00%
▷ Anonymous functions00.00%
Constants8
▷ Global constants8100.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
No PNG images were found in this plugin