84% unlock-protocol

Code Review | Unlock Protocol

WordPress plugin Unlock Protocol scored84%from 54 tests.

About plugin

  • Plugin page: unlock-protocol
  • Plugin version: 4.0.2
  • PHP compatiblity: 7.0+
  • PHP version: 7.4.16
  • WordPress compatibility: 5.1-5.9
  • WordPress version: 6.3.1
  • First release: Sep 11, 2019
  • Latest release: Aug 1, 2023
  • Number of updates: 53
  • Update frequency: every 26.8 days
  • Top authors: julien51 (92.45%)gagan0123 (9.43%)

Code review

54 tests

User reviews

4 reviews

Install metrics

200+ active /8,371 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | All plugins must install correctly, without throwing any errors, warnings, or notices
The plugin installed gracefully, with no errors

Server metrics [RAM: ▲0.09MB] [CPU: ▼1.82ms] Passed 4 tests

An overview of server-side resources used by Unlock Protocol
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /3.52 ▲0.0637.83 ▼1.44
Dashboard /wp-admin3.45 ▲0.1449.03 ▲5.13
Posts /wp-admin/edit.php3.51 ▲0.1556.23 ▲9.86
Add New Post /wp-admin/post-new.php5.98 ▲0.0984.33 ▼13.12
Media Library /wp-admin/upload.php3.28 ▲0.0632.73 ▲2.15
Unlock Protocol /wp-admin/options-general.php?page=unlock-protocol3.2837.34

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

Input-output and database impact of this plugin
There were no storage issued detected upon installing this plugin
Filesystem: 36 new files
Database: no new tables, 8 new options
New WordPress options
theysaidso_admin_options
unlock_protocol_version
can_compress_scripts
widget_theysaidso_widget
widget_recent-comments
unlock_protocol_installed
widget_recent-posts
db_upgraded

Browser metrics Passed 4 tests

This is an overview of browser requirements for Unlock Protocol
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,094 ▲35917.61 ▲3.242.00 ▲0.1628.71 ▼14.91
Dashboard /wp-admin2,469 ▲2818.61 ▲3.73223.24 ▲107.0441.73 ▼2.78
Posts /wp-admin/edit.php2,397 ▲3057.43 ▲5.4588.13 ▲49.5735.75 ▲2.94
Add New Post /wp-admin/post-new.php6,210 ▲4,67719.35 ▼3.85806.88 ▲140.3337.83 ▼16.95
Media Library /wp-admin/upload.php1,562 ▲1748.73 ▲4.48102.88 ▲4.7739.64 ▼4.87
Unlock Protocol /wp-admin/options-general.php?page=unlock-protocol1,2728.4999.7840.73

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
It is recommended to fix the following
  • This plugin does not fully uninstall, leaving 8 options in the database
    • widget_recent-comments
    • theysaidso_admin_options
    • unlock_protocol_version
    • can_compress_scripts
    • db_upgraded
    • widget_theysaidso_widget
    • unlock_protocol_installed
    • widget_recent-posts

Smoke tests 75% 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)
The smoke test was a success, however most plugin functionality was not tested

SRP 50% from 2 tests

🔹 Tests weight: 20 | A shallow check of the single-responsibility principle; PHP files should perform no action - including output of placeholder text - and trigger no errors when accessed directly
Please fix the following
  • 18× PHP files trigger errors when accessed directly with GET requests (only 10 are shown):
    • > PHP Fatal error
      Trait 'Unlock_Protocol\\Inc\\Traits\\Singleton' not found in wp-content/plugins/unlock-protocol/inc/classes/class-unlock.php on line 19
    • > PHP Fatal error
      Uncaught Error: Call to undefined function untrailingslashit() in wp-content/plugins/unlock-protocol/unlock-protocol.php:15
    • > PHP Fatal error
      Trait 'Unlock_Protocol\\Inc\\Traits\\Singleton' not found in wp-content/plugins/unlock-protocol/inc/classes/blocks/class-unlock-box-block.php on line 21
    • > PHP Notice
      Undefined variable: login_button_bg_color in wp-content/plugins/unlock-protocol/templates/login/button.php on line 12
    • > PHP Fatal error
      Trait 'Unlock_Protocol\\Inc\\Traits\\Singleton' not found in wp-content/plugins/unlock-protocol/inc/classes/class-login.php on line 22
    • > PHP Fatal error
      Trait 'Unlock_Protocol\\Inc\\Traits\\Singleton' not found in wp-content/plugins/unlock-protocol/inc/classes/class-assets.php on line 19
    • > PHP Fatal error
      Trait 'Unlock_Protocol\\Inc\\Traits\\Singleton' not found in wp-content/plugins/unlock-protocol/inc/classes/class-menu.php on line 19
    • > PHP Notice
      Undefined variable: checkout_button_bg_color in wp-content/plugins/unlock-protocol/templates/login/checkout-button.php on line 12
    • > PHP Fatal error
      Uncaught Error: Class 'WP_REST_Controller' not found in wp-content/plugins/unlock-protocol/inc/classes/rest-api/class-rest-base.php:18
    • > PHP Fatal error
      Trait 'Unlock_Protocol\\Inc\\Traits\\Singleton' not found in wp-content/plugins/unlock-protocol/inc/classes/class-plugin.php on line 19

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
Everything seems fine, but this is not an exhaustive test

Optimizations

Plugin configuration 96% from 29 tests

readme.txt Passed 16 tests

It's important to format your readme.txt file correctly as it is parsed for the public listing of your plugin
7 plugin tags: member, monetization, membership, unlock, paywall...

unlock-protocol/unlock-protocol.php 92% from 13 tests

The entry point to "Unlock Protocol" version 4.0.2 is a PHP file that has certain tags in its header comment area
You should first fix the following items:
  • Description: Please keep the plugin description shorter than 140 characters (currently 187 characters long)

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
Success! There were no dangerous files found in this plugin1,171 lines of code in 30 files:
LanguageFilesBlank linesComment linesLines of code
PHP243971,0001,165
CSS3003
JavaScript3003

PHP code Passed 2 tests

This plugin's cyclomatic complexity and code structure detailed below
No cyclomatic complexity issues were detected for this plugin
Cyclomatic complexity
Average complexity per logical line of code0.32
Average class complexity6.87
▷ Minimum class complexity1.00
▷ Maximum class complexity27.00
Average method complexity2.14
▷ Minimum method complexity1.00
▷ Maximum method complexity15.00
Code structure
Namespaces7
Interfaces0
Traits1
Classes14
▷ Abstract classes00.00%
▷ Concrete classes14100.00%
▷ Final classes00.00%
Methods77
▷ Static methods1620.78%
▷ Public methods5470.13%
▷ Protected methods1519.48%
▷ Private methods810.39%
Functions7
▷ Named functions7100.00%
▷ Anonymous functions00.00%
Constants7
▷ Global constants7100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
1 PNG file occupies 0.01MB with 0.01MB in potential savings
Potential savings
Compression of 1 random PNG file using pngquant
FileSize - originalSize - compressedSavings
assets/build/images/icon-128x128.62ac79b7.png13.13KB2.58KB▼ 80.34%