84% gdpr-cookie-banner

Code Review | GDPR Cookie Banner

WordPress plugin GDPR Cookie Banner scored 84% from 54 tests.

About plugin

  • Plugin page: gdpr-cookie-banner
  • Plugin version: 1.0.0
  • PHP compatiblity: 7.2+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.5-5.2.2
  • WordPress version: 6.3.1
  • First release: Jul 12, 2019
  • Latest release: Jul 12, 2019
  • Number of updates: 2
  • Update frequency: every 7.0 days
  • Top authors: paperplanesolutions (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active / 827 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
This plugin's installer ran successfully

Server metrics [RAM: ▲0.16MB] [CPU: ▼2.94ms] Passed 4 tests

An overview of server-side resources used by GDPR Cookie Banner
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /3.62 ▲0.1641.21 ▼3.85
Dashboard /wp-admin3.46 ▲0.1647.68 ▼2.52
Posts /wp-admin/edit.php3.57 ▲0.2248.37 ▼1.81
Add New Post /wp-admin/post-new.php6.06 ▲0.1891.29 ▼3.59
Media Library /wp-admin/upload.php3.38 ▲0.1635.11 ▲1.17
GDPR Cookie Banner /wp-admin/options-general.php?page=gdpr-cookie-banner3.3633.39

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

A short overview of filesystem and database impact
There were no storage issued detected upon installing this plugin
Filesystem: 37 new files
Database: no new tables, 6 new options
New WordPress options
widget_recent-comments
widget_theysaidso_widget
theysaidso_admin_options
widget_recent-posts
can_compress_scripts
db_upgraded

Browser metrics Passed 4 tests

A check of browser resources used by GDPR Cookie Banner
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,946 ▲21113.94 ▼0.447.24 ▲5.4935.11 ▼8.02
Dashboard /wp-admin2,235 ▲475.15 ▲0.10112.26 ▼6.2740.66 ▼5.93
Posts /wp-admin/edit.php2,123 ▲342.35 ▲0.3244.88 ▲5.8535.31 ▲4.89
Add New Post /wp-admin/post-new.php1,537 ▲323.46 ▲0.43676.75 ▲7.2436.86 ▼22.14
Media Library /wp-admin/upload.php1,411 ▲234.55 ▲0.3097.15 ▼4.3141.83 ▼1.56
GDPR Cookie Banner /wp-admin/options-general.php?page=gdpr-cookie-banner1,4932.1437.7338.18

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
It is recommended to fix the following
  • Zombie WordPress options were found after uninstall: 6 options
    • db_upgraded
    • widget_recent-posts
    • theysaidso_admin_options
    • widget_recent-comments
    • can_compress_scripts
    • widget_theysaidso_widget

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no server-side errors were triggered
The smoke test was a success, however most plugin functionality was not tested

SRP 50% 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
Please take a closer look at the following
  • 2× GET requests to PHP files trigger server-side errors or Error 500 responses:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_option() in wp-content/plugins/gdpr-cookie-banner/public/partials/gdpr-cookie-banner-public-display.php:20
    • > PHP Fatal error
      Uncaught Error: Call to undefined function current_user_can() in wp-content/plugins/gdpr-cookie-banner/admin/partials/gdpr-cookie-banner-admin-display.php:19

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
Everything seems fine on the user side

Optimizations

Plugin configuration 97% from 29 tests

readme.txt 94% from 16 tests

Often overlooked, readme.txt is one of the most important files in your plugin
These attributes need to be fixed:
  • Screenshots: Please add images for these screenshots: #1 (Admin screen for the plugin settings.), #2 (This is the second screen shot which shows how banner will look like on the front-end after aplying the settings.)
The official readme.txt might help

gdpr-cookie-banner/gdpr-cookie-banner.php Passed 13 tests

The primary PHP file in "GDPR Cookie Banner" version 1.0.0 is used by WordPress to initiate all plugin functionality
88 characters long description:
GDPR Cookie Banner helps website owners to display a notice that they are using cookies.

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 detected1,044 lines of code in 18 files:
LanguageFilesBlank linesComment linesLines of code
PHP12236659503
JavaScript39138307
CSS3168234

PHP code Passed 2 tests

This is a short overview of cyclomatic complexity and code structure for this plugin
All good! No complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.16
Average class complexity5.43
▷ Minimum class complexity1.00
▷ Maximum class complexity21.00
Average method complexity1.76
▷ Minimum method complexity1.00
▷ Maximum method complexity8.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes7
▷ Abstract classes00.00%
▷ Concrete classes7100.00%
▷ Final classes00.00%
Methods41
▷ Static methods24.88%
▷ Public methods3687.80%
▷ Protected methods00.00%
▷ Private methods512.20%
Functions3
▷ Named functions3100.00%
▷ Anonymous functions00.00%
Constants1
▷ Global constants1100.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
13 PNG files occupy 0.03MB with 0.03MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
admin/images/gdpr-preview-large-top.png3.12KB0.63KB▼ 79.64%
public/images/gdpr-preview-medium-top.png3.04KB0.54KB▼ 82.11%
admin/images/gdpr-preview-small-bottom.png2.65KB0.47KB▼ 82.12%
public/images/cookie-closing-icon.png1.29KB0.34KB▼ 73.28%
public/images/gdpr-preview-small-top.png2.77KB0.47KB▼ 82.93%