88% cookie-confirm

Code Review | Cookie Confirm

WordPress plugin Cookie Confirm scored 88% from 54 tests.

About plugin

  • Plugin page: cookie-confirm
  • Plugin version: 0.4
  • PHP version: 7.4.16
  • WordPress compatibility: 3.3.2-3.3.2
  • WordPress version: 5.8.1
  • First release: Jun 7, 2012
  • Latest release: Nov 12, 2012
  • Number of updates: 10
  • Update frequency: every 16.7 days
  • Top authors: jealousdesigns (100%)

Code review

54 tests

User reviews

2 reviews

Install metrics

300+ active / 19,226 total downloads

Benchmarks

Plugin footprint Passed 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Verifying that this plugin installs correctly without errors
Installer ran successfully

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

A check of server-side resources used by Cookie Confirm
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /2.90 ▲0.0635.92 ▲8.57
Dashboard /wp-admin3.12 ▲0.0656.93 ▲11.12
Posts /wp-admin/edit.php3.17 ▲0.0645.23 ▲0.95
Add New Post /wp-admin/post-new.php5.47 ▲0.0489.96 ▼567.73
Media Library /wp-admin/upload.php3.06 ▲0.0643.26 ▲4.60
Cookie Confirm /wp-admin/options-general.php?page=cookie_confirm3.0126.86

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

Filesystem and database footprint
The plugin installed successfully
Filesystem: 6 new files
Database: no new tables, no new options

Browser metrics Passed 4 tests

An overview of browser requirements for Cookie Confirm
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,821 ▲22516.26 ▲0.5316.15 ▲6.4748.17 ▼2.24
Dashboard /wp-admin2,975 ▲475.86 ▼0.30161.66 ▼32.59104.64 ▼8.99
Posts /wp-admin/edit.php2,744 ▲52.72 ▼0.0065.08 ▼8.24104.61 ▲23.16
Add New Post /wp-admin/post-new.php1,686 ▲316.23 ▼2.48448.26 ▲51.72109.84 ▲3.40
Media Library /wp-admin/upload.php1,815 ▲115.01 ▼0.02171.92 ▲14.12121.23 ▲7.71
Cookie Confirm /wp-admin/options-general.php?page=cookie_confirm1,4302.1055.4378.08

Uninstaller [IO: ▲0.00MB] [DB: ▲0.00MB] Passed 4 tests

🔸 Tests weight: 35 | All plugins must uninstall correctly, removing their source code and extra database tables they might have created
The plugin uninstalled completely, with no zombie files or tables

Smoke tests 50% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
These server-side errors were triggered
    • > GET request to /wp-admin/options-general.php?page=cookie_confirm
    • > User deprecated in wp-includes/functions.php+5221
    screen_icon is deprecated since version 3.8.0 with no alternative available.
    • > GET request to /wp-admin/options-general.php?page=cookie_confirm
    • > User deprecated in wp-includes/functions.php+5221
    get_screen_icon is deprecated since version 3.8.0 with no alternative available.

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
  • 5× GET requests to PHP files have triggered server-side errors or warnings:
    • > PHP Warning
      Use of undefined constant WP_PLUGIN_DIR - assumed 'WP_PLUGIN_DIR' (this will throw an Error in a future version of PHP) in wp-content/plugins/cookie-confirm/cookie-confirm.php on line 12
    • > PHP Fatal error
      require_once(): Failed opening required 'WP_PLUGIN_DIR/cookie-confirm/theme-options.php' (include_path='.:/usr/share/php') in wp-content/plugins/cookie-confirm/cookie-confirm.php on line 14
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/cookie-confirm/theme-options.php:3
    • > PHP Warning
      Use of undefined constant WP_PLUGIN_URL - assumed 'WP_PLUGIN_URL' (this will throw an Error in a future version of PHP) in wp-content/plugins/cookie-confirm/cookie-confirm.php on line 10
    • > PHP Warning
      require_once(WP_PLUGIN_DIR/cookie-confirm/theme-options.php): failed to open stream: No such file or directory in wp-content/plugins/cookie-confirm/cookie-confirm.php on line 14

User-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
Everything seems fine, but this is not an exhaustive test

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
Attributes that need to be fixed:
  • Screenshots: Please add images for these screenshots: #1 (The unobtrusive, customisable notification), #2 (The admin options area)
You can look at the official readme.txt

cookie-confirm/cookie-confirm.php Passed 13 tests

The main PHP file in "Cookie Confirm" ver. 0.4 adds more information about the plugin and also serves as the entry point for this plugin
130 characters long description:
Cookie Confirm allows you to easily insert a customisable notification for your users to choose and save their cookie preferences.

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is a short overview of programming languages used in this plugin, detecting executable files
There were no executable files found in this plugin363 lines of code in 2 files:
LanguageFilesBlank linesComment linesLines of code
PHP210446363

PHP code Passed 2 tests

Analyzing logical lines of code, cyclomatic complexity, and other code metrics
Everything seems fine, there were no complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.38
Average class complexity9.00
▷ Minimum class complexity9.00
▷ Maximum class complexity9.00
Average method complexity3.00
▷ Minimum method complexity1.00
▷ Maximum method complexity9.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes1
▷ Abstract classes00.00%
▷ Concrete classes1100.00%
▷ Final classes00.00%
Methods4
▷ Static methods00.00%
▷ Public methods4100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions4
▷ Named functions4100.00%
▷ Anonymous functions00.00%
Constants2
▷ Global constants2100.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
3 PNG files occupy 0.16MB with 0.07MB in potential savings
Potential savings
Compression of 3 random PNG files using pngquant
FileSize - originalSize - compressedSavings
screenshot-1.png62.59KB30.63KB▼ 51.05%
screenshot-2.png104.25KB39.99KB▼ 61.65%
logo.png1.82KB1.45KB▼ 20.06%