68% product-badge-manager-for-woocommerce

Code Review | Product Badge Manager For Woocommerce

WordPress plugin Product Badge Manager For Woocommerce scored68%from 54 tests.

About plugin

  • Plugin page: product-badge-man...
  • Plugin version: 1.2.2
  • PHP compatiblity: 5.4+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.0-6.4
  • WordPress version: 6.3.1
  • First release: Feb 3, 2021
  • Latest release: Nov 11, 2023
  • Number of updates: 45
  • Update frequency: every 22.5 days
  • Top authors: boomdevs (100%)

Code review

54 tests

User reviews

2 reviews

Install metrics

100+ active /5,972 total downloads

Benchmarks

Plugin footprint 65% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | It is important to correctly install your plugin, without throwing errors or notices
Install script ran successfully

Server metrics [RAM: ▼1.96MB] [CPU: ▼50.63ms] Passed 4 tests

An overview of server-side resources used by Product Badge Manager For Woocommerce
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /2.03 ▼1.446.65 ▼31.17
Dashboard /wp-admin2.05 ▼1.266.87 ▼43.16
Posts /wp-admin/edit.php2.05 ▼1.316.42 ▼39.54
Add New Post /wp-admin/post-new.php2.05 ▼3.847.42 ▼88.64
Media Library /wp-admin/upload.php2.05 ▼1.185.97 ▼30.63

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

Analyzing filesystem and database footprints of this plugin
The plugin installed successfully
Filesystem: 457 new files
Database: no new tables, 6 new options
New WordPress options
widget_theysaidso_widget
db_upgraded
widget_recent-posts
theysaidso_admin_options
widget_recent-comments
can_compress_scripts

Browser metrics Passed 4 tests

This is an overview of browser requirements for Product Badge Manager For Woocommerce
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,826 ▲6414.20 ▼0.201.76 ▲0.1839.69 ▼0.64
Dashboard /wp-admin2,209 ▲355.61 ▲0.0489.72 ▼8.0541.33 ▼2.60
Posts /wp-admin/edit.php2,111 ▲111.95 ▼0.1339.28 ▼0.2037.24 ▲2.67
Add New Post /wp-admin/post-new.php1,537 ▲1123.31 ▲0.10618.17 ▼90.9058.77 ▼0.19
Media Library /wp-admin/upload.php1,411 ▲114.20 ▲0.0097.36 ▼17.9844.20 ▼3.33

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
The following items require your attention
  • This plugin did not uninstall without warnings or errors
    • > Warning in wp-includes/class-wp-hook.php+310
    call_user_func_array() expects parameter 1 to be a valid callback, function 'run_wpbm' not found or invalid function name
  • The uninstall procedure has failed, leaving 6 options in the database
    • widget_theysaidso_widget
    • widget_recent-comments
    • can_compress_scripts
    • db_upgraded
    • widget_recent-posts
    • theysaidso_admin_options

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a short smoke test looking for server-side errors
Even though everything seems fine, this is not an exhaustive test

