10% lightning-payment-gateway-lnbits

Code Review | Bitcoin/Lightning Payment Gateway - LNBits

WordPress plugin Bitcoin/Lightning Payment Gateway - LNBits scored10%from 54 tests.

About plugin

  • Plugin page: lightning-payment...
  • Plugin version: 0.0.6
  • PHP compatiblity: 7.0+
  • PHP version: 7.4.16
  • WordPress compatibility: 5.1-5.8
  • WordPress version: 6.3.1
  • First release: Aug 14, 2021
  • Latest release: Aug 28, 2022
  • Number of updates: 11
  • Update frequency: every 34.6 days
  • Top authors: phaedrus1984 (100%)

Code review

54 tests

User reviews

1 review

Install metrics

70+ active /1,079 total downloads

Benchmarks

Plugin footprint 58% from 16 tests

Installer 0% from 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
It is recommended to fix the following installer errors
  • The plugin did not install without errors
    • > Error in wp-content/plugins/lightning-payment-gateway-lnbits/lnbits.php+50
    Uncaught Error: Call to undefined function wc_get_template_html() in wp-content/plugins/lightning-payment-gateway-lnbits/lnbits.php:50
    Stack trace:
    #0 wp-content/plugins/lightning-payment-gateway-lnbits/lnbits.php(37): render_template()
    #1 wp-includes/class-wp-hook.php(310): woocommerce_lnbits_activate()
    #2 wp-includes/class-wp-hook.php(334): WP_Hook->apply_filters()
    #3 wp-includes/plugin.php(517): WP_Hook->do_action()
    #4 wp-admin/includes/plugin.php(693): do_action()

Server metrics [RAM: ▲0.00MB] [CPU: ▼2.46ms] Passed 4 tests

This is a short check of server-side resources used by Bitcoin/Lightning Payment Gateway - LNBits
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /3.46 ▲0.0036.57 ▼1.59
Dashboard /wp-admin3.31 ▲0.0052.71 ▲4.95
Posts /wp-admin/edit.php3.36 ▲0.0046.67 ▼3.42
Add New Post /wp-admin/post-new.php5.89 ▲0.0078.09 ▼5.60
Media Library /wp-admin/upload.php3.23 ▲0.0033.62 ▲0.77

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

Filesystem and database footprint
There were no storage issued detected upon installing this plugin
Filesystem: 9 new files
Database: no new tables, 6 new options
New WordPress options
db_upgraded
can_compress_scripts
widget_recent-posts
widget_recent-comments
widget_theysaidso_widget
theysaidso_admin_options

Browser metrics Passed 4 tests

Checking browser requirements for Bitcoin/Lightning Payment Gateway - LNBits
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,800 ▲5414.48 ▲0.081.72 ▲0.0642.78 ▲1.20
Dashboard /wp-admin2,209 ▲214.89 ▲0.02105.48 ▼6.3339.08 ▼2.78
Posts /wp-admin/edit.php2,089 ▼01.99 ▼0.1933.44 ▼9.0434.35 ▼2.76
Add New Post /wp-admin/post-new.php1,514 ▼1917.67 ▼5.71685.57 ▲9.5063.76 ▲6.25
Media Library /wp-admin/upload.php1,382 ▼04.22 ▼0.0198.46 ▼4.3340.81 ▼7.65

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

🔸 Tests weight: 35 | It is important to correctly uninstall your plugin, without leaving any traces
You still need to fix the following
  • This plugin does not fully uninstall, leaving 6 options in the database
    • can_compress_scripts
    • db_upgraded
    • widget_recent-comments
    • widget_recent-posts
    • theysaidso_admin_options
    • widget_theysaidso_widget

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for server-side errors
Even though no errors were found, this is by no means an exhaustive test

SRP 0% 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
  • 1× PHP files perform the action of outputting non-empty strings when accessed directly:
    • > /wp-content/plugins/lightning-payment-gateway-lnbits/templates/payment_page.php
  • 2× GET requests to PHP files trigger server-side errors or Error 500 responses:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_url() in wp-content/plugins/lightning-payment-gateway-lnbits/templates/payment_shortcode.php:2
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/lightning-payment-gateway-lnbits/lnbits.php:13

User-side errors Passed 1 test

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

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 94% from 16 tests

Perhaps the most important file in your plugin readme.txt gets parsed in order to generate the public listing of your plugin
These attributes need to be fixed:
  • Tags: Please delete some tags, you are using 14 tag instead of maximum 10
Please take inspiration from this readme.txt

lightning-payment-gateway-lnbits/lnbits.php 92% from 13 tests

The principal PHP file in "Bitcoin/Lightning Payment Gateway - LNBits" v. 0.0.6 is loaded by WordPress automatically on each request
Please make the necessary changes and fix the following:
  • Main file name: Name the main plugin file the same as the plugin slug ("lightning-payment-gateway-lnbits.php" instead of "lnbits.php")

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
Good job! No executable or dangerous file extensions detected306 lines of code in 6 files:
LanguageFilesBlank linesComment linesLines of code
PHP68456306

PHP code Passed 2 tests

Cyclomatic complexity and code structure are the fingerprint of this plugin
This plugin has no cyclomatic complexity problems
Cyclomatic complexity
Average complexity per logical line of code0.15
Average class complexity3.75
▷ Minimum class complexity1.00
▷ Maximum class complexity6.00
Average method complexity1.85
▷ Minimum method complexity1.00
▷ Maximum method complexity6.00
Code structure
Namespaces1
Interfaces0
Traits0
Classes4
▷ Abstract classes00.00%
▷ Concrete classes4100.00%
▷ Final classes00.00%
Methods13
▷ Static methods17.69%
▷ Public methods1292.31%
▷ Protected methods00.00%
▷ Private methods17.69%
Functions5
▷ Named functions5100.00%
▷ Anonymous functions00.00%
Constants1
▷ Global constants1100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

PNG files should be compressed to save space and minimize bandwidth usage
2 PNG files occupy 0.00MB with 0.00MB in potential savings
Potential savings
Compression of 2 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/bitcoin.png3.06KB2.06KB▼ 32.77%
assets/lightning.png1.86KB1.66KB▼ 10.74%