68% bread-butter

Code Review | Bread & Butter: real lead capture, gated content & newsletter opt-ins

WordPress plugin Bread & Butter: real lead capture, gated content & newsletter opt-ins scored68%from 54 tests.

About plugin

  • Plugin page: bread-butter
  • Plugin version: 7.0.731
  • PHP compatiblity: 7.0.0+
  • PHP version: 7.4.16
  • WordPress compatibility: 1.0-6.4
  • WordPress version: 6.3.1
  • First release: Feb 6, 2021
  • Latest release: Nov 30, 2023
  • Number of updates: 65
  • Update frequency: every 15.8 days
  • Top authors: breadbutter (100%)

Code review

54 tests

User reviews

5 reviews

Install metrics

20+ active /2,030 total downloads

Benchmarks

Plugin footprint 65% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
The plugin installed successfully, without throwing any errors or notices

Server metrics [RAM: ▲0.83MB] [CPU: ▼20.71ms] Passed 4 tests

This is a short check of server-side resources used by Bread & Butter: real lead capture, gated content & newsletter opt-ins
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /5.21 ▲1.7547.63 ▲10.17
Dashboard /wp-admin4.79 ▲1.4437.72 ▼25.19
Posts /wp-admin/edit.php4.79 ▲1.4336.64 ▼12.95
Add New Post /wp-admin/post-new.php4.79 ▼1.1038.61 ▼54.88
Media Library /wp-admin/upload.php4.79 ▲1.5644.39 ▲11.25

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

How much does this plugin use your filesystem and database?
There were no storage issued detected upon installing this plugin
Filesystem: 100 new files
Database: no new tables, 91 new options
New WordPress options
breadbutter_newsletter_type
breadbutter_show_login_focus
breadbutter_user_custom_data_config
breadbutter_contactus_position_horizontal
breadbutter_gating_content_preview_clickable_content
breadbutter_user_profile_position_horizontal_px
breadbutter_continue_with_position_vertical
breadbutter_gating_content_blur_paragraph_3
breadbutter_gating_content_gating_pages
breadbutter_newsletter_override_dest
...

Browser metrics Passed 4 tests

This is an overview of browser requirements for Bread & Butter: real lead capture, gated content & newsletter opt-ins
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,939 ▲19213.78 ▼0.587.95 ▲6.5338.77 ▲1.50
Dashboard /wp-admin2,219 ▲454.93 ▼0.76101.29 ▲0.2996.44 ▲50.69
Posts /wp-admin/edit.php2,143 ▲432.34 ▲0.3943.24 ▲5.1833.45 ▼1.85
Add New Post /wp-admin/post-new.php1,570 ▲3923.62 ▲0.43639.52 ▼40.0433.65 ▼32.10
Media Library /wp-admin/upload.php1,433 ▲424.47 ▲0.29105.89 ▲4.3278.60 ▲33.12

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

