71% woosquare

Code Review | APIExperts Square for WooCommerce

WordPress plugin APIExperts Square for WooCommerce scored71%from 54 tests.

About plugin

  • Plugin page: woosquare
  • Plugin version: 4.2.9
  • PHP compatiblity: 7.2+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.5.0-6.3.1
  • WordPress version: 6.3.1
  • First release: Jan 31, 2017
  • Latest release: Sep 11, 2023
  • Number of updates: 243
  • Update frequency: every 9.9 days
  • Top authors: wpexpertsio (100%)

Code review

54 tests

User reviews

31 reviews

Install metrics

1,000+ active /66,758 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
This plugin's installer ran successfully

Server metrics [RAM: ▲0.01MB] [CPU: ▼3.41ms] Passed 4 tests

A check of server-side resources used by APIExperts Square for WooCommerce
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /3.47 ▲0.0138.89 ▼0.21
Dashboard /wp-admin3.32 ▲0.0145.91 ▼2.75
Posts /wp-admin/edit.php3.37 ▲0.0147.31 ▼0.57
Add New Post /wp-admin/post-new.php5.90 ▲0.0182.93 ▼10.10
Media Library /wp-admin/upload.php3.24 ▲0.0137.35 ▲0.95
Freemius Debug [v.2.5.10] /wp-admin/admin.php?page=freemius3.0124.00

Server storage [IO: ▲8.09MB] [DB: ▲0.01MB] Passed 3 tests

Input-output and database impact of this plugin
The plugin installed successfully
Filesystem: 481 new files
Database: no new tables, 11 new options
New WordPress options
can_compress_scripts
widget_recent-comments
db_upgraded
fs_accounts
activate_modules_woosquare_plus
widget_recent-posts
theysaidso_admin_options
fs_active_plugins
widget_theysaidso_widget
fs_debug_mode
...

Browser metrics Passed 4 tests

A check of browser resources used by APIExperts Square for WooCommerce
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /1,469 ▼1,31712.39 ▼2.141.91 ▲0.2041.61 ▲2.29
Dashboard /wp-admin2,186 ▲155.56 ▼0.0183.50 ▼1.5352.51 ▲11.79
Posts /wp-admin/edit.php2,103 ▲31.98 ▼0.0136.72 ▲2.1531.51 ▼5.36
Add New Post /wp-admin/post-new.php1,535 ▲622.81 ▼0.19638.93 ▼18.4536.44 ▼21.54
Media Library /wp-admin/upload.php1,400 ▼04.20 ▲0.03108.20 ▲16.1246.24 ▲3.73
Freemius Debug [v.2.5.10] /wp-admin/admin.php?page=freemius280.420.103.88

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
Please fix the following items
  • Zombie WordPress options detected upon uninstall: 11 options
    • square_payment_begin_time
    • fs_debug_mode
    • can_compress_scripts
    • db_upgraded
    • theysaidso_admin_options
    • widget_recent-posts
    • widget_recent-comments
    • fs_active_plugins
    • fs_accounts
    • activate_modules_woosquare_plus
    • ...

