10% ultracart-ecommerce-shopping-cart

Code Review | UltraCart Ecommerce - Shopping Cart

WordPress plugin UltraCart Ecommerce - Shopping Cart scored10%from 54 tests.

About plugin

  • Plugin page: ultracart-ecommer...
  • Plugin version: 1.42
  • PHP compatiblity: 5.6+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.6-6.1.1
  • WordPress version: 6.3.1
  • First release: Mar 3, 2017
  • Latest release: Feb 21, 2023
  • Number of updates: 65
  • Update frequency: every 33.5 days
  • Top authors: ultracart (100%)

Code review

54 tests

User reviews

1 review

Install metrics

40+ active /4,500 total downloads

Benchmarks

Plugin footprint 40% from 16 tests

Installer 0% from 1 test

🔺 Critical test (weight: 50) | All plugins must install correctly, without throwing any errors, warnings, or notices
You still need to fix the following installer errors
  • Install procedure had errors
    • > Notice in wp-content/plugins/ultracart-ecommerce-shopping-cart/uc-wp.php+17
    Constant WP_DEBUG already defined

Server metrics [RAM: ▼1.79MB] [CPU: ▼59.21ms] Passed 4 tests

An overview of server-side resources used by UltraCart Ecommerce - Shopping Cart
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /2.20 ▼1.274.65 ▼45.02
Dashboard /wp-admin2.22 ▼1.095.47 ▼45.47
Posts /wp-admin/edit.php2.22 ▼1.1410.30 ▼40.31
Add New Post /wp-admin/post-new.php2.22 ▼3.676.18 ▼106.04
Media Library /wp-admin/upload.php2.22 ▼1.025.70 ▼29.51
UltraCart /wp-admin/options-general.php?page=ucwp_plugin2.227.35

Server storage [IO: ▲10.96MB] [DB: ▲0.95MB] Passed 3 tests

Input-output and database impact of this plugin
This plugin installed successfully
Filesystem: 711 new files
Database: 2 new tables, 7 new options
New tables
wp_ucwp_items
wp_ucwp_item_post_rel
New WordPress options
ucwp_plugin_random
theysaidso_admin_options
widget_recent-comments
can_compress_scripts
widget_theysaidso_widget
db_upgraded
widget_recent-posts

Browser metrics Passed 4 tests

A check of browser resources used by UltraCart Ecommerce - Shopping Cart
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,980 ▲24513.94 ▼0.2411.49 ▲9.8649.16 ▲2.52
Dashboard /wp-admin2,233 ▲484.93 ▼0.92110.00 ▼0.6341.22 ▼5.76
Posts /wp-admin/edit.php2,115 ▲262.38 ▲0.3445.31 ▲6.0943.81 ▲9.46
Add New Post /wp-admin/post-new.php6,204 ▲4,68419.21 ▼3.83946.79 ▲306.7935.24 ▼21.60
Media Library /wp-admin/upload.php1,408 ▲264.39 ▲0.14105.50 ▼2.7141.25 ▼2.85
UltraCart /wp-admin/options-general.php?page=ucwp_plugin8231.8930.8733.67

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

🔸 Tests weight: 35 | The uninstall procedure must remove all plugin files and extra database tables
These items require your attention
  • This plugin did not uninstall without warnings or errors
    • > Notice in wp-content/plugins/ultracart-ecommerce-shopping-cart/uc-wp.php+17
    Constant WP_DEBUG already defined
  • This plugin does not fully uninstall, leaving 7 options in the database
    • can_compress_scripts
    • widget_recent-posts
    • db_upgraded
    • theysaidso_admin_options
    • ucwp_plugin_random
    • widget_theysaidso_widget
    • widget_recent-comments

