10% createweb-ajax-cart

Code Review | CW Ajax Cart

WordPress plugin CW Ajax Cart scored 10% from 54 tests.

About plugin

  • Plugin page: createweb-ajax-cart
  • Plugin version: 2.1
  • PHP version: 7.4.16
  • WordPress compatibility: 3.3-4.9
  • WordPress version: 5.8.1
  • First release: Jun 29, 2017
  • Latest release: Mar 6, 2018
  • Number of updates: 10
  • Update frequency: every 25.0 days
  • Top authors: igor2704 (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active / 648 total downloads

Benchmarks

Plugin footprint 40% from 16 tests

Installer 0% from 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
These installer errors require your attention
  • Install procedure validation failed for this plugin
    • > Notice in wp-content/plugins/createweb-ajax-cart/cw-shopping-cart.php+244
    Trying to access array offset on value of type bool

Server metrics [RAM: ▼1.82MB] [CPU: ▼185.93ms] Passed 4 tests

A check of server-side resources used by CW Ajax Cart
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /1.81 ▼0.915.04 ▼19.65
Dashboard /wp-admin1.83 ▼1.224.97 ▼38.50
Posts /wp-admin/edit.php1.83 ▼1.285.99 ▼38.28
Add New Post /wp-admin/post-new.php1.83 ▼3.605.47 ▼640.82
Media Library /wp-admin/upload.php1.83 ▼1.175.39 ▼26.11
Orders /wp-admin/admin.php?page=manage-cw-cart-order1.835.18
Coupons /wp-admin/edit.php?post_type=cw_coupon1.836.02
CW Ajax Cart /wp-admin/admin.php?page=manage-ajax-cart1.835.63

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

Filesystem and database footprint
The plugin installed successfully
Filesystem: 50 new files
Database: 1 new table, 4 new options
New tables
cw_cart_order
New WordPress options
widget_cw_minicart_widget
cw_cart
cw_cart_settings
cw_cart_options

Browser metrics Passed 4 tests

CW Ajax Cart: an overview of browser usage
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,884 ▲28816.53 ▲0.8223.01 ▲12.8453.27 ▲8.24
Dashboard /wp-admin3,013 ▲795.98 ▲0.00151.50 ▲1.02107.37 ▼5.01
Posts /wp-admin/edit.php2,782 ▲432.73 ▲0.0272.94 ▲7.0388.02 ▼1.57
Add New Post /wp-admin/post-new.php1,644 ▲2921.44 ▲0.09293.42 ▲8.65104.38 ▼3.56
Media Library /wp-admin/upload.php1,850 ▲435.07 ▲0.04153.48 ▼18.13106.89 ▼5.50
Orders /wp-admin/admin.php?page=manage-cw-cart-order1,1022.3360.5759.00
Coupons /wp-admin/edit.php?post_type=cw_coupon1,4392.6365.1876.57
CW Ajax Cart /wp-admin/admin.php?page=manage-ajax-cart1,4542.3659.0082.17

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

🔸 Tests weight: 35 | All plugins must uninstall correctly, removing their source code and extra database tables they might have created
The following items require your attention
  • Uninstall procedure validation failed for this plugin
    • > Notice in wp-content/plugins/createweb-ajax-cart/cw-shopping-cart.php+247
    Undefined index: cart_post_type
  • This plugin does not fully uninstall, leaving 1 option in the database
    • widget_cw_minicart_widget

Smoke tests 50% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the server (in the Apache logs)
Smoke test failed, please fix the following
  • 5 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=manage-ajax-cart
    • > Notice in wp-content/plugins/createweb-ajax-cart/includes/settings.php+234
    Undefined index: cart_post_type
    • > GET request to /wp-admin/admin.php?page=manage-ajax-cart
    • > Notice in wp-content/plugins/createweb-ajax-cart/includes/settings.php+200
    Undefined index: cart_page
    • > GET request to /wp-admin/admin.php?page=manage-ajax-cart
    • > Notice in wp-content/plugins/createweb-ajax-cart/includes/settings.php+270
    Undefined index: cart_link_text
    • > GET request to /wp-admin/admin.php?page=manage-ajax-cart
    • > Notice in wp-content/plugins/createweb-ajax-cart/includes/settings.php+356
    Undefined index: cart_added_msg
    • > GET request to /wp-admin/admin.php?page=manage-ajax-cart
    • > Notice in wp-content/plugins/createweb-ajax-cart/includes/settings.php+460
    Undefined index: cart_order_msg_success
    • > GET request to /wp-admin/admin.php?page=manage-ajax-cart
    • > Notice in wp-content/plugins/createweb-ajax-cart/includes/settings.php+475
    Undefined index: cart_redirect_page

SRP 50% from 2 tests

🔹 Tests weight: 20 | It is important to ensure that your PHP files perform no action when accessed directly, respecting the single-responsibility principle
Please fix the following items
  • 4× PHP files trigger server-side errors or warnings when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/createweb-ajax-cart/includes/settings.php:190
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_shortcode() in wp-content/plugins/createweb-ajax-cart/includes/shortcodes.php:45
    • > PHP Fatal error
      Uncaught Error: Class 'WP_Widget' not found in wp-content/plugins/createweb-ajax-cart/includes/widget.php:2
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_shortcode() in wp-content/plugins/createweb-ajax-cart/includes/shortcodes.php:45

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
No browser issues were found

Optimizations

Plugin configuration 96% from 29 tests

readme.txt Passed 16 tests

Often overlooked, readme.txt is one of the most important files in your plugin
8 plugin tags: shop cart, ajax cart, e-commerce, shop, cart...

createweb-ajax-cart/cw-shopping-cart.php 92% from 13 tests

The principal PHP file in "CW Ajax Cart" v. 2.1 is loaded by WordPress automatically on each request
You should first fix the following items:
  • Main file name: The principal plugin file should be the same as the plugin slug ("createweb-ajax-cart.php" instead of "cw-shopping-cart.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short glimpse at programming languages used with this plugin and a check that no dangerous files are present
Success! There were no dangerous files found in this plugin3,836 lines of code in 19 files:
LanguageFilesBlank linesComment linesLines of code
PHP84941831,587
JavaScript73861861,313
CSS35721747
PO File18190189

PHP code Passed 2 tests

This is a short overview of cyclomatic complexity and code structure for this plugin
This plugin has no cyclomatic complexity issues
Cyclomatic complexity
Average complexity per logical line of code0.20
Average class complexity14.33
▷ Minimum class complexity1.00
▷ Maximum class complexity25.00
Average method complexity5.00
▷ Minimum method complexity1.00
▷ Maximum method complexity17.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes3
▷ Abstract classes00.00%
▷ Concrete classes3100.00%
▷ Final classes00.00%
Methods10
▷ Static methods00.00%
▷ Public methods10100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions51
▷ Named functions51100.00%
▷ Anonymous functions00.00%
Constants2
▷ Global constants2100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
21 compressed PNG files occupy 0.04MB
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
libs/fancybox/fancy_shadow_sw.png0.33KB0.48KB0.00%
libs/fancybox/fancy_shadow_ne.png0.34KB0.48KB0.00%
libs/fancybox/fancy_title_main.png0.09KB0.14KB0.00%
libs/fancybox/fancy_close.png1.48KB1.73KB0.00%
libs/fancybox/fancy_title_left.png0.49KB0.82KB0.00%