66% simple-payment

Code Review | Simple Payment

WordPress plugin Simple Payment scored66%from 54 tests.

About plugin

  • Plugin page: simple-payment
  • Plugin version: 2.3.2
  • PHP compatiblity: 5.4+
  • PHP version: 7.4.16
  • WordPress compatibility: 2.6-6.2.0
  • WordPress version: 6.3.1
  • First release: Oct 10, 2019
  • Latest release: Apr 7, 2023
  • Number of updates: 120
  • Update frequency: every 10.7 days
  • Top authors: idokd (100%)

Code review

54 tests

User reviews

3 reviews

Install metrics

70+ active /6,690 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Verifying that this plugin installs correctly without errors
The plugin installed gracefully, with no errors

Server metrics [RAM: ▲1.00MB] [CPU: ▲1.07ms] Passed 4 tests

An overview of server-side resources used by Simple Payment
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /4.47 ▲1.0044.66 ▼2.95
Dashboard /wp-admin4.30 ▲1.0054.30 ▲3.21
Posts /wp-admin/edit.php4.35 ▲1.0057.05 ▲5.45
Add New Post /wp-admin/post-new.php6.89 ▲1.0096.59 ▼1.43
Media Library /wp-admin/upload.php4.22 ▲0.9945.66 ▲10.33
Simple Payment /wp-admin/options-general.php?page=sp4.4343.55
/wp-admin/admin.php?page=simple-payments-details4.0537.24

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

How much does this plugin use your filesystem and database?
No storage issues were detected
Filesystem: 381 new files
Database: 2 new tables, 8 new options
New tables
wp_sp_history
wp_sp_transactions
New WordPress options
recovery_mode_email_last_sent
widget_theysaidso_widget
db_upgraded
theysaidso_admin_options
widget_recent-comments
sp_db_version
can_compress_scripts
widget_recent-posts

Browser metrics Passed 4 tests

A check of browser resources used by Simple Payment
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,831 ▲8513.21 ▼1.181.55 ▼0.2438.15 ▼4.79
Dashboard /wp-admin2,206 ▲215.79 ▼0.07109.49 ▲6.5583.06 ▲40.11
Posts /wp-admin/edit.php2,107 ▲182.01 ▲0.0140.22 ▼1.1934.52 ▼4.19
Add New Post /wp-admin/post-new.php6,275 ▲4,73319.87 ▲1.671,013.81 ▲405.7660.62 ▲3.36
Media Library /wp-admin/upload.php1,397 ▲154.22 ▲0.02102.60 ▲2.4771.41 ▲27.88
Simple Payment /wp-admin/options-general.php?page=sp2,1402.0728.4231.15
/wp-admin/admin.php?page=simple-payments-details450.440.068.55

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
It is recommended to fix the following
  • The uninstall procedure has failed, leaving 7 options in the database
    • db_upgraded
    • widget_recent-comments
    • theysaidso_admin_options
    • widget_recent-posts
    • recovery_mode_email_last_sent
    • widget_theysaidso_widget
    • can_compress_scripts

Smoke tests 0% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
Please fix the following server-side errors
    • > GET request to /wp-admin/admin.php?page=simple-payments-details
    • > Error in wp-content/plugins/simple-payment/simple-payment-plugin.php+1289
    Uncaught Exception: Error fetching transaction in wp-content/plugins/simple-payment/simple-payment-plugin.php:1289
    Stack trace:
    #0 wp-includes/class-wp-hook.php(310): SimplePaymentPlugin->info()
    #1 wp-includes/class-wp-hook.php(334): WP_Hook->apply_filters()
    #2 wp-includes/plugin.php(517): WP_Hook->do_action()
    #3 wp-admin/admin.php(237): do_action()
    #4 {main}
    thrown