Smoke tests 25% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | This is a shallow check for server-side errors
Almost there, just fix the following server-side errors
    • > GET request to /wp-admin/options-general.php?page=ucwp_plugin
    • > Notice in wp-content/plugins/ultracart-ecommerce-shopping-cart/uc-wp.php+17
    Constant WP_DEBUG already defined
    • > GET request to /wp-admin/options-general.php?page=ucwp_plugin
    • > User notice in wp-includes/functions.php+5905
    Function wp_register_style was called incorrectly. Scripts and styles should not be registered or enqueued until the wp_enqueue_scripts, admin_enqueue_scripts, or login_enqueue_scripts hooks. This notice was triggered by the uc-wp-admin.css handle. Please see Debugging in WordPress for more information. (This message was added in version 3.3.0.)
    • > GET request to /wp-admin/options-general.php?page=ucwp_plugin
    • > User notice in wp-includes/functions.php+5905
    Function wp_enqueue_style was called incorrectly. Scripts and styles should not be registered or enqueued until the wp_enqueue_scripts, admin_enqueue_scripts, or login_enqueue_scripts hooks. This notice was triggered by the uc-wp-admin.css handle. Please see Debugging in WordPress for more information. (This message was added in version 3.3.0.)
  • 13 occurences, only the last one shown
    • > GET request to /wp-admin/options-general.php?page=ucwp_plugin
    • > POST request to /wp-cron.php?doing_wp_cron=1696658530.1360850334167480468750
    • > Notice in wp-content/plugins/pressforward/Core/Utility/Retrieval.php+206
    Trying to get property 'ID' of non-object
    • > GET request to /wp-admin/options-general.php?page=ucwp_plugin
    • > Notice in wp-content/plugins/ultracart-ecommerce-shopping-cart/settings.php+181
    Undefined index: code
    • > GET request to /wp-admin/options-general.php?page=ucwp_plugin
    • > Notice in wp-content/plugins/ultracart-ecommerce-shopping-cart/settings.php+182
    Undefined index: state
  • 3 occurences, only the last one shown
    • > GET request to /wp-admin/options-general.php?page=ucwp_plugin
    • > POST request to /wp-cron.php?doing_wp_cron=1696658530.1360850334167480468750
    • > Notice in wp-content/plugins/pressforward/Core/Utility/Retrieval.php+222
    Trying to get property 'post_title' of non-object
  • 3 occurences, only the last one shown
    • > GET request to /wp-admin/options-general.php?page=ucwp_plugin
    • > POST request to /wp-cron.php?doing_wp_cron=1696658530.1360850334167480468750
    • > Notice in wp-content/plugins/pressforward/Core/Utility/Retrieval.php+204
    Undefined offset: 0
  • 3 occurences, only the last one shown
    • > GET request to /wp-admin/options-general.php?page=ucwp_plugin
    • > POST request to /wp-cron.php?doing_wp_cron=1696658530.1360850334167480468750
    • > Notice in wp-content/plugins/pressforward/Core/Utility/Retrieval.php+205
    Trying to get property 'guid' of non-object

SRP 0% from 2 tests

