47% ct-commerce

Code Review | CT Commerce

WordPress plugin CT Commerce scored 47% from 54 tests.

About plugin

  • Plugin page: ct-commerce
  • Plugin version: 2.0.1
  • PHP version: 7.4.16
  • WordPress compatibility: 4.9-5.5.1
  • WordPress version: 5.9.2
  • First release: Oct 16, 2018
  • Latest release: Nov 3, 2020
  • Number of updates: 124
  • Update frequency: every 6.1 days
  • Top authors: ujw0l (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active / 1,320 total downloads

Benchmarks

Plugin footprint 48% from 16 tests

Installer Passed 1 test

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

Server metrics [RAM: ▲2.63MB] [CPU: ▼298.94ms] Passed 4 tests

An overview of server-side resources used by CT Commerce
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /7.01 ▲3.4966.10 ▲7.00
Dashboard /wp-admin6.99 ▲3.5853.44 ▲16.90
Posts /wp-admin/edit.php7.25 ▲3.6065.04 ▲27.35
Add New Post /wp-admin/post-new.php6.81 ▼0.1642.69 ▼1,230.89
Media Library /wp-admin/upload.php6.88 ▲3.5837.36 ▲11.23

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

A short overview of filesystem and database impact
No storage issues were detected
Filesystem: 317 new files
Database: 10 new tables, 5 new options
New tables
wp_ctCommerceCustomerInfo
wp_ctCommerceProducts
wp_ctCommerceCompleteOrders
wp_ctCommerceRefund
wp_ctCommerceProductRating
wp_ctCommercePendingOrders
wp_ctCommercePurgedProducts
wp_ctCommerceCustomerHistory
wp_ctCommerceProductCategory
wp_ctCommerceDiscount
New WordPress options
widget_ctcommerce_cart_widget
category_children
widget_ctcommerce_user_login_registration_widget
widget_ctcommerce_category_widget
widget_ctcommerce_coupon_widget

Browser metrics Passed 4 tests

Checking browser requirements for CT Commerce
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /4,181 ▲42718.26 ▲2.2918.55 ▲12.622.84 ▲0.64
Dashboard /wp-admin3,117 ▲2668.32 ▲2.11142.12 ▼5.21172.85 ▼54.25
Posts /wp-admin/edit.php2,963 ▲2785.19 ▲1.97147.39 ▲76.81185.46 ▼7.93
Add New Post /wp-admin/post-new.php1,688 ▲2821.17 ▼1.28430.58 ▼16.17174.79 ▲12.66
Media Library /wp-admin/upload.php1,734 ▲365.63 ▲0.14113.54 ▼28.11215.18 ▲20.42

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

🔸 Tests weight: 35 | It is important to correctly uninstall your plugin, without leaving any traces
It is recommended to fix the following
  • Uninstall procedure validation failed for this plugin
    • > Notice in wp-content/plugins/ct-commerce/classes/ctCommerceAdminPanelProcessing.php+303
    Trying to access array offset on value of type null
  • Zombie tables were found after uninstall: 10 tables
    • wp_ctCommerceCustomerHistory
    • wp_ctCommerceCompleteOrders
    • wp_ctCommerceProductCategory
    • wp_ctCommerceProducts
    • wp_ctCommercePendingOrders
    • wp_ctCommerceRefund
    • wp_ctCommerceDiscount
    • wp_ctCommerceCustomerInfo
    • wp_ctCommercePurgedProducts
    • wp_ctCommerceProductRating
  • This plugin does not fully uninstall, leaving 5 options in the database
    • widget_ctcommerce_category_widget
    • widget_ctcommerce_user_login_registration_widget
    • category_children
    • widget_ctcommerce_cart_widget
    • widget_ctcommerce_coupon_widget

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
Even though no errors were found, 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
Almost there! Just fix the following items
  • 2× PHP files perform the task of outputting text when accessed with GET requests:
    • > /wp-content/plugins/ct-commerce/classes/otherContent/payment/stripe-php/update_certs.php
    • > /wp-content/plugins/ct-commerce/classes/otherContent/payment/stripe-php/build.php
  • 205× PHP files trigger errors when accessed directly with GET requests (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'Stripe\\Service\\AbstractServiceFactory' not found in wp-content/plugins/ct-commerce/classes/otherContent/payment/stripe-php/lib/Service/Sigma/SigmaServiceFactory.php:12
    • > PHP Fatal error
      Uncaught Error: Class 'Stripe\\Exception\\OAuth\\OAuthErrorException' not found in wp-content/plugins/ct-commerce/classes/otherContent/payment/stripe-php/lib/Exception/OAuth/InvalidScopeException.php:8
    • > PHP Fatal error
      Uncaught Error: Class 'Stripe\\Service\\AbstractService' not found in wp-content/plugins/ct-commerce/classes/otherContent/payment/stripe-php/lib/Service/Reporting/ReportTypeService.php:7
    • > PHP Fatal error
      Uncaught Error: Class 'Stripe\\Service\\AbstractService' not found in wp-content/plugins/ct-commerce/classes/otherContent/payment/stripe-php/lib/Service/Checkout/SessionService.php:7
    • > PHP Fatal error
      Uncaught Error: Class 'Stripe\\ApiResource' not found in wp-content/plugins/ct-commerce/classes/otherContent/payment/stripe-php/lib/OrderReturn.php:26
    • > PHP Fatal error
      Uncaught Error: Class 'Stripe\\ApiResource' not found in wp-content/plugins/ct-commerce/classes/otherContent/payment/stripe-php/lib/InvoiceItem.php:41
    • > PHP Fatal error
      Uncaught Error: Class 'Stripe\\ApiResource' not found in wp-content/plugins/ct-commerce/classes/otherContent/payment/stripe-php/lib/Reporting/ReportRun.php:30
    • > PHP Fatal error
      Uncaught Error: Class 'Stripe\\ApiResource' not found in wp-content/plugins/ct-commerce/classes/otherContent/payment/stripe-php/lib/File.php:30
    • > PHP Fatal error
      Uncaught Error: Class 'Stripe\\ApiResource' not found in wp-content/plugins/ct-commerce/classes/otherContent/payment/stripe-php/lib/Issuing/Card.php:33
    • > PHP Fatal error
      Uncaught Error: Class 'Stripe\\Error\\Base' not found in wp-content/plugins/ct-commerce/classes/otherContent/payment/stripe-php/lib/Error/ApiConnection.php:5

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)
There were no browser issues found

Optimizations

Plugin configuration 90% from 29 tests

readme.txt 88% from 16 tests

The readme.txt file is undoubtedly the most important file in your plugin, preparing it for public listing on WordPress.org
These attributes need to be fixed:
  • Screenshots: These screenshots do not have images: #1 (Featured product page), #2 (Product page with built-in social sharing), #3 (Cart preview widget), #4 (Product category widget), #5 (User login widget), #6 (Built in CTC overlay), #7 (Sales activities snapshot), #8 (Product category bar-chart), #9 (Admin panel product list), #10 (Admin panel discount list), #11 (Pending orders list), #12 (Complete orders list), #13 (CT commerce auto generated menu), #14 (Tooltip cart preview), #15 (Check out page), #16 (Built in user registration for in modal window)
  • Requires php: Version not formatted correctly
You can take inspiration from this readme.txt

ct-commerce/ctCommerce.php 92% from 13 tests

"CT Commerce" version 2.0.1's main PHP file describes plugin functionality and also serves as the entry point to any WordPress functionality
You should first fix the following items:
  • Main file name: The principal plugin file should be the same as the plugin slug ("ct-commerce.php" instead of "ctCommerce.php")

Code Analysis 5% from 3 tests

File types 0% from 1 test

🔸 Test weight: 35 | A short glimpse at programming languages used with this plugin and a check that no dangerous files are present
These items require your attention
  • You should never include executable (binary) or otherwise dangerous files in your plugin
    • .crt - Security Certificate in Firefox, IE, Chrome, Safari
      • wp-content/plugins/ct-commerce/classes/otherContent/payment/stripe-php/data/ca-certificates 2.crt
      • wp-content/plugins/ct-commerce/classes/otherContent/payment/stripe-php/data/ca-certificates.crt
22,249 lines of code in 288 files:
LanguageFilesBlank linesComment linesLines of code
PHP2675,0369,87814,013
CSS31,4311053,641
JavaScript46704773,042
Markdown681201,378
XML30061
JSON10048
YAML37139
make19027

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.20
Average class complexity4.56
▷ Minimum class complexity1.00
▷ Maximum class complexity153.00
Average method complexity1.93
▷ Minimum method complexity1.00
▷ Maximum method complexity20.00
Code structure
Namespaces23
Interfaces7
Traits14
Classes240
▷ Abstract classes114.58%
▷ Concrete classes22995.42%
▷ Final classes00.00%
Methods964
▷ Static methods17418.05%
▷ Public methods86689.83%
▷ Protected methods383.94%
▷ Private methods606.22%
Functions13
▷ Named functions00.00%
▷ Anonymous functions13100.00%
Constants690
▷ Global constants50.72%
▷ Class constants68599.28%
▷ Public constants685100.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

PNG files should be compressed to save space and minimize bandwidth usage
16 PNG files occupy 3.87MB with 2.77MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
screenshot-9.png276.49KB70.23KB▼ 74.60%
screenshot-12.png227.15KB71.58KB▼ 68.49%
screenshot-11.png129.92KB39.39KB▼ 69.69%
screenshot-16.png249.13KB75.07KB▼ 69.87%
screenshot-4.png123.74KB30.54KB▼ 75.32%