82% bitcoin-lightning-publisher

Code Review | Bitcoin Lightning Publisher for WordPress

WordPress plugin Bitcoin Lightning Publisher for WordPress scored 82% from 54 tests.

About plugin

  • Plugin page: bitcoin-lightning...
  • Plugin version: 1.3.0
  • PHP compatiblity: 7.4+
  • PHP version: 7.4.16
  • WordPress compatibility: 5.6.0-6.3.1
  • WordPress version: 6.3.1
  • First release: Aug 16, 2022
  • Latest release: Aug 31, 2023
  • Number of updates: 19
  • Update frequency: every 20.5 days
  • Top authors: getalby (100%)

Code review

54 tests

User reviews

2 reviews

Install metrics

100+ active / 1,865 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
Installer ran successfully

Server metrics [RAM: ▲0.21MB] [CPU: ▼2.81ms] Passed 4 tests

A check of server-side resources used by Bitcoin Lightning Publisher for WordPress
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /3.59 ▲0.1436.91 ▼2.50
Dashboard /wp-admin3.56 ▲0.2545.17 ▼1.27
Posts /wp-admin/edit.php3.61 ▲0.2546.02 ▼1.43
Add New Post /wp-admin/post-new.php6.14 ▲0.2688.55 ▼6.04
Media Library /wp-admin/upload.php3.42 ▲0.1941.74 ▲10.49
Help /wp-admin/admin.php?page=lnp_settings_help3.4232.93
Transactions /wp-admin/admin.php?page=lnp_settings_balances3.4134.61
Dashboard /wp-admin/admin.php?page=lnp_settings3.4232.55
General Settings /wp-admin/admin.php?page=lnp_settings_general3.4134.48
Wallet Settings /wp-admin/admin.php?page=lnp_settings_connections3.4232.44
Paywall Settings /wp-admin/admin.php?page=lnp_settings_paywall3.4133.52

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

How much does this plugin use your filesystem and database?
No storage issues were detected
Filesystem: 856 new files
Database: 1 new table, 6 new options
New tables
wp_lightning_publisher_payments
New WordPress options
widget_recent-comments
widget_recent-posts
widget_theysaidso_widget
db_upgraded
can_compress_scripts
theysaidso_admin_options

Browser metrics Passed 4 tests

Checking browser requirements for Bitcoin Lightning Publisher for WordPress
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,871 ▲13614.09 ▼0.292.87 ▲1.0738.61 ▼7.18
Dashboard /wp-admin2,253 ▲685.29 ▼0.5396.40 ▼22.5237.84 ▼11.96
Posts /wp-admin/edit.php2,136 ▲442.38 ▲0.3535.63 ▼4.4932.03 ▼1.62
Add New Post /wp-admin/post-new.php6,687 ▲5,16823.80 ▲0.671,052.35 ▲347.5537.44 ▼27.18
Media Library /wp-admin/upload.php1,432 ▲414.42 ▲0.2399.21 ▼4.1542.49 ▼3.15
Help /wp-admin/admin.php?page=lnp_settings_help1,0791.9126.5730.44
Transactions /wp-admin/admin.php?page=lnp_settings_balances1,0331.9630.8527.21
Dashboard /wp-admin/admin.php?page=lnp_settings8561.9625.8328.30
General Settings /wp-admin/admin.php?page=lnp_settings_general9232.1026.1127.15
Wallet Settings /wp-admin/admin.php?page=lnp_settings_connections1,0311.9625.7226.08
Paywall Settings /wp-admin/admin.php?page=lnp_settings_paywall9371.9526.5527.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
    • widget_recent-posts
    • widget_theysaidso_widget
    • db_upgraded
    • can_compress_scripts
    • theysaidso_admin_options
    • widget_recent-comments