SRP 0% 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
Almost there! Just fix the following items
  • 3× PHP files output text when accessed directly:
    • > /wp-content/plugins/simple-payment/admin/shortcode.php
    • > /wp-content/plugins/simple-payment/vendor/leewillis77/WpListTableExportable/templates/html-export-link.php
    • > /wp-content/plugins/simple-payment/admin/instructions.php
  • 198× PHP files trigger errors when accessed directly with GET requests (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'PayPal\\Common\\PayPalModel' not found in wp-content/plugins/simple-payment/vendor/paypal/rest-api-sdk-php/lib/PayPal/Api/CurrencyConversion.php:24
    • > PHP Fatal error
      Uncaught Error: Class 'PayPal\\Common\\PayPalResourceModel' not found in wp-content/plugins/simple-payment/vendor/paypal/rest-api-sdk-php/lib/PayPal/Api/Payout.php:21
    • > PHP Fatal error
      Uncaught Error: Class 'PayPal\\Common\\PayPalModel' not found in wp-content/plugins/simple-payment/vendor/paypal/rest-api-sdk-php/lib/PayPal/Api/PayoutSenderBatchHeader.php:19
    • > PHP Fatal error
      Uncaught Error: Class 'PayPal\\Common\\PayPalModel' not found in wp-content/plugins/simple-payment/vendor/paypal/rest-api-sdk-php/lib/PayPal/Api/OpenIdAddress.php:20
    • > PHP Fatal error
      Uncaught Error: Class 'PayPal\\Common\\PayPalModel' not found in wp-content/plugins/simple-payment/vendor/paypal/rest-api-sdk-php/lib/PayPal/Api/RedirectUrls.php:18
    • > PHP Fatal error
      Uncaught Error: Class 'PayPal\\Common\\PayPalModel' not found in wp-content/plugins/simple-payment/vendor/paypal/rest-api-sdk-php/lib/PayPal/Api/PaymentTerm.php:17
    • > PHP Fatal error
      Uncaught Error: Class 'PayPal\\Common\\PayPalResourceModel' not found in wp-content/plugins/simple-payment/vendor/paypal/rest-api-sdk-php/lib/PayPal/Api/WebhookEvent.php:29
    • > PHP Fatal error
      Uncaught Error: Class 'PayPal\\Common\\PayPalModel' not found in wp-content/plugins/simple-payment/vendor/paypal/rest-api-sdk-php/lib/PayPal/Common/PayPalResourceModel.php:16
    • > PHP Fatal error
      Uncaught Error: Call to undefined function wp_enqueue_script() in wp-content/plugins/simple-payment/admin/transaction-log.php:2
    • > PHP Fatal error
      Uncaught Error: Class 'PayPal\\Common\\PayPalModel' not found in wp-content/plugins/simple-payment/vendor/paypal/rest-api-sdk-php/lib/PayPal/Api/FileAttachment.php:18

User-side errors 0% from 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the browser (console and network errors and warnings)
Please fix the following browser errors
    • > GET request to /wp-admin/admin.php?page=simple-payments-details
    • > Network (severe)
    wp-admin/admin.php?page=simple-payments-details - Failed to load resource: the server responded with a status of 500 (Internal Server Error)

Optimizations

Plugin configuration 90% from 29 tests

readme.txt 94% from 16 tests

Often overlooked, readme.txt is one of the most important files in your plugin
Attributes that require attention:
  • Tags: Please delete some tags, you are using 21 tag instead of maximum 10
You can look at the official readme.txt

simple-payment/simple-payment-plugin.php 85% from 13 tests

The main PHP script in "Simple Payment" version 2.3.2 is automatically included on every request by WordPress
Please take the time to fix the following:
  • Main file name: Name the main plugin file the same as the plugin slug ("simple-payment.php" instead of "simple-payment-plugin.php")
  • Requires at least: Required version must be the same as the one declared in readme.txt ("4.6" instead of "2.6")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is an overview of file extensions present in this plugin and a short test that no dangerous files are bundled with this plugin
No dangerous file extensions were detected45,098 lines of code in 340 files:
LanguageFilesBlank linesComment linesLines of code
PHP2895,43420,47326,752
JSON41011,075
PO File181,8452,5185,681
Markdown72750691
JavaScript97279649
YAML4278107
XML28064
CSS411062
Sass23012
LESS1005

PHP code Passed 2 tests

This is a very shot review of cyclomatic complexity and code structure
No complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.33
Average class complexity12.04
▷ Minimum class complexity1.00
▷ Maximum class complexity422.00
Average method complexity2.02
▷ Minimum method complexity1.00
▷ Maximum method complexity70.00
Code structure
Namespaces36
Interfaces8
Traits2
Classes244
▷ Abstract classes52.05%
▷ Concrete classes23997.95%
▷ Final classes31.26%
Methods2,752
▷ Static methods1585.74%
▷ Public methods2,64095.93%
▷ Protected methods802.91%
▷ Private methods321.16%
Functions46
▷ Named functions2963.04%
▷ Anonymous functions1736.96%
Constants102
▷ Global constants65.88%
▷ Class constants9694.12%
▷ Public constants96100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

It is recommended to compress PNG files in your plugin to minimize bandwidth usage
4 PNG files occupy 0.26MB with 0.14MB in potential savings
Potential savings
Compression of 4 random PNG files using pngquant
FileSize - originalSize - compressedSavings
vendor/leewillis77/WpListTableExportable/assets/demo-shot.png101.43KB35.93KB▼ 64.57%
vendor/leewillis77/WpListTableExportable/assets/screenshot-1.png68.49KB23.96KB▼ 65.02%
assets/simple-payment-icon.png0.95KB0.79KB▼ 16.51%
vendor/leewillis77/WpListTableExportable/assets/screenshot-2.png97.27KB35.05KB▼ 63.97%