78% lightning-paywall

Code Review | Lightning Paywall

WordPress plugin Lightning Paywall scored78%from 54 tests.

About plugin

  • Plugin page: lightning-paywall
  • Plugin version: 1.2.2
  • PHP compatiblity: 7.4+
  • PHP version: 7.4.16
  • WordPress compatibility: 5.6-5.7
  • WordPress version: 6.3.1
  • First release: Apr 6, 2021
  • Latest release: Feb 4, 2022
  • Number of updates: 29
  • Update frequency: every 10.5 days
  • Top authors: coincharge (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /1,029 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | It is important to correctly install your plugin, without throwing errors or notices
This plugin's installer ran successfully

Server metrics [RAM: ▲0.35MB] [CPU: ▼6.88ms] Passed 4 tests

A check of server-side resources used by Lightning Paywall
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /3.79 ▲0.3338.19 ▲0.04
Dashboard /wp-admin3.70 ▲0.3548.42 ▼9.82
Posts /wp-admin/edit.php3.75 ▲0.3948.62 ▼1.23
Add New Post /wp-admin/post-new.php6.26 ▲0.3783.73 ▼16.50
Media Library /wp-admin/upload.php3.56 ▲0.3338.60 ▲5.76
Settings /wp-admin/admin.php?page=lnpw_general_settings3.5541.00
Invoices /wp-admin/admin.php?page=lnpw_invoices3.5231.32

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

Input-output and database impact of this plugin
No storage issues were detected
Filesystem: 45 new files
Database: no new tables, 6 new options
New WordPress options
db_upgraded
widget_recent-posts
widget_theysaidso_widget
can_compress_scripts
widget_recent-comments
theysaidso_admin_options

Browser metrics Passed 4 tests

This is an overview of browser requirements for Lightning Paywall
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,938 ▲16713.82 ▼0.615.28 ▲3.3033.14 ▼6.25
Dashboard /wp-admin2,258 ▲735.05 ▼0.80112.58 ▲13.3744.04 ▼1.55
Posts /wp-admin/edit.php2,147 ▲582.18 ▲0.1344.88 ▲3.4539.50 ▲3.25
Add New Post /wp-admin/post-new.php6,399 ▲4,88028.13 ▲4.74901.47 ▲290.2738.36 ▼11.51
Media Library /wp-admin/upload.php1,443 ▲554.30 ▲0.20108.44 ▼9.2745.02 ▼5.70
Settings /wp-admin/admin.php?page=lnpw_general_settings1,1312.3630.5633.48
Invoices /wp-admin/admin.php?page=lnpw_invoices8562.3028.8740.07

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

🔸 Tests weight: 35 | The uninstall procedure must remove all plugin files and extra database tables
These items require your attention
  • Zombie WordPress options detected upon uninstall: 6 options
    • db_upgraded
    • theysaidso_admin_options
    • widget_recent-posts
    • can_compress_scripts
    • widget_theysaidso_widget
    • widget_recent-comments

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
Even though everything seems fine, this is not an exhaustive test

SRP 0% from 2 tests

🔹 Tests weight: 20 | The single-responsibility principle applies for WordPress plugins as well - please make sure your PHP files perform no actions when accessed directly
Almost there! Just fix the following items
  • 1× PHP files perform the task of outputting text when accessed with GET requests:
    • > /wp-content/plugins/lightning-paywall/admin/partials/page-invoices.php
  • 9× GET requests to PHP files have triggered server-side errors or warnings:
    • > PHP Fatal error
      Uncaught Error: Class 'Elementor\\Widget_Base' not found in wp-content/plugins/lightning-paywall/admin/elementor/class-start-video-widget.php:4
    • > PHP Fatal error
      Uncaught Error: Class 'Elementor\\Widget_Base' not found in wp-content/plugins/lightning-paywall/admin/elementor/class-file-widget.php:4
    • > PHP Fatal error
      Uncaught Error: Class 'Elementor\\Widget_Base' not found in wp-content/plugins/lightning-paywall/admin/elementor/class-end-content-widget.php:4
    • > PHP Fatal error
      Uncaught Error: Class 'Lightning_Paywall_Public' not found in wp-content/plugins/lightning-paywall/public/partials/lnpw-pay-block.php:3
    • > PHP Fatal error
      Uncaught Error: Class 'Elementor\\Widget_Base' not found in wp-content/plugins/lightning-paywall/admin/elementor/class-start-content-widget.php:4
    • > PHP Fatal error
      Uncaught Error: Class 'Elementor\\Widget_Base' not found in wp-content/plugins/lightning-paywall/admin/elementor/class-pay-block-widget.php:4
    • > PHP Fatal error
      Uncaught Error: Class 'Elementor\\Widget_Base' not found in wp-content/plugins/lightning-paywall/admin/elementor/class-end-video-widget.php:4
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_option() in wp-content/plugins/lightning-paywall/admin/partials/page-general-settings.php:3
    • > PHP Fatal error
      Uncaught Error: Class 'Elementor\\Widget_Base' not found in wp-content/plugins/lightning-paywall/admin/elementor/class-store-widget.php:4

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 90% from 29 tests

readme.txt 88% from 16 tests

Don't ignore readme.txt as it is the file that instructs WordPress.org on how to present your plugin to the world
Please fix the following attributes:
  • Screenshots: Please describe screenshot #19 in lightning-paywall/assets to your readme.txt
  • Tags: Please reduce the number of tags, currently 11 tag instead of maximum 10
The official readme.txt might help

lightning-paywall/lightning-paywall.php 92% from 13 tests

The main PHP script in "Lightning Paywall" version 1.2.2 is automatically included on every request by WordPress
The following require your attention:
  • Description: If Twitter did it, so should we! Keep the description under 140 characters (currently 187 characters long)

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | An overview of files in this plugin; executable files are not allowed
Good job! No executable or dangerous file extensions detected38,541 lines of code in 38 files:
LanguageFilesBlank linesComment linesLines of code
JSON20035,032
PHP224876442,135
JavaScript114901,114
CSS2210185
SVG11075

PHP code Passed 2 tests

An overview of cyclomatic complexity and code structure
Although this was not an exhaustive test, there were no cyclomatic complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.22
Average class complexity9.07
▷ Minimum class complexity1.00
▷ Maximum class complexity89.00
Average method complexity1.97
▷ Minimum method complexity1.00
▷ Maximum method complexity15.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes14
▷ Abstract classes00.00%
▷ Concrete classes14100.00%
▷ Final classes00.00%
Methods116
▷ Static methods65.17%
▷ Public methods8875.86%
▷ Protected methods1412.07%
▷ Private methods1412.07%
Functions3
▷ Named functions3100.00%
▷ Anonymous functions00.00%
Constants4
▷ Global constants125.00%
▷ Class constants375.00%
▷ Public constants3100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
2 PNG files occupy 0.03MB with 0.01MB in potential savings
Potential savings
Compression of 2 random PNG files using pngquant
FileSize - originalSize - compressedSavings
public/img/preview.png20.39KB11.72KB▼ 42.50%
public/img/file_preview.png5.54KB2.90KB▼ 47.71%