67% advanced-product-labels-for-woocommerce

Code Review | Advanced Product Labels for WooCommerce

WordPress plugin Advanced Product Labels for WooCommerce scored67%from 54 tests.

About plugin

  • Plugin page: advanced-product-...
  • Plugin version: 1.2.5.2
  • PHP version: 7.4.16
  • WordPress compatibility: 5.0-6.3.1
  • WordPress version: 6.3.1
  • First release: Aug 15, 2016
  • Latest release: Sep 21, 2023
  • Number of updates: 139
  • Update frequency: every 18.7 days
  • Top authors: dholovnia (56.83%)RazyRx (43.88%)

Code review

54 tests

User reviews

225 reviews

Install metrics

20,000+ active /442,031 total downloads

Benchmarks

Plugin footprint 65% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Verifying that this plugin installs correctly without errors
This plugin's installer ran successfully

Server metrics [RAM: ▲1.91MB] [CPU: ▲12.92ms] Passed 4 tests

This is a short check of server-side resources used by Advanced Product Labels for WooCommerce
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /5.49 ▲2.0354.07 ▲5.89
Dashboard /wp-admin5.23 ▲1.9371.63 ▲16.88
Posts /wp-admin/edit.php5.28 ▲1.9268.04 ▲21.67
Add New Post /wp-admin/post-new.php7.75 ▲1.86102.44 ▲7.25
Media Library /wp-admin/upload.php5.15 ▲1.9359.66 ▲28.83

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

A short overview of filesystem and database impact
This plugin was installed successfully
Filesystem: 192 new files
Database: 1 new table, 9 new options
New tables
wp_berocket_termmeta
New WordPress options
widget_recent-posts
widget_theysaidso_widget
br_filters_color_database
db_upgraded
theysaidso_admin_options
can_compress_scripts
br-products_label-options
widget_recent-comments
berocket_admin_notices_rate_stars

Browser metrics Passed 4 tests

An overview of browser requirements for Advanced Product Labels for WooCommerce
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,807 ▲4614.24 ▼0.380.97 ▼0.7644.27 ▼0.56
Dashboard /wp-admin2,228 ▲485.70 ▲0.0587.60 ▼4.6780.01 ▲37.76
Posts /wp-admin/edit.php2,142 ▲422.06 ▲0.0337.13 ▼0.4235.60 ▲1.03
Add New Post /wp-admin/post-new.php1,582 ▲5623.12 ▼0.40767.09 ▲131.0762.13 ▲12.34
Media Library /wp-admin/upload.php1,436 ▲364.26 ▼0.00100.09 ▼2.8582.83 ▲39.97

Uninstaller [IO: ▲0.00MB] [DB: ▲0.00MB] 50% 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
  • The uninstall procedure failed, leaving 1 table in the database
    • wp_berocket_termmeta
  • Zombie WordPress options were found after uninstall: 9 options
    • berocket_admin_notices_rate_stars
    • theysaidso_admin_options
    • widget_recent-comments
    • can_compress_scripts
    • db_upgraded
    • widget_theysaidso_widget
    • berocket_key_activated_plugins
    • br_filters_color_database
    • widget_recent-posts

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the server (in the Apache logs)
Everything seems fine, however this is by no means an exhaustive test

SRP 0% from 2 tests