🔹 Tests weight: 20 | The single-responsibility principle: PHP files have to remain inert when accessed directly, throwing no errors and performing no actions
Almost there! Just fix the following items
  • 2× GET requests to PHP files return non-empty strings:
    • > /wp-content/plugins/ultracart-ecommerce-shopping-cart/templates/ucwp_item_list.php
    • > /wp-content/plugins/ultracart-ecommerce-shopping-cart/install.php
  • 527× PHP files trigger server-side errors or warnings when accessed directly (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Interface 'ultracart\\v2\\models\\ModelInterface' not found in wp-content/plugins/ultracart-ecommerce-shopping-cart/vendor/ultracart/rest_api_v2_sdk_php/lib/models/WebhookLog.php:42
    • > PHP Fatal error
      Uncaught Error: Class 'GuzzleHttp\\Cookie\\CookieJar' not found in wp-content/plugins/ultracart-ecommerce-shopping-cart/vendor/guzzlehttp/guzzle/src/Cookie/SessionCookieJar.php:7
    • > PHP Fatal error
      Uncaught Error: Interface 'Psr\\Http\\Message\\StreamInterface' not found in wp-content/plugins/ultracart-ecommerce-shopping-cart/vendor/guzzlehttp/psr7/src/BufferStream.php:14
    • > PHP Fatal error
      Uncaught Error: Interface 'ultracart\\v2\\models\\ModelInterface' not found in wp-content/plugins/ultracart-ecommerce-shopping-cart/vendor/ultracart/rest_api_v2_sdk_php/lib/models/CheckoutSetupBrowserKeyRequest.php:42
    • > PHP Fatal error
      Uncaught Error: Interface 'ultracart\\v2\\models\\ModelInterface' not found in wp-content/plugins/ultracart-ecommerce-shopping-cart/vendor/ultracart/rest_api_v2_sdk_php/lib/models/ExperimentVariation.php:42
    • > PHP Fatal error
      Uncaught Error: Interface 'ultracart\\v2\\models\\ModelInterface' not found in wp-content/plugins/ultracart-ecommerce-shopping-cart/vendor/ultracart/rest_api_v2_sdk_php/lib/models/OrderFraudScore.php:42
    • > PHP Fatal error
      Uncaught Error: Interface 'ultracart\\v2\\models\\ModelInterface' not found in wp-content/plugins/ultracart-ecommerce-shopping-cart/vendor/ultracart/rest_api_v2_sdk_php/lib/models/EmailClicksResponse.php:42
    • > PHP Fatal error
      Uncaught Error: Interface 'ultracart\\v2\\models\\ModelInterface' not found in wp-content/plugins/ultracart-ecommerce-shopping-cart/vendor/ultracart/rest_api_v2_sdk_php/lib/models/CouponAmountOffShipping.php:42
    • > PHP Fatal error
      Uncaught Error: Interface 'ultracart\\v2\\models\\ModelInterface' not found in wp-content/plugins/ultracart-ecommerce-shopping-cart/vendor/ultracart/rest_api_v2_sdk_php/lib/models/AccountsReceivableRetryStatRevenue.php:42
    • > PHP Fatal error
      Uncaught Error: Interface 'ultracart\\v2\\models\\ModelInterface' not found in wp-content/plugins/ultracart-ecommerce-shopping-cart/vendor/ultracart/rest_api_v2_sdk_php/lib/models/CartSettingsTerms.php:42

User-side errors Passed 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
No browser issues were found

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 94% 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
Please fix the following attributes:
  • Tags: Please delete some tags, you are using 12 tag instead of maximum 10
You can look at the official readme.txt

ultracart-ecommerce-shopping-cart/uc-wp.php 92% from 13 tests

This is the main PHP file of "UltraCart Ecommerce - Shopping Cart" version 1.42, providing information about the plugin in the header fields and serving as the principal entry point to the plugin's functions
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 ("ultracart-ecommerce-shopping-cart.php" instead of "uc-wp.php")

Code Analysis 97% from 3 tests

File types Passed 1 test

🔸 Test weight: 35 | Executable files are considered dangerous and should not be included with any WordPress plugin
No dangerous file extensions were detected172,132 lines of code in 679 files:
LanguageFilesBlank linesComment linesLines of code
PHP61435,228130,101157,649
JavaScript201,0371,4536,013
Markdown151,10304,131
JSON13002,792
Sass9206521,016
CSS31724478
XML11020
Dockerfile18010
YAML10010
make1409
SVG1004

PHP code 50% from 2 tests

This is a short overview of cyclomatic complexity and code structure for this plugin
The following items need your attention
  • Class cyclomatic complexity has to be reduced to less than 1000 (currently 2,952)
Cyclomatic complexity
Average complexity per logical line of code0.33
Average class complexity26.21
▷ Minimum class complexity1.00
▷ Maximum class complexity2,952.00
Average method complexity1.97
▷ Minimum method complexity1.00
▷ Maximum method complexity81.00
Code structure
Namespaces14
Interfaces16
Traits2
Classes554
▷ Abstract classes00.00%
▷ Concrete classes554100.00%
▷ Final classes132.35%
Methods14,829
▷ Static methods2,47816.71%
▷ Public methods14,47497.61%
▷ Protected methods2261.52%
▷ Private methods1290.87%
Functions900
▷ Named functions14716.33%
▷ Anonymous functions75383.67%
Constants801
▷ Global constants506.24%
▷ Class constants75193.76%
▷ Public constants751100.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

Using a strong compression for your PNG files is a great way to speed-up your plugin
20 PNG files occupy 1.27MB with 0.57MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/banner-772x250.png145.98KB62.94KB▼ 56.88%
assets/screenshot-10.png5.05KB3.92KB▼ 22.39%
assets/screenshot-4.png53.67KB39.58KB▼ 26.25%
assets/screenshot-12.png13.15KB8.11KB▼ 38.31%
assets/imgs/mce-icons/item.png1.05KB0.19KB▼ 82.33%