31% flow-payments

Code Review | Flow Payments

WordPress plugin Flow Payments scored31%from 54 tests.

About plugin

  • Plugin page: flow-payments
  • Plugin version: 1.1.0
  • PHP version: 7.4.16
  • WordPress compatibility: 3.0.1-4.6
  • WordPress version: 6.3.1
  • First release: Aug 29, 2016
  • Latest release: Sep 1, 2016
  • Number of updates: 14
  • Update frequency: every 0.2 days
  • Top authors: bigandi (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /677 total downloads

Benchmarks

Plugin footprint 30% 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.20MB] [CPU: ▼3.42ms] Passed 4 tests

Analyzing server-side resources used by Flow Payments
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /3.66 ▲0.2039.21 ▼3.75
Dashboard /wp-admin3.50 ▲0.2045.38 ▼3.01
Posts /wp-admin/edit.php3.61 ▲0.2643.99 ▼4.72
Add New Post /wp-admin/post-new.php6.08 ▲0.2098.43 ▲2.45
Media Library /wp-admin/upload.php3.42 ▲0.2033.05 ▼2.19
Swell /wp-admin/admin.php?page=flow/flow-admin-page.php3.4131.41

Server storage [IO: ▲1.20MB] [DB: ▲0.07MB] Passed 3 tests

Analyzing filesystem and database footprints of this plugin
No storage issues were detected
Filesystem: 145 new files
Database: 3 new tables, 6 new options
New tables
wp_swell_orders
wp_swell_payment_form
wp_swell_products
New WordPress options
widget_theysaidso_widget
db_upgraded
can_compress_scripts
theysaidso_admin_options
widget_recent-posts
widget_recent-comments

Browser metrics Passed 4 tests

This is an overview of browser requirements for Flow Payments
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,005 ▲24415.59 ▲1.21170.74 ▲169.1940.19 ▼4.01
Dashboard /wp-admin2,231 ▲545.50 ▼0.1885.11 ▼32.7234.07 ▼10.07
Posts /wp-admin/edit.php2,133 ▲332.01 ▼0.0235.86 ▲1.9634.87 ▲0.78
Add New Post /wp-admin/post-new.php1,556 ▲2823.54 ▲0.50646.12 ▼8.7653.66 ▼7.62
Media Library /wp-admin/upload.php1,436 ▲364.24 ▲0.0395.43 ▼0.6741.17 ▲1.20
Orders /wp-admin/orders.php260.420.0811.08
Products /wp-admin/products.php260.420.067.00
Settings /wp-admin/settings.php260.420.075.81
Swell /wp-admin/admin.php?page=flow/flow-admin-page.php8092.0323.6029.72
Payment Form /wp-admin/payment-form-options.php.php260.420.1210.75

Uninstaller [IO: ▲1.20MB] [DB: ▲0.08MB] 0% from 4 tests

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
You still need to fix the following
  • The plugin did not uninstall gracefully
    • > Notice in wp-content/plugins/flow-payments/uninstall.php+16
    Undefined variable: wpdb
  • The plugin did not uninstall correctly, leaving 145 files (1.20MB) in the plugin directory
    • (new file) admin/js/plugin-name-admin.js
    • (new file) admin/index.php
    • (new file) admin/models/get_keys.php
    • (new file) admin/pages/payment-form/form_options_controller.php
    • (new file) admin/pages/orders/get_orders.php
    • (new file) admin/pages/orders/orders.php
    • (new file) admin/css/main.css
    • (new file) README.txt
    • (new file) admin/pages/payment-form/form_options.php
    • (new file) admin/pages/orders/orders_controller.php
    • ...
  • The uninstall procedure failed, leaving 3 tables in the database
    • wp_swell_orders
    • wp_swell_products
    • wp_swell_payment_form
  • This plugin does not fully uninstall, leaving 7 options in the database
    • db_upgraded
    • theysaidso_admin_options
    • can_compress_scripts
    • widget_recent-posts
    • widget_theysaidso_widget
    • widget_recent-comments
    • recovery_mode_email_last_sent

Smoke tests 25% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no server-side errors were triggered
The smoke test was a success, however most plugin functionality was not tested

SRP 0% from 2 tests