Smoke tests 75% 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 50% 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
  • 347× GET requests to PHP files trigger server-side errors or Error 500 responses (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'GuzzleHttp\\Exception\\BadResponseException' not found in wp-content/plugins/bitcoin-lightning-publisher/vendor/guzzlehttp/guzzle/src/Exception/ClientException.php:8
    • > PHP Fatal error
      Uncaught Error: Class 'Jorijn\\Bitcoin\\Bolt11\\Exception\\PaymentRequestDecodeException' not found in wp-content/plugins/bitcoin-lightning-publisher/vendor/jorijn/bitcoin-bolt11/src/Exception/SignatureIncorrectOrMissingException.php:16
    • > PHP Warning
      require(wp-content/plugins/bitcoin-lightning-publisher/vendor/jorijn/bitcoin-bolt11/vendor/autoload.php): failed to open stream: No such file or directory in wp-content/plugins/bitcoin-lightning-publisher/vendor/jorijn/bitcoin-bolt11/examples/payment_request_with_expiration_timestamp.php on line 18
    • > PHP Warning
      require_once(vendor/autoload.php): failed to open stream: No such file or directory in wp-content/plugins/bitcoin-lightning-publisher/vendor/octan/btcpay/tests/ClientTest.php on line 4
    • > PHP Fatal error
      Uncaught Error: Class 'BitWasp\\Buffertools\\Tests\\BinaryTest' not found in wp-content/plugins/bitcoin-lightning-publisher/vendor/bitwasp/buffertools/tests/Types/UintSetTest.php:20
    • > PHP Fatal error
      Uncaught Error: Interface 'BitWasp\\Bitcoin\\SerializableInterface' not found in wp-content/plugins/bitcoin-lightning-publisher/vendor/protonlabs/bitcoin/src/Script/ScriptInterface.php:11
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit_Framework_TestCase' not found in wp-content/plugins/bitcoin-lightning-publisher/vendor/pleonasm/merkle-tree/tests/Pleo/Merkle/OneChildDuplicateNodeTest.php:11
    • > PHP Fatal error
      Uncaught Error: Interface 'Pleo\\Merkle\\ITreeNode' not found in wp-content/plugins/bitcoin-lightning-publisher/vendor/pleonasm/merkle-tree/src/Pleo/Merkle/FixedSizeTree.php:27
    • > PHP Fatal error
      Uncaught Error: Interface 'Psr\\Http\\Message\\StreamInterface' not found in wp-content/plugins/bitcoin-lightning-publisher/vendor/guzzlehttp/psr7/src/MultipartStream.php:13
    • > PHP Fatal error
      Uncaught Error: Class 'FG\\ASN1\\AbstractString' not found in wp-content/plugins/bitcoin-lightning-publisher/vendor/fgrosse/phpasn1/lib/ASN1/Universal/T61String.php:16

User-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the browser (console and network errors and warnings)
No browser errors were detected

Optimizations

Plugin configuration 83% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file describes your plugin functionality and requirements and it is parsed to prepare the your plugin's listing
Attributes that require attention:
  • Contributors: Contributors not specified
You can take inspiration from this readme.txt

bitcoin-lightning-publisher/bln-publisher.php 69% from 13 tests

This is the main PHP file of "Bitcoin Lightning Publisher for WordPress" version 1.3.0, providing information about the plugin in the header fields and serving as the principal entry point to the plugin's functions
You should first fix the following items:
  • Text Domain: The text domain must be the same as the plugin slug, although optional since WordPress version 4.6
  • Domain Path: The domain path points to an invalid folder, "/languages" does not exist
  • Main file name: Please rename the main PHP file in this plugin to the plugin slug ("bitcoin-lightning-publisher.php" instead of "bln-publisher.php")
  • Description: If Twitter did it, so should we! Keep the description under 140 characters (currently 168 characters long)

Code Analysis 97% from 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short review of files and their extensions; it is not recommended to include executable files
Everything looks great! No dangerous files found in this plugin51,550 lines of code in 786 files:
LanguageFilesBlank linesComment linesLines of code
PHP6829,86121,44242,014
Markdown361,82705,139
JSON29102,639
JavaScript95867967
YAML10547316
XML780167
CSS5277165
Bourne Shell58044
make114041
Ant15031
Dockerfile111027

PHP code 50% from 2 tests

A brief analysis of cyclomatic complexity and code structure for this plugin
Please fix the following
  • Method cyclomatic complexity should be reduced to less than 100 (currently 204)
Cyclomatic complexity
Average complexity per logical line of code0.33
Average class complexity7.66
▷ Minimum class complexity1.00
▷ Maximum class complexity266.00
Average method complexity2.30
▷ Minimum method complexity1.00
▷ Maximum method complexity204.00
Code structure
Namespaces138
Interfaces97
Traits4
Classes541
▷ Abstract classes285.18%
▷ Concrete classes51394.82%
▷ Final classes448.58%
Methods3,549
▷ Static methods42111.86%
▷ Public methods3,15388.84%
▷ Protected methods1303.66%
▷ Private methods2667.50%
Functions210
▷ Named functions5224.76%
▷ Anonymous functions15875.24%
Constants445
▷ Global constants51.12%
▷ Class constants44098.88%
▷ Public constants42195.68%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

PNG files should be compressed to save space and minimize bandwidth usage
12 PNG files occupy 1.09MB with 0.58MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/screenshot-1.png124.60KB42.29KB▼ 66.06%
assets/img/lnd.png3.96KB2.21KB▼ 44.15%
assets/screenshot-2.png57.99KB23.09KB▼ 60.17%
assets/img/satsymbol-black.png4.44KB2.58KB▼ 41.98%
assets/img/lndhub.png19.05KB8.83KB▼ 53.67%