83% membership-lock

Code Review | Membership Lock

WordPress plugin Membership Lock scored83%from 54 tests.

About plugin

  • Plugin page: membership-lock
  • Plugin version: 2.4.8
  • PHP compatiblity: 5.6+
  • PHP version: 7.4.16
  • WordPress compatibility: 3.4-5.7
  • WordPress version: 6.3.1
  • First release: Mar 27, 2020
  • Latest release: Mar 11, 2021
  • Number of updates: 29
  • Update frequency: every 12.0 days
  • Top authors: icelayer (100%)

Code review

54 tests

User reviews

1 review

Install metrics

20+ active /1,691 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
The plugin installed successfully, without throwing any errors or notices

Server metrics [RAM: ▲0.10MB] [CPU: ▼3.17ms] Passed 4 tests

Analyzing server-side resources used by Membership Lock
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /3.53 ▲0.0734.43 ▼7.18
Dashboard /wp-admin3.43 ▲0.0845.64 ▼11.87
Posts /wp-admin/edit.php3.54 ▲0.1950.92 ▲6.83
Add New Post /wp-admin/post-new.php6.01 ▲0.12104.45 ▲5.83
Media Library /wp-admin/upload.php3.35 ▲0.1235.01 ▲0.54

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

How much does this plugin use your filesystem and database?
This plugin installed successfully
Filesystem: 37 new files
Database: no new tables, 7 new options
New WordPress options
can_compress_scripts
mlockdown_status
widget_recent-comments
db_upgraded
theysaidso_admin_options
widget_theysaidso_widget
widget_recent-posts

Browser metrics Passed 4 tests

This is an overview of browser requirements for Membership Lock
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,818 ▲4713.26 ▼1.121.65 ▼0.2636.52 ▼5.46
Dashboard /wp-admin2,224 ▲335.83 ▲0.9396.71 ▼3.4041.17 ▼1.41
Posts /wp-admin/edit.php2,107 ▲181.99 ▼0.0540.79 ▲2.1334.99 ▲1.93
Add New Post /wp-admin/post-new.php1,552 ▲3318.28 ▼4.92636.47 ▲25.0554.92 ▲0.48
Media Library /wp-admin/upload.php1,406 ▲184.20 ▲0.0194.55 ▼2.1443.36 ▲0.78

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 did not uninstall successfully, leaving 6 options in the database
    • widget_recent-comments
    • theysaidso_admin_options
    • can_compress_scripts
    • widget_recent-posts
    • db_upgraded
    • widget_theysaidso_widget

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for server-side errors
Even though everything seems fine, this is not an exhaustive test

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 items
  • 4× PHP files trigger errors when accessed directly with GET requests:
    • > PHP Fatal error
      Uncaught Error: Class 'MembershipLock\\LockItdown' not found in wp-content/plugins/membership-lock/src/Admin/pages/membeship-lockdown/membeship-lockdown.admin.php:42
    • > PHP Fatal error
      Uncaught Error: Using $this when not in object context in wp-content/plugins/membership-lock/src/WPAdminPage/pages/footer.admin.php:8
    • > PHP Fatal error
      Uncaught Error: Call to undefined function is_user_logged_in() in wp-content/plugins/membership-lock/src/WPAdminPage/pages/header.admin.php:3
    • > PHP Fatal error
      Uncaught Error: Class 'MembershipLock\\WPAdminPage\\AdminPage' not found in wp-content/plugins/membership-lock/src/Admin/MembershipAdmin.php:6

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 83% 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
These attributes need your attention:
  • Screenshots: Please add images for these screenshots: #1 (This screen shot description corresponds to screenshot-1.(png|jpg|jpeg|gif).), #2 (This is the second screen shot)
The official readme.txt is a good inspiration

membership-lock/membership-lockdown.php 69% from 13 tests

The main PHP script in "Membership Lock" version 2.4.8 is automatically included on every request by WordPress
Please make the necessary changes and fix the following:
  • Domain Path: Prefix the domain path with a forward slash character ("/languages")
  • Main file name: The principal plugin file should be the same as the plugin slug ("membership-lock.php" instead of "membership-lockdown.php")
  • Domain Path: Note that the domain path follows the same naming rules as the domain name, using only dashes and lowercase characters ("languages")
  • Requires at least: Required version must be the same as the one declared in readme.txt ("4.0" instead of "3.4")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | There should be no dangerous file extensions present in any WordPress plugin
No dangerous file extensions were detected2,002 lines of code in 29 files:
LanguageFilesBlank linesComment linesLines of code
PHP172528081,217
Markdown3980392
CSS3212269
JavaScript1292679
XML191141
HTML3003
JSON1001

PHP code Passed 2 tests

A brief analysis of cyclomatic complexity and code structure for this plugin
There were no cyclomatic complexity issued detected
Cyclomatic complexity
Average complexity per logical line of code0.23
Average class complexity13.88
▷ Minimum class complexity1.00
▷ Maximum class complexity44.00
Average method complexity2.23
▷ Minimum method complexity1.00
▷ Maximum method complexity18.00
Code structure
Namespaces4
Interfaces0
Traits0
Classes8
▷ Abstract classes112.50%
▷ Concrete classes787.50%
▷ Final classes342.86%
Methods85
▷ Static methods1214.12%
▷ Public methods8296.47%
▷ Protected methods00.00%
▷ Private methods33.53%
Functions3
▷ Named functions133.33%
▷ Anonymous functions266.67%
Constants6
▷ Global constants466.67%
▷ Class constants233.33%
▷ Public constants2100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

PNG files should be compressed to save space and minimize bandwidth usage
PNG images were not found in this plugin