77% product-icon-badge

Code Review | NS Product icon badge

WordPress plugin NS Product icon badge scored77%from 54 tests.

About plugin

  • Plugin page: product-icon-badge
  • Plugin version: 1.2.4
  • PHP compatiblity: 7.1.22+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.9.8-5.9
  • WordPress version: 6.3.1
  • First release: Dec 17, 2018
  • Latest release: Feb 7, 2022
  • Number of updates: 34
  • Update frequency: every 33.9 days
  • Top authors: nsthemes (100%)

Code review

54 tests

User reviews

1 review

Install metrics

20+ active /2,612 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
Installer ran successfully

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

A check of server-side resources used by NS Product icon badge
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /3.49 ▲0.0338.02 ▼1.89
Dashboard /wp-admin3.33 ▲0.0346.41 ▼3.81
Posts /wp-admin/edit.php3.45 ▲0.0943.80 ▼2.95
Add New Post /wp-admin/post-new.php5.94 ▲0.0585.55 ▼1.37
Media Library /wp-admin/upload.php3.26 ▲0.0341.44 ▲6.23
/wp-admin/admin.php?page=plugineye2743.2333.49

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

A short overview of filesystem and database impact
No storage issues were detected
Filesystem: 40 new files
Database: no new tables, 6 new options
New WordPress options
can_compress_scripts
widget_recent-posts
db_upgraded
widget_theysaidso_widget
theysaidso_admin_options
widget_recent-comments

Browser metrics Passed 4 tests

NS Product icon badge: an overview of browser usage
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,865 ▲11913.44 ▼0.952.04 ▲0.0247.82 ▲8.77
Dashboard /wp-admin2,232 ▲445.19 ▲0.12105.18 ▼11.4464.27 ▲14.39
Posts /wp-admin/edit.php2,132 ▲432.34 ▲0.3036.67 ▼0.1335.65 ▼1.71
Add New Post /wp-admin/post-new.php1,705 ▲17723.01 ▼0.03792.31 ▲124.8737.51 ▼19.27
Media Library /wp-admin/upload.php1,417 ▲264.46 ▲0.25102.72 ▲4.4782.87 ▲35.15
/wp-admin/admin.php?page=plugineye2749192.0728.7325.92

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
Please fix the following items
  • Zombie WordPress options detected upon uninstall: 6 options
    • widget_recent-posts
    • theysaidso_admin_options
    • widget_recent-comments
    • can_compress_scripts
    • db_upgraded
    • widget_theysaidso_widget

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
Good news, no errors were detected

SRP 50% from 2 tests

🔹 Tests weight: 20 | The single-responsibility principle: PHP files have to remain inert when accessed directly, throwing no errors and performing no actions
Please take a closer look at the following
  • 9× PHP files trigger server-side errors or warnings when accessed directly:
    • > PHP Warning
      include_once(): Failed opening 'ABSPATHwp-admin/includes/plugin.php' for inclusion (include_path='.:/usr/share/php') in wp-content/plugins/product-icon-badge/ns-iba-icon-badge-archive.php on line 15
    • > PHP Warning
      include_once(ABSPATHwp-admin/includes/plugin.php): failed to open stream: No such file or directory in wp-content/plugins/product-icon-badge/ns-iba-icon-badge-archive.php on line 15
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/product-icon-badge/plugineye/plugineye-ajax/plugineye_on_deactivation_function.php:2
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_dir_url() in wp-content/plugins/product-icon-badge/ns-iba-icon-badge-archive.php:33
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/product-icon-badge/ns_IBA_mainOptions/ns_addNewOptionsPage.php:8
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/product-icon-badge/ns_IBA_mainOptions/ns_changeBadgeStyle.php:172
    • > PHP Fatal error
      Uncaught Error: Call to undefined function __() in wp-content/plugins/product-icon-badge/ns_IBA_mainOptions/inc.php:5
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_filter() in wp-content/plugins/product-icon-badge/ns_IBA_mainOptions/ns_addNewBadgeTab.php:18
    • > PHP Warning
      Use of undefined constant ABSPATH - assumed 'ABSPATH' (this will throw an Error in a future version of PHP) in wp-content/plugins/product-icon-badge/ns-iba-icon-badge-archive.php on line 15

