10% next-wc-product-labels-badges

Code Review | Next Product Labels & Badges for WooCommerce

WordPress plugin Next Product Labels & Badges for WooCommerce scored 10% from 54 tests.

About plugin

  • Plugin page: next-wc-product-l...
  • Plugin version: 1.4.3
  • PHP version: 7.4.16
  • WordPress compatibility: 5.3-6.3
  • WordPress version: 6.3.1
  • First release: Aug 24, 2022
  • Latest release: Aug 9, 2023
  • Number of updates: 56
  • Update frequency: every 6.3 days
  • Top authors: nxtweb (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active / 244 total downloads

Benchmarks

Plugin footprint 40% from 16 tests

Installer 0% from 1 test

🔺 Critical test (weight: 50) | All plugins must install correctly, without throwing any errors, warnings, or notices
You still need to fix the following installer errors
  • Install procedure had errors
    • > Warning in wp-content/plugins/next-wc-product-labels-badges/includes/wcplb-functions.php+993
    count(): Parameter must be an array or an object that implements Countable

Server metrics [RAM: ▼0.84MB] [CPU: ▼31.58ms] Passed 4 tests

A check of server-side resources used by Next Product Labels & Badges for WooCommerce
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /3.40 ▼0.0627.29 ▼16.31
Dashboard /wp-admin3.11 ▼0.2026.73 ▼28.80
Posts /wp-admin/edit.php3.11 ▼0.2526.38 ▼20.79
Add New Post /wp-admin/post-new.php3.11 ▼2.7829.67 ▼60.41
Media Library /wp-admin/upload.php3.11 ▼0.1227.13 ▼5.68
Set labels /wp-admin/admin.php?page=wcplb-acp&tab=wcplb_set_label3.1128.71
Set badges /wp-admin/admin.php?page=wcplb-acp&tab=wcplb_set_badge3.1127.28
Next Labels /wp-admin/admin.php?page=wcplb-acp3.1129.72
General Settings /wp-admin/admin.php?page=wcplb-acp&tab=wcplb_settings3.1125.30

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

Filesystem and database footprint
No storage issues were detected
Filesystem: 71 new files
Database: no new tables, 8 new options
New WordPress options
widget_recent-posts
wcplbCurrentVersion
wcplbCurrentType
can_compress_scripts
theysaidso_admin_options
db_upgraded
widget_theysaidso_widget
widget_recent-comments

Browser metrics Passed 4 tests

A check of browser resources used by Next Product Labels & Badges for WooCommerce
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,842 ▲10713.22 ▼1.151.77 ▼0.2143.04 ▼10.03
Dashboard /wp-admin2,233 ▲455.80 ▼0.08110.45 ▼5.2254.76 ▲10.96
Posts /wp-admin/edit.php2,128 ▲361.98 ▼0.0133.69 ▼2.1831.64 ▼2.42
Add New Post /wp-admin/post-new.php1,549 ▲1323.23 ▼0.27765.64 ▲85.3763.06 ▲4.81
Media Library /wp-admin/upload.php1,418 ▲304.14 ▼0.06112.58 ▲10.0944.62 ▼0.44
Set labels /wp-admin/admin.php?page=wcplb-acp&tab=wcplb_set_label1,2831.8528.5560.60
Set badges /wp-admin/admin.php?page=wcplb-acp&tab=wcplb_set_badge1,3491.8525.7838.00
Next Labels /wp-admin/admin.php?page=wcplb-acp9441.8426.3432.44
General Settings /wp-admin/admin.php?page=wcplb-acp&tab=wcplb_settings9471.8425.6135.43

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
The following items require your attention
  • Uninstall procedure had uncaught errors
    • > Warning in wp-content/plugins/next-wc-product-labels-badges/includes/wcplb-functions.php+255
    count(): Parameter must be an array or an object that implements Countable
  • This plugin does not fully uninstall, leaving 8 options in the database
    • widget_recent-comments
    • widget_theysaidso_widget
    • theysaidso_admin_options
    • wcplbCurrentType
    • widget_recent-posts
    • wcplbCurrentVersion
    • db_upgraded
    • can_compress_scripts

Smoke tests 25% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | This is a shallow check for server-side errors
Please fix the following server-side errors
  • 8 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=wcplb-acp&tab=wcplb_settings
    • > Warning in wp-content/plugins/next-wc-product-labels-badges/includes/wcplb-acp-page.php+246
    count(): Parameter must be an array or an object that implements Countable
  • 16 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=wcplb-acp&tab=wcplb_settings
    • > Notice in wp-content/plugins/next-wc-product-labels-badges/includes/wcplb-acp-page.php+250
    Trying to get property 'slug' of non-object
  • 8 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=wcplb-acp&tab=wcplb_settings
    • > Notice in wp-content/plugins/next-wc-product-labels-badges/includes/wcplb-acp-page.php+251
    Trying to get property 'name' of non-object
  • 4 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=wcplb-acp&tab=wcplb_settings
    • > Notice in wp-content/plugins/next-wc-product-labels-badges/includes/wcplb-acp-page.php+303
    Undefined index: section
  • 13 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=wcplb-acp&tab=wcplb_set_badge
    • > Notice in wp-content/plugins/next-wc-product-labels-badges/includes/wcplb-show-image-badge.inc.php+75
    Undefined variable: image
  • 13 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=wcplb-acp&tab=wcplb_set_badge
    • > Warning in wp-content/plugins/next-wc-product-labels-badges/includes/wcplb-show-image-badge.inc.php+75
    imagecolorallocate() expects parameter 1 to be resource, null given
    • > GET request to /wp-admin/admin.php?page=wcplb-acp&tab=wcplb_set_badge
    • > Warning in wp-content/plugins/next-wc-product-labels-badges/includes/wcplb-draw-image.php+284
    imagettfbbox(): Could not read font
  • 4 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=wcplb-acp&tab=wcplb_set_badge
    • > Notice in wp-content/plugins/next-wc-product-labels-badges/includes/wcplb-draw-image.php+285
    Trying to access array offset on value of type bool
    • > GET request to /wp-admin/admin.php?page=wcplb-acp&tab=wcplb_set_badge
    • > Warning in wp-content/plugins/next-wc-product-labels-badges/includes/wcplb-draw-image.php+290
    imagettftext(): Could not read font
    • > GET request to /wp-admin/admin.php?page=wcplb-acp
    • > Notice in wp-content/plugins/next-wc-product-labels-badges/includes/wcplb-acp-page.php+301
    Undefined index: tab

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 take a closer look at the following
  • 1× PHP files perform the task of outputting text when accessed with GET requests:
    • > /wp-content/plugins/next-wc-product-labels-badges/includes/wcplb-show-image-badge.inc.php
  • 54× PHP files trigger server errors when accessed directly (only 10 are shown):
    • > PHP Notice
      Undefined variable: image in wp-content/plugins/next-wc-product-labels-badges/includes/wcplb-show-image-badge.inc.php on line 64
    • > PHP Notice
      Undefined variable: opt_BadgeType in wp-content/plugins/next-wc-product-labels-badges/includes/wcplb-show-image-badge.inc.php on line 116
    • > PHP Notice
      Undefined variable: opt_BadgeName_ in wp-content/plugins/next-wc-product-labels-badges/includes/wcplb-show-image-badge.inc.php on line 120
    • > PHP Warning
      imagecolorallocate() expects parameter 1 to be resource, null given in wp-content/plugins/next-wc-product-labels-badges/includes/wcplb-show-image-badge.inc.php on line 65
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_dir_path() in wp-content/plugins/next-wc-product-labels-badges/next-wc-product-labels-badges.php:17
    • > PHP Warning
      imagecolorallocate() expects parameter 1 to be resource, null given in wp-content/plugins/next-wc-product-labels-badges/includes/wcplb-show-image-badge.inc.php on line 64
    • > PHP Warning
      imagecolorallocate() expects parameter 1 to be resource, null given in wp-content/plugins/next-wc-product-labels-badges/includes/wcplb-show-image-badge.inc.php on line 68
    • > PHP Notice
      Undefined variable: opt_BadgeType in wp-content/plugins/next-wc-product-labels-badges/includes/wcplb-show-image-badge.inc.php on line 182
    • > PHP Warning
      imagecolorallocate() expects parameter 1 to be resource, null given in wp-content/plugins/next-wc-product-labels-badges/includes/wcplb-show-image-badge.inc.php on line 72
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_html_e() in wp-content/plugins/next-wc-product-labels-badges/includes/wcplb-align-shop.inc.php:2

User-side errors Passed 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
No browser errors were detected

Optimizations

Plugin configuration 90% from 29 tests

readme.txt 88% from 16 tests

Often overlooked, readme.txt is one of the most important files in your plugin
Please fix the following attributes:
  • Requires php: Version not formatted correctly
  • Tags: Please reduce the number of tags, currently 17 tag instead of maximum 10
Please take inspiration from this readme.txt

next-wc-product-labels-badges/next-wc-product-labels-badges.php 92% from 13 tests

The primary PHP file in "Next Product Labels & Badges for WooCommerce" version 1.4.3 is used by WordPress to initiate all plugin functionality
It is important to fix the following:
  • Description: If Twitter did it, so should we! Keep the description under 140 characters (currently 153 characters long)

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is an overview of file extensions present in this plugin and a short test that no dangerous files are bundled with this plugin
There were no executable files found in this plugin4,046 lines of code in 25 files:
LanguageFilesBlank linesComment linesLines of code
PHP21502153,602
PO File1197296238
CSS3205206

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 problems
Cyclomatic complexity
Average complexity per logical line of code0.22
Average class complexity0.00
▷ Minimum class complexity0.00
▷ Maximum class complexity0.00
Average method complexity0.00
▷ Minimum method complexity0.00
▷ Maximum method complexity0.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes0
▷ Abstract classes00.00%
▷ Concrete classes00.00%
▷ Final classes00.00%
Methods0
▷ Static methods00.00%
▷ Public methods00.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions54
▷ Named functions54100.00%
▷ Anonymous functions00.00%
Constants6
▷ Global constants6100.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
30 PNG files occupy 0.05MB with 0.02MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
images/icon.png10.41KB0.98KB▼ 90.58%
images/badgeShop_Victory.png2.08KB0.99KB▼ 52.51%
images/labelShop_Label.png1.77KB0.85KB▼ 51.76%
images/labels-show.png0.71KB0.87KB0.00%
images/labelShop_Circle.png1.17KB0.53KB▼ 54.81%