🔹 Tests weight: 20 | SRP (Single-Responsibility Principle) - PHP files must act as libraries and never output text or perform any action when accessed directly in a browser
The following issues need your attention
  • 6× PHP files output text when accessed directly:
    • > /wp-content/plugins/flow-payments/admin/index.php
    • > /wp-content/plugins/flow-payments/admin/templates/no-keys.php
    • > /wp-content/plugins/flow-payments/app/public/views/products.php
    • > /wp-content/plugins/flow-payments/admin/pages/payment-form/form_options.php
    • > /wp-content/plugins/flow-payments/app/public/views/purchase_success.php
    • > /wp-content/plugins/flow-payments/library/stripe/stripe-php/build.php
  • 115× GET requests to PHP files have triggered server-side errors or warnings (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'Stripe\\ApiResource' not found in wp-content/plugins/flow-payments/library/stripe/stripe-php/lib/SingletonApiResource.php:5
    • > PHP Fatal error
      Uncaught Error: Class 'Stripe\\TestCase' not found in wp-content/plugins/flow-payments/library/stripe/stripe-php/tests/TransferTest.php:5
    • > PHP Fatal error
      Uncaught Error: Class 'Stripe\\ApiResource' not found in wp-content/plugins/flow-payments/library/stripe/stripe-php/lib/Plan.php:5
    • > PHP Notice
      Undefined variable: results in wp-content/plugins/flow-payments/admin/pages/products/products.php on line 18
    • > PHP Fatal error
      Uncaught Error: Class 'Stripe\\Error\\Base' not found in wp-content/plugins/flow-payments/library/stripe/stripe-php/lib/Error/Authentication.php:5
    • > PHP Notice
      Trying to access array offset on value of type null in wp-content/plugins/flow-payments/admin/pages/payment-form/form_options.php on line 23
    • > PHP Fatal error
      Uncaught Error: Class 'Stripe\\TestCase' not found in wp-content/plugins/flow-payments/library/stripe/stripe-php/tests/AuthenticationErrorTest.php:5
    • > PHP Fatal error
      Uncaught Error: Class 'Stripe\\TestCase' not found in wp-content/plugins/flow-payments/library/stripe/stripe-php/tests/AccountTest.php:5
    • > PHP Fatal error
      Uncaught Error: Class 'Stripe\\TestCase' not found in wp-content/plugins/flow-payments/library/stripe/stripe-php/tests/BalanceTest.php:5
    • > PHP Fatal error
      Uncaught Error: Class 'Stripe\\TestCase' not found in wp-content/plugins/flow-payments/library/stripe/stripe-php/tests/BankAccountTest.php:5

User-side errors 0% from 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
Please fix the following user-side errors
    • > GET request to /wp-admin/orders.php
    • > Network (severe)
    wp-admin/orders.php - Failed to load resource: the server responded with a status of 404 (Not Found)
    • > GET request to /wp-admin/products.php
    • > Network (severe)
    wp-admin/products.php - Failed to load resource: the server responded with a status of 404 (Not Found)
    • > GET request to /wp-admin/settings.php
    • > Network (severe)
    wp-admin/settings.php - Failed to load resource: the server responded with a status of 404 (Not Found)
    • > GET request to /wp-admin/payment-form-options.php.php
    • > Network (severe)
    wp-admin/payment-form-options.php.php - Failed to load resource: the server responded with a status of 404 (Not Found)

Optimizations

Plugin configuration 87% from 29 tests

readme.txt 88% from 16 tests

You should put a lot of thought into formatting readme.txt as it is used by WordPress.org to prepare the public listing of your plugin
These attributes need your attention:
  • Plugin Name: You should set the name of your plugin on the first line ( === flow-payments === )
  • Screenshots: These screenshots require images: #1 (Welcom to Flow Payments.), #2 (This is the new menu items.), #3 (Fully customisable payment forms!), #4 (Add Products.)
The official readme.txt is a good inspiration

flow-payments/swell.php 85% from 13 tests

"Flow Payments" version 1.1.0's main PHP file describes plugin functionality and also serves as the entry point to any WordPress functionality
Please make the necessary changes and fix the following:
  • Main file name: Please rename the main PHP file in this plugin to the plugin slug ("flow-payments.php" instead of "swell.php")
  • Text Domain: The text domain follows the same naming rules as the plugin slug: lowercase characters and dashes

Code Analysis 5% from 3 tests

File types 0% from 1 test

🔸 Test weight: 35 | This is a short overview of programming languages used in this plugin, detecting executable files
These items require your attention
  • Even if your plugin relies on executable files (for example a companion app), never distribute executable files with your plugin
    • .crt - Security Certificate in Firefox, IE, Chrome, Safari
      • wp-content/plugins/flow-payments/library/stripe/stripe-php/data/ca-certificates.crt
6,363 lines of code in 131 files:
LanguageFilesBlank linesComment linesLines of code
PHP1169711,0054,993
CSS22732473
JavaScript54352305
Stylus17629295
Markdown21360213
JSON10036
XML20030
YAML23018

PHP code Passed 2 tests

Cyclomatic complexity and code structure are the fingerprint of this plugin
All good! No complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.14
Average class complexity3.06
▷ Minimum class complexity1.00
▷ Maximum class complexity36.00
Average method complexity1.48
▷ Minimum method complexity1.00
▷ Maximum method complexity12.00
Code structure
Namespaces4
Interfaces3
Traits0
Classes86
▷ Abstract classes55.81%
▷ Concrete classes8194.19%
▷ Final classes00.00%
Methods352
▷ Static methods10128.69%
▷ Public methods31790.06%
▷ Protected methods215.97%
▷ Private methods143.98%
Functions18
▷ Named functions1794.44%
▷ Anonymous functions15.56%
Constants3
▷ Global constants133.33%
▷ Class constants266.67%
▷ Public constants2100.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
9 PNG files occupy 0.64MB with 0.34MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
screenshot-1.png406.61KB177.00KB▼ 56.47%
screenshot-3.png142.44KB48.50KB▼ 65.95%
library/stripe/stripe-php/data/test.png0.09KB0.09KB0.00%
screenshot-2.png22.86KB6.39KB▼ 72.03%
screenshot-4.png65.41KB17.84KB▼ 72.72%