SRP 0% 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 take a closer look at the following
  • 7× PHP files output non-empty strings when accessed directly via GET requests:
    • > /wp-content/plugins/product-badge-manager-for-woocommerce/libs/meta-box/inc/templates/video.php
    • > /wp-content/plugins/product-badge-manager-for-woocommerce/admin/partials/wpbm-admin-display.php
    • > /wp-content/plugins/product-badge-manager-for-woocommerce/libs/meta-box/inc/templates/image-advanced.php
    • > /wp-content/plugins/product-badge-manager-for-woocommerce/libs/meta-box/inc/templates/audio.php
    • > /wp-content/plugins/product-badge-manager-for-woocommerce/libs/meta-box/inc/templates/upload.php
    • > /wp-content/plugins/product-badge-manager-for-woocommerce/libs/meta-box/inc/templates/media.php
    • > /wp-content/plugins/product-badge-manager-for-woocommerce/public/partials/wpbm-public-display.php
  • 66× GET requests to PHP files have triggered server-side errors or warnings (only 10 are shown):
    • > PHP Warning
      Use of undefined constant WPBM_DIR - assumed 'WPBM_DIR' (this will throw an Error in a future version of PHP) in wp-content/plugins/product-badge-manager-for-woocommerce/models/class-wpbm-badge.php on line 2
    • > PHP Fatal error
      Uncaught Error: Class 'RWMB_Walker_Base' not found in wp-content/plugins/product-badge-manager-for-woocommerce/libs/meta-box/inc/walkers/select.php:11
    • > PHP Fatal error
      Uncaught Error: Class 'RWMB_Multiple_Values_Field' not found in wp-content/plugins/product-badge-manager-for-woocommerce/libs/meta-box/inc/fields/text-list.php:11
    • > PHP Fatal error
      Uncaught Error: Class 'RWMB_Field' not found in wp-content/plugins/product-badge-manager-for-woocommerce/libs/meta-box/inc/fields/image-select.php:11
    • > PHP Fatal error
      require_once(): Failed opening required 'WPBM_DIRincludes/class-wpbm-custom-post.php' (include_path='.:/usr/share/php') in wp-content/plugins/product-badge-manager-for-woocommerce/models/class-wpbm-badge.php on line 2
    • > PHP Fatal error
      Uncaught Error: Class 'RWMB_Media_Field' not found in wp-content/plugins/product-badge-manager-for-woocommerce/libs/meta-box/inc/fields/file-upload.php:11
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_html_e() in wp-content/plugins/product-badge-manager-for-woocommerce/libs/meta-box/inc/about/sections/upgrade.php:10
    • > PHP Fatal error
      Uncaught Error: Interface 'RWMB_Storage_Interface' not found in wp-content/plugins/product-badge-manager-for-woocommerce/libs/meta-box/inc/storages/base.php:11
    • > PHP Fatal error
      Uncaught Error: Class 'RWMB_Number_Field' not found in wp-content/plugins/product-badge-manager-for-woocommerce/libs/meta-box/inc/fields/range.php:11
    • > PHP Fatal error
      Uncaught Error: Class 'RWMB_Field' not found in wp-content/plugins/product-badge-manager-for-woocommerce/libs/meta-box/inc/fields/button.php:11

User-side errors Passed 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
Everything seems fine, but this is not an exhaustive test

Optimizations

Plugin configuration 90% from 29 tests

readme.txt 94% from 16 tests

Perhaps the most important file in your plugin readme.txt gets parsed in order to generate the public listing of your plugin
Attributes that require attention: You can look at the official readme.txt

product-badge-manager-for-woocommerce/product-badge-manager-for-woocommerce.php 85% from 13 tests

The primary PHP file in "Product Badge Manager For Woocommerce" version 1.2.2 is used by WordPress to initiate all plugin functionality
You should first fix the following items:
  • Text Domain: Since WordPress version 4.6 the text domain is optional; if specified, it must be the same as the plugin slug
  • Description: If Twitter did it, so should we! Keep the description under 140 characters (currently 230 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
Success! There were no dangerous files found in this plugin52,866 lines of code in 407 files:
LanguageFilesBlank linesComment linesLines of code
PHP2125,2837,09724,040
JavaScript1051,8561,0258,906
CSS465436457,435
PO File203,1983,5916,500
Sass1697035,674
Markdown1700196
JSON30088
SVG40027

PHP code Passed 2 tests

A short review of cyclomatic complexity and code structure
Great job! No cyclomatic complexity issues were detected in this plugin
Cyclomatic complexity
Average complexity per logical line of code0.47
Average class complexity15.86
▷ Minimum class complexity1.00
▷ Maximum class complexity151.00
Average method complexity3.84
▷ Minimum method complexity1.00
▷ Maximum method complexity57.00
Code structure
Namespaces3
Interfaces1
Traits0
Classes161
▷ Abstract classes84.97%
▷ Concrete classes15395.03%
▷ Final classes00.00%
Methods853
▷ Static methods34940.91%
▷ Public methods75788.75%
▷ Protected methods374.34%
▷ Private methods596.92%
Functions45
▷ Named functions4191.11%
▷ Anonymous functions48.89%
Constants11
▷ Global constants11100.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
16 compressed PNG files occupy 0.04MB
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
libs/meta-box/img/jqueryui/ui-icons_cd0a0a_256x240.png4.27KB4.11KB▼ 3.78%
libs/meta-box/img/jqueryui/ui-bg_glass_75_dadada_1x400.png0.11KB0.16KB0.00%
libs/meta-box/img/jqueryui/ui-icons_222222_256x240.png4.27KB4.11KB▼ 3.78%
admin/images/badge-menu-icon.png2.00KB1.92KB▼ 4.19%
libs/meta-box/img/jqueryui/ui-bg_glass_95_fef1ec_1x400.png0.12KB0.14KB0.00%