83% woocommerce-dynamic-gallery

Code Review | Dynamic Product Gallery for WooCommerce

WordPress plugin Dynamic Product Gallery for WooCommerce scored83%from 54 tests.

About plugin

  • Plugin page: woocommerce-dynam...
  • Plugin version: 3.5.2
  • PHP version: 7.4.16
  • WordPress compatibility: 6.0.0-6.4
  • WordPress version: 6.3.1
  • First release: Jul 16, 2012
  • Latest release: Nov 22, 2023
  • Number of updates: 267
  • Update frequency: every 15.5 days
  • Top authors: a3rev (100%)

Code review

54 tests

User reviews

38 reviews

Install metrics

3,000+ active /370,698 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
The plugin installed successfully, without throwing any errors or notices

Server metrics [RAM: ▲2.51MB] [CPU: ▲12.05ms] Passed 4 tests

Server-side resources used by Dynamic Product Gallery for WooCommerce
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /5.96 ▲2.4963.24 ▲19.75
Dashboard /wp-admin5.83 ▲2.4859.83 ▼3.15
Posts /wp-admin/edit.php5.88 ▲2.5265.03 ▲15.30
Add New Post /wp-admin/post-new.php8.44 ▲2.55108.65 ▲16.28
Media Library /wp-admin/upload.php5.79 ▲2.5654.17 ▲21.19
Dynamic Gallery /wp-admin/admin.php?page=woo-dynamic-gallery5.8063.86

Server storage [IO: ▲3.76MB] [DB: ▲0.06MB] Passed 3 tests

How much does this plugin use your filesystem and database?
The plugin installed successfully
Filesystem: 235 new files
Database: no new tables, 75 new options
New WordPress options
wc_dgallery_product_gallery_nav
wc_dgallery_product_gallery_animation_speed
wc_dgallery_variation_gallery_effect_speed
wc_dgallery_navbar_padding_bottom
wc_dgallery_stop_scroll_1image
wc_dgallery_main_padding_right
theysaidso_admin_options
wc_dgallery_product_gallery_speed
wc_dgallery_product_gallery_height
wc_dgallery_reset_variation_activate
...

Browser metrics Passed 4 tests

An overview of browser requirements for Dynamic Product Gallery for WooCommerce
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,794 ▲5814.72 ▲0.291.71 ▼0.1541.69 ▼2.86
Dashboard /wp-admin2,194 ▲165.53 ▼0.1991.03 ▼21.1442.29 ▼0.11
Posts /wp-admin/edit.php2,102 ▲22.02 ▲0.0140.26 ▼0.1536.96 ▼1.98
Add New Post /wp-admin/post-new.php1,544 ▲1823.26 ▲0.06632.70 ▼43.3452.20 ▲1.96
Media Library /wp-admin/upload.php1,405 ▲24.21 ▼0.0399.02 ▼2.4242.71 ▲0.98
Dynamic Gallery /wp-admin/admin.php?page=woo-dynamic-gallery2,4794.0293.17108.91

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

🔸 Tests weight: 35 | It is important to correctly uninstall your plugin, without leaving any traces
These items require your attention
  • This plugin does not fully uninstall, leaving 74 options in the database
    • wc_dgallery_thumb_slider_border
    • widget_theysaidso_widget
    • wc_dgallery_activate
    • wc_dgallery_navbar_bg_color
    • wc_dgallery_stop_scroll_1image
    • wc_dgallery_variation_gallery_effect_speed
    • wc_dgallery_main_margin_top
    • wc_dgallery_caption_bg_transparent
    • wc_dgallery_thumb_columns
    • wc_dgallery_navbar_margin_right
    • ...

Smoke tests 75% 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 50% from 2 tests

🔹 Tests weight: 20 | A shallow check of the single-responsibility principle; PHP files should perform no action - including output of placeholder text - and trigger no errors when accessed directly
Please fix the following items
  • 5× PHP files trigger errors when accessed directly with GET requests:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_option() in wp-content/plugins/woocommerce-dynamic-gallery/templates/customized_style.php:3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/woocommerce-dynamic-gallery/src/blocks/product-dgallery/block.php:58
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/woocommerce-dynamic-gallery/admin/wc_gallery_woocommerce_admin.php:33
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_basename() in wp-content/plugins/woocommerce-dynamic-gallery/wc_dynamic_gallery_woocommerce.php:31
    • > PHP Fatal error
      Uncaught Error: Class 'WP_Widget' not found in wp-content/plugins/woocommerce-dynamic-gallery/widget/wc-dynamic-gallery-widgets.php:17

User-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
No browser issues were found

Optimizations

Plugin configuration 90% from 29 tests

readme.txt Passed 16 tests

The readme.txt file is important because it is parsed by WordPress.org for the public listing of your plugin
7 plugin tags: woocommerce product images, woocommerce product gallery, woocommerce, woocommerce image gallery, elementor woocommerce product gallery...

woocommerce-dynamic-gallery/wc_dynamic_gallery_woocommerce.php 77% from 13 tests

This is the main PHP file of "Dynamic Product Gallery for WooCommerce" version 3.5.2, 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:
  • Requires at least: The required version number must match the one declared in readme.txt ("6.0" instead of "6.0.0")
  • Main file name: Even though not officially enforced, the main plugin file should be the same as the plugin slug ("woocommerce-dynamic-gallery.php" instead of "wc_dynamic_gallery_woocommerce.php")
  • Description: Please don't use more than 140 characters for the plugin description (currently 373 characters long)

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
Everything looks great! No dangerous files found in this plugin60,775 lines of code in 131 files:
LanguageFilesBlank linesComment linesLines of code
JSON50023,768
JavaScript403,7522,32718,894
PHP402,5072,10511,366
CSS285022124,609
PO File24917711,228
LESS710126806
SVG53049
HTML12029
Sass32126

PHP code 50% from 2 tests

A short review of cyclomatic complexity and code structure
Please tend to the following items
  • Method cyclomatic complexity has to be reduced to less than 100 (currently 410)
Cyclomatic complexity
Average complexity per logical line of code0.44
Average class complexity67.61
▷ Minimum class complexity1.00
▷ Maximum class complexity801.00
Average method complexity6.10
▷ Minimum method complexity1.00
▷ Maximum method complexity410.00
Code structure
Namespaces7
Interfaces0
Traits0
Classes31
▷ Abstract classes00.00%
▷ Concrete classes31100.00%
▷ Final classes00.00%
Methods396
▷ Static methods307.58%
▷ Public methods22757.32%
▷ Protected methods14135.61%
▷ Private methods287.07%
Functions20
▷ Named functions1575.00%
▷ Anonymous functions525.00%
Constants20
▷ Global constants1575.00%
▷ Class constants525.00%
▷ Public constants5100.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
66 PNG files occupy 0.30MB with 0.06MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/js/fancybox/images/fancybox/fancy_shadow_w.png0.10KB0.18KB0.00%
assets/js/colorbox/images/ie6/borderBottomCenter.png0.11KB0.10KB▼ 8.11%
admin/assets/images/play_video.png17.30KB9.38KB▼ 45.75%
assets/images/logo_a3blue.png2.41KB1.33KB▼ 44.78%
assets/js/colorbox/images/ie6/borderTopCenter.png0.11KB0.10KB▼ 8.11%