🔸 Tests weight: 35 | All plugins must uninstall correctly, removing their source code and extra database tables they might have created
Please fix the following items
  • The plugin did not uninstall gracefully
    • > Notice in wp-content/plugins/bread-butter/src/Api/SettingsApi.php+102
    Undefined index: group
  • The uninstall procedure has failed, leaving 91 options in the database
    • breadbutter_contactus_show_company
    • breadbutter_ga_measurement_id
    • breadbutter_show_login_focus
    • breadbutter_contactus_icon_note
    • breadbutter_gating_content_gating_config_enabled
    • widget_theysaidso_widget
    • breadbutter_gating_content_override_dest
    • breadbutter_newsletter_trigger_id
    • breadbutter_secure_forms_config
    • breadbutter_contactus_pages
    • ...

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 | The single-responsibility principle: PHP files have to remain inert when accessed directly, throwing no errors and performing no actions
Almost there! Just fix the following items
  • 2× GET requests to PHP files return non-empty strings:
    • > /wp-content/plugins/bread-butter/uninstall.php
    • > /wp-content/plugins/bread-butter/breadbutter-connect.php
  • 30× PHP files trigger errors when accessed directly with GET requests (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'BreadButter_WP_Plugin\\Base\\BaseController' not found in wp-content/plugins/bread-butter/src/Base/Newsletter.php:10
    • > PHP Fatal error
      Uncaught Error: Class 'BreadButter_WP_Plugin\\Base\\BaseController' not found in wp-content/plugins/bread-butter/src/Base/Session.php:10
    • > PHP Fatal error
      Uncaught Error: Class 'BreadButter_WP_Plugin\\Pages\\Gutenberg\\Base' not found in wp-content/plugins/bread-butter/src/Pages/Gutenberg/ContentGating.php:8
    • > PHP Fatal error
      Uncaught Error: Class 'BreadButter_WP_Plugin\\Base\\BaseController' not found in wp-content/plugins/bread-butter/src/Pages/LoginAuthorize.php:14
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_attr() in wp-content/plugins/bread-butter/templates/gate_content_dashboard.php:20
    • > PHP Fatal error
      Uncaught Error: Class 'BreadButter_WP_Plugin\\Base\\BaseController' not found in wp-content/plugins/bread-butter/src/Base/SettingsLinks.php:10
    • > PHP Fatal error
      Uncaught Error: Class 'BreadButter_WP_Plugin\\Base\\BaseController' not found in wp-content/plugins/bread-butter/src/Pages/LoginForm.php:10
    • > PHP Fatal error
      Uncaught Error: Class 'BreadButter_WP_Plugin\\Base\\BaseController' not found in wp-content/plugins/bread-butter/src/Base/Enqueue.php:10
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_option() in wp-content/plugins/bread-butter/templates/newsletter_dashboard.php:27
    • > PHP Fatal error
      Uncaught Error: Class 'BreadButter_WP_Plugin\\Base\\BaseController' not found in wp-content/plugins/bread-butter/src/Pages/Block.php:15

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
No browser errors were detected

Optimizations

Plugin configuration 90% from 29 tests

readme.txt 94% from 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
Attributes that need to be fixed:
  • Screenshots: These screenshots lack descriptions #1, #2, #3, #4 in bread-butter/assets to your readme.txt
You can look at the official readme.txt

bread-butter/breadbutter-connect.php 85% from 13 tests

"Bread & Butter: real lead capture, gated content & newsletter opt-ins" version 7.0.731's main PHP file describes plugin functionality and also serves as the entry point to any WordPress functionality
It is important to fix the following:
  • Text Domain: The text domain is optional since WordPress version 4.6; if you do specify it, it must be the same as the plugin slug
  • Main file name: Even though not officially enforced, the main plugin file should be the same as the plugin slug ("bread-butter.php" instead of "breadbutter-connect.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | Executable files are not allowed as they can serve as attack vectors
There were no executable files found in this plugin12,086 lines of code in 82 files:
LanguageFilesBlank linesComment linesLines of code
PHP499796247,873
JavaScript191721632,805
CSS6167191,326
SVG60062
JSON20020

PHP code Passed 2 tests

A short review of cyclomatic complexity and code structure
No complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.29
Average class complexity16.73
▷ Minimum class complexity1.00
▷ Maximum class complexity112.00
Average method complexity2.62
▷ Minimum method complexity1.00
▷ Maximum method complexity62.00
Code structure
Namespaces10
Interfaces0
Traits0
Classes37
▷ Abstract classes00.00%
▷ Concrete classes37100.00%
▷ Final classes12.70%
Methods360
▷ Static methods133.61%
▷ Public methods34295.00%
▷ Protected methods30.83%
▷ Private methods154.17%
Functions24
▷ Named functions2187.50%
▷ Anonymous functions312.50%
Constants18
▷ Global constants00.00%
▷ Class constants18100.00%
▷ Public constants18100.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
16 PNG files occupy 0.24MB with 0.15MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/bb-round.png13.66KB3.02KB▼ 77.90%
assets/info_64.png1.53KB0.76KB▼ 50.35%
assets/banner-1544x500.png80.32KB41.14KB▼ 48.78%
assets/ll_icons.png11.10KB1.50KB▼ 86.53%
assets/banner-772x250.png53.60KB25.83KB▼ 51.80%