Smoke tests 25% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
Everything seems fine, however this is by no means 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
The following issues need your attention
  • 5× PHP files output non-empty strings when accessed directly via GET requests:
    • > /wp-content/plugins/woosquare/admin/partials/woosquare-plus-admin-display.php
    • > /wp-content/plugins/woosquare/admin/modules/product-sync/_inc/admin/pages.php
    • > /wp-content/plugins/woosquare/admin/modules/product-sync/_inc/admin/ajax.php
    • > /wp-content/plugins/woosquare/admin/modules/product-sync/views/partials/cat-display.php
    • > /wp-content/plugins/woosquare/public/partials/woosquare-plus-public-display.php
  • 22× PHP files trigger server-side errors or warnings when accessed directly (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'WC_Payment_Gateway' not found in wp-content/plugins/woosquare/admin/modules/square-payments/SquarePlusApplePayGateway.class.php:3
    • > PHP Notice
      Undefined index: page in wp-content/plugins/woosquare/admin/partials/settings.php on line 84
    • > PHP Notice
      Undefined variable: successMessage in wp-content/plugins/woosquare/admin/partials/settings.php on line 3
    • > PHP Notice
      Undefined variable: successMessage in wp-content/plugins/woosquare/admin/modules/product-sync/views/settings.php on line 2
    • > PHP Warning
      Invalid argument supplied for foreach() in wp-content/plugins/woosquare/admin/modules/product-sync/views/partials/cat-display.php on line 12
    • > PHP Notice
      Undefined variable: targetObject in wp-content/plugins/woosquare/admin/modules/product-sync/views/partials/cat-display.php on line 7
    • > PHP Warning
      uasort() expects parameter 1 to be array, null given in wp-content/plugins/woosquare/admin/modules/product-sync/views/partials/cat-display.php on line 9
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_option() in wp-content/plugins/woosquare/admin/partials/settings.php:89
    • > PHP Fatal error
      Uncaught Error: Call to undefined function __() in wp-content/plugins/woosquare/admin/modules/product-sync/views/logs.php:6
    • > PHP Fatal error
      Uncaught Error: Class 'Woosquare_Plus' not found in wp-content/plugins/woosquare/admin/modules/square-payments/views/payment-settings.php:6

User-side errors 0% from 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
There are user-side issues you should fix
    • > GET request to /wp-admin/admin.php?page=freemius
    • > Network (severe)
    wp-admin/admin.php?page=freemius - Failed to load resource: the server responded with a status of 403 (Forbidden)

Optimizations

Plugin configuration 90% from 29 tests

readme.txt 94% from 16 tests

It's important to format your readme.txt file correctly as it is parsed for the public listing of your plugin
Attributes that need to be fixed:
  • Screenshots: No descriptions were found for these screenshots #10, #11, #12, #4, #5, #6, #7, #8, #9 in woosquare/assets to your readme.txt
You can take inspiration from this readme.txt

woosquare/woocommerce-square-integration.php 85% from 13 tests

The principal PHP file in "APIExperts Square for WooCommerce" v. 4.2.9 is loaded by WordPress automatically on each request
The following require your attention:
  • Main file name: Please rename the main PHP file in this plugin to the plugin slug ("woosquare.php" instead of "woocommerce-square-integration.php")
  • Description: The description should be shorter than 140 characters (currently 155 characters long)

Code Analysis 95% 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
No dangerous file extensions were detected68,583 lines of code in 218 files:
LanguageFilesBlank linesComment linesLines of code
PHP16212,38320,39546,371
CSS261,3513111,108
Sass11678799,214
JavaScript194663171,641
Markdown1680214
JSON10027
SVG8008

PHP code 0% from 2 tests

This is a very shot review of cyclomatic complexity and code structure
Please fix the following
  • Class cyclomatic complexity has to be reduced to less than 1000 (currently 3,073)
  • Cyclomatic complexity of methods should be reduced to less than 100 (currently 103)
Cyclomatic complexity
Average complexity per logical line of code0.62
Average class complexity89.37
▷ Minimum class complexity1.00
▷ Maximum class complexity3,073.00
Average method complexity4.97
▷ Minimum method complexity1.00
▷ Maximum method complexity103.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes125
▷ Abstract classes43.20%
▷ Concrete classes12196.80%
▷ Final classes00.00%
Methods2,843
▷ Static methods43615.34%
▷ Public methods2,03071.40%
▷ Protected methods501.76%
▷ Private methods76326.84%
Functions240
▷ Named functions23899.17%
▷ Anonymous functions20.83%
Constants359
▷ Global constants23565.46%
▷ Class constants12434.54%
▷ Public constants124100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Using a strong compression for your PNG files is a great way to speed-up your plugin
26 PNG files occupy 0.23MB with 0.12MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
includes/freemius/assets/img/plugin-icon.png9.16KB5.26KB▼ 42.58%
admin/img/cardonfile2.png9.12KB3.71KB▼ 59.37%
includes/freemius/assets/img/woosquare.png9.16KB5.26KB▼ 42.58%
admin/modules/square-payments/img/cc-icon/china_unionpay.png36.35KB14.71KB▼ 59.53%
admin/img/connect-bg.png44.66KB14.71KB▼ 67.07%