🔹 Tests weight: 20 | SRP (Single-Responsibility Principle) - PHP files must act as libraries and never output text or perform any action when accessed directly in a browser
Please take a closer look at the following
  • 1× GET requests to PHP files return non-empty strings:
    • > /wp-content/plugins/advanced-product-labels-for-woocommerce/includes/theme_compatibility/storefront.php
  • 41× PHP files trigger server-side errors or warnings when accessed directly (only 10 are shown):
    • > PHP Notice
      Undefined variable: title in wp-content/plugins/advanced-product-labels-for-woocommerce/berocket/templates/widget.php on line 1
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/advanced-product-labels-for-woocommerce/includes/compatibility/product_preview.php:4
    • > PHP Fatal error
      Uncaught Error: Using $this when not in object context in wp-content/plugins/advanced-product-labels-for-woocommerce/berocket/templates/settings_footer.php:3
    • > PHP Fatal error
      Uncaught Error: Class 'BeRocket_framework_addon_lib' not found in wp-content/plugins/advanced-product-labels-for-woocommerce/addons/ajax_load/ajax_load.php:2
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/advanced-product-labels-for-woocommerce/berocket/includes/admin_notices.php:797
    • > PHP Fatal error
      Uncaught Error: Class 'BeRocket_framework_addon_lib' not found in wp-content/plugins/advanced-product-labels-for-woocommerce/addons/gradients/gradients.php:2
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_dir_path() in wp-content/plugins/advanced-product-labels-for-woocommerce/berocket/includes/updater.php:5
    • > PHP Fatal error
      Uncaught Error: Class 'BeRocket_framework_addon_lib' not found in wp-content/plugins/advanced-product-labels-for-woocommerce/addons/timers/timers.php:2
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/advanced-product-labels-for-woocommerce/berocket/libraries/popup.php:7
    • > PHP Fatal error
      Uncaught Error: Class 'BeRocket_plugin_variations' not found in wp-content/plugins/advanced-product-labels-for-woocommerce/includes/better_position.php:3

User-side errors Passed 1 test

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

Optimizations

Plugin configuration 86% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file is important because it is parsed by WordPress.org for the public listing of your plugin
Attributes that require attention:
  • Tags: There are too many tags (44 tag instead of maximum 10)
You can look at the official readme.txt

advanced-product-labels-for-woocommerce/woocommerce-advanced-products-labels.php 77% from 13 tests

The primary PHP file in "Advanced Product Labels for WooCommerce" version 1.2.5.2 is used by WordPress to initiate all plugin functionality
Please make the necessary changes and fix the following:
  • Text Domain: The text domain name must use dashes instead of underscores, and it must be lowercase
  • Domain Path: The domain path points to a folder that does not exist ("/languages/")
  • Main file name: It is recommended to name the main PHP file as the plugin slug ("advanced-product-labels-for-woocommerce.php" instead of "woocommerce-advanced-products-labels.php")

Code Analysis Passed 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
There were no executable files found in this plugin25,712 lines of code in 94 files:
LanguageFilesBlank linesComment linesLines of code
PHP576551,26611,931
CSS182,68514610,947
JavaScript14114842,291
PO File2194216430
JSX16179
XML20034

PHP code Passed 2 tests

An short overview of logical lines of code, cyclomatic complexity, and other code metrics
This plugin has no cyclomatic complexity issues
Cyclomatic complexity
Average complexity per logical line of code0.53
Average class complexity40.57
▷ Minimum class complexity1.00
▷ Maximum class complexity240.00
Average method complexity4.62
▷ Minimum method complexity1.00
▷ Maximum method complexity98.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes44
▷ Abstract classes00.00%
▷ Concrete classes44100.00%
▷ Final classes00.00%
Methods481
▷ Static methods16534.30%
▷ Public methods47999.58%
▷ Protected methods00.00%
▷ Private methods20.42%
Functions33
▷ Named functions33100.00%
▷ Anonymous functions00.00%
Constants9
▷ Global constants9100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

PNG files should be compressed to save space and minimize bandwidth usage
77 PNG files occupy 0.38MB with 0.10MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
images/templates/preview/css-23.png1.89KB1.48KB▼ 22.07%
images/templates/preview/css-6.png1.65KB1.15KB▼ 30.37%
images/templates/preview/css-28.png2.21KB1.68KB▼ 23.99%
images/preview.png2.94KB2.36KB▼ 19.69%
berocket/libraries/addons/default.png3.87KB2.63KB▼ 31.94%