User-side errors 0% from 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the browser (console and network errors and warnings)
Please take a look at the following user-side issues
    • > GET request to /wp-admin/admin.php?page=plugineye274
    • > Console-api (warning) in unknown
    /wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils&ver=6.3.1 1:28609 "jQuery.Deferred exception: Cannot read properties of undefined (reading 'model')" "TypeError: Cannot read properties of undefined (reading 'model')\n at HTMLDocument.\u003Canonymous> (/wp-content/plugins/product-icon-badge/ASSETS/JS/ns_IBA_addNewMedia.js?ver=6.3.1:4:34)\n at e (/wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils&ver=6.3.1:2:26990)\n at t (/wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils&ver=6.3.1:2:27292)" undefined
    • > GET request to /wp-admin/admin.php?page=plugineye274
    • > Javascript (severe) in unknown
    /wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils&ver=6.3.1 1:28721 Uncaught TypeError: Cannot read properties of undefined (reading 'model')

Optimizations

Plugin configuration 90% from 29 tests

readme.txt 94% from 16 tests

Don't ignore readme.txt as it is the file that instructs WordPress.org on how to present your plugin to the world
These attributes need your attention:
  • Screenshots: These screenshots require images: #1 (View image badge in the shop page), #2 (View image badge in the single product page), #3 (View standard badge(triangle) in the shop page), #4 (View standard badge(triangle) in the shop page), #5 (View image badge), #6 (Setting image badge)
The official readme.txt is a good inspiration

product-icon-badge/ns-iba-icon-badge-archive.php 85% from 13 tests

The main PHP file in "NS Product icon badge" ver. 1.2.4 adds more information about the plugin and also serves as the entry point for this plugin
Please take the time to fix the following:
  • Text Domain: The text domain must be the same as the plugin slug, although optional since WordPress version 4.6
  • Main file name: Please rename the main PHP file in this plugin to the plugin slug ("product-icon-badge.php" instead of "ns-iba-icon-badge-archive.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
Everything looks great! No dangerous files found in this plugin2,065 lines of code in 20 files:
LanguageFilesBlank linesComment linesLines of code
PHP122632571,256
CSS395161563
PO File1105159165
JavaScript4121481

PHP code Passed 2 tests

An overview of cyclomatic complexity and code structure
There are no cyclomatic complexity problems detected for this plugin
Cyclomatic complexity
Average complexity per logical line of code0.28
Average class complexity20.00
▷ Minimum class complexity20.00
▷ Maximum class complexity20.00
Average method complexity2.23
▷ Minimum method complexity1.00
▷ Maximum method complexity6.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes1
▷ Abstract classes00.00%
▷ Concrete classes1100.00%
▷ Final classes00.00%
Methods19
▷ Static methods00.00%
▷ Public methods526.32%
▷ Protected methods00.00%
▷ Private methods1473.68%
Functions30
▷ Named functions2376.67%
▷ Anonymous functions723.33%
Constants0
▷ Global constants00.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

Using a strong compression for your PNG files is a great way to speed-up your plugin
14 PNG files occupy 1.07MB with 0.58MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
screenshot-2.png142.93KB85.68KB▼ 40.06%
screenshot-1.png173.10KB99.43KB▼ 42.56%
screenshot-4.png146.10KB71.54KB▼ 51.04%
ns_IBA_mainOptions/img/ns_loop_sale.png41.69KB17.96KB▼ 56.93%
ns_IBA_mainOptions/img/options-position.png24.10KB4.55KB▼ 81.10%