67% advanced-product-labels-for-woocommerce

Code Review | Advanced Product Labels for WooCommerce

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

About plugin

  • Plugin page: advanced-product-...
  • Plugin version: 1.2.3.7
  • PHP version: 7.4.16
  • WordPress compatibility: 5.0-5.9
  • WordPress version: 5.9.2
  • First release: Aug 15, 2016
  • Latest release: Feb 15, 2022
  • Number of updates: 129
  • Update frequency: every 15.6 days
  • Top authors: dholovnia (59.69%)RazyRx (41.09%)

Code review

54 tests

User reviews

207 reviews

Install metrics

20,000+ active / 328,455 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
The plugin installed successfully, without throwing any errors or notices

Server metrics [RAM: ▲0.30MB] [CPU: ▼294.81ms] Passed 4 tests

An overview of server-side resources used by Advanced Product Labels for WooCommerce
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /3.95 ▲0.8366.93 ▲49.46
Dashboard /wp-admin3.70 ▲0.3036.23 ▲3.55
Posts /wp-admin/edit.php3.93 ▲0.2943.29 ▲7.17
Add New Post /wp-admin/post-new.php7.23 ▲0.2695.64 ▼1,192.84
Media Library /wp-admin/upload.php3.65 ▲0.3627.54 ▲2.87

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

How much does this plugin use your filesystem and database?
The plugin installed successfully
Filesystem: 177 new files
Database: 1 new table, 3 new options
New tables
wp_berocket_termmeta
New WordPress options
br_filters_color_database
berocket_admin_notices_rate_stars
br-products_label-options

Browser metrics Passed 4 tests

A check of browser resources used by Advanced Product Labels for WooCommerce
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,802 ▲7915.55 ▼0.095.50 ▼0.262.24 ▼0.31
Dashboard /wp-admin2,936 ▲756.06 ▼0.05125.96 ▼10.17173.73 ▲13.66
Posts /wp-admin/edit.php2,733 ▲453.24 ▲0.0164.41 ▼0.51138.12 ▼3.95
Add New Post /wp-admin/post-new.php1,696 ▲3516.86 ▲0.90404.21 ▼9.37197.03 ▲39.04
Media Library /wp-admin/upload.php1,737 ▲425.69 ▲0.16124.86 ▼18.92222.12 ▲31.70

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
It is recommended to fix the following
  • Zombie tables detected upon uninstall: 1 table
    • wp_berocket_termmeta
  • Zombie WordPress options detected upon uninstall: 3 options
    • berocket_key_activated_plugins
    • br_filters_color_database
    • berocket_admin_notices_rate_stars

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no server-side errors were triggered
Even though everything seems fine, this is not 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
Please fix the following items
  • 1× PHP files perform the action of outputting non-empty strings when accessed directly:
    • > /wp-content/plugins/advanced-product-labels-for-woocommerce/includes/theme_compatibility/storefront.php
  • 37× PHP files trigger server-side errors or warnings when accessed directly (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Call to undefined function apply_filters() in wp-content/plugins/advanced-product-labels-for-woocommerce/includes/svg/css-9.php:3
    • > PHP Fatal error
      Uncaught Error: Class 'BeRocket_framework_addon_lib' not found in wp-content/plugins/advanced-product-labels-for-woocommerce/addons/labels_for_variations/labels_for_variations.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: Call to undefined function add_action() in wp-content/plugins/advanced-product-labels-for-woocommerce/berocket/libraries/tippy.php:7
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/advanced-product-labels-for-woocommerce/berocket/sale/sale.php:4
    • > PHP Fatal error
      Uncaught Error: Class 'BeRocket_framework_addon_lib' not found in wp-content/plugins/advanced-product-labels-for-woocommerce/addons/advanced_content/advanced_content.php:2
    • > 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/style_generate.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: Call to undefined function add_filter() in wp-content/plugins/advanced-product-labels-for-woocommerce/berocket/libraries/tutorial.php:10

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 86% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file is an important file in your plugin as it is parsed by WordPress.org to prepare the public listing of your plugin
Attributes that require attention:
  • Tags: Too many tags (44 tag instead of maximum 10); only the first 5 tags are used in your directory listing
You can look at the official readme.txt

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

The main file in "Advanced Product Labels for WooCommerce" v. 1.2.3.7 serves as a complement to information provided in readme.txt and as the entry point to the plugin
You should first fix the following items:
  • Text Domain: Please use dashes and lowercase characters for text domains
  • Main file name: Even though not officially enforced, the main plugin file should be the same as the plugin slug ("advanced-product-labels-for-woocommerce.php" instead of "woocommerce-advanced-products-labels.php")
  • Domain Path: The domain path is invalid: folder "/languages/" does not exist

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | There should be no dangerous file extensions present in any WordPress plugin
There were no executable files found in this plugin24,931 lines of code in 80 files:
LanguageFilesBlank linesComment linesLines of code
PHP526401,32411,388
CSS162,68414610,913
JavaScript8110812,166
PO File2194216430
XML20034

PHP code Passed 2 tests

An short overview of logical lines of code, cyclomatic complexity, and other code metrics
There are no cyclomatic complexity problems detected for this plugin
Cyclomatic complexity
Average complexity per logical line of code0.53
Average class complexity41.62
▷ Minimum class complexity1.00
▷ Maximum class complexity240.00
Average method complexity4.59
▷ Minimum method complexity1.00
▷ Maximum method complexity98.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes40
▷ Abstract classes00.00%
▷ Concrete classes40100.00%
▷ Final classes00.00%
Methods453
▷ Static methods15935.10%
▷ Public methods45199.56%
▷ Protected methods00.00%
▷ Private methods20.44%
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

Often times overlooked, PNG files can occupy unnecessary space in your plugin
76 PNG files occupy 0.38MB with 0.12MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
images/templates/preview/css-11.png1.34KB0.99KB▼ 26.07%
images/img-placeholder.png7.59KB2.93KB▼ 61.41%
images/templates/preview/css-10.png1.48KB1.03KB▼ 30.59%
images/templates/preview/css-23.png1.89KB1.48KB▼ 22.07%
images/templates/preview/css-21.png1.92KB1.47KB▼ 23.63%