78% ns-free-price-and-donation-for-woocommerce

Code Review | NS Free Price and Donation for WooCommerce

WordPress plugin NS Free Price and Donation for WooCommerce scored78%from 54 tests.

About plugin

  • Plugin page: ns-free-price-and...
  • Plugin version: 2.4.4
  • PHP version: 7.4.16
  • WordPress compatibility: 4.3-5.9
  • WordPress version: 6.3.1
  • First release: Sep 14, 2016
  • Latest release: Feb 9, 2022
  • Number of updates: 50
  • Update frequency: every 39.5 days
  • Top authors: nsthemes (100%)

Code review

54 tests

User reviews

3 reviews

Install metrics

10+ active /2,484 total downloads

Benchmarks

Plugin footprint 83% 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.10MB] [CPU: ▼4.53ms] Passed 4 tests

An overview of server-side resources used by NS Free Price and Donation for WooCommerce
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /3.56 ▲0.1041.21 ▼3.29
Dashboard /wp-admin3.40 ▲0.1050.67 ▼4.11
Posts /wp-admin/edit.php3.52 ▲0.1650.64 ▼1.02
Add New Post /wp-admin/post-new.php6.01 ▲0.1294.51 ▼9.70
Media Library /wp-admin/upload.php3.33 ▲0.1041.70 ▲3.16
Donation /wp-admin/admin.php?page=ns-free-price-and-donation-for-woocommerce/ns-admin-options/ns_admin_option_dashboard.php3.3030.29
/wp-admin/admin.php?page=plugineye2063.2936.93
How to install premium version /wp-admin/admin.php?page=how-to-install-premium-version3.2731.91

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

How much does this plugin use your filesystem and database?
This plugin installed successfully
Filesystem: 34 new files
Database: no new tables, 8 new options
New WordPress options
can_compress_scripts
ns_gp_enabled_plugin
widget_recent-comments
widget_theysaidso_widget
widget_recent-posts
theysaidso_admin_options
db_upgraded
recovery_mode_email_last_sent

Browser metrics Passed 4 tests

A check of browser resources used by NS Free Price and Donation for WooCommerce
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,823 ▲3714.35 ▲0.201.88 ▼0.3945.92 ▲2.41
Dashboard /wp-admin2,227 ▲505.69 ▲0.0485.52 ▼3.3078.47 ▲40.35
Posts /wp-admin/edit.php2,135 ▲351.99 ▼0.0338.66 ▼2.1934.31 ▼9.15
Add New Post /wp-admin/post-new.php1,557 ▲2223.00 ▲4.90725.30 ▲59.5856.67 ▼12.64
Media Library /wp-admin/upload.php1,435 ▲354.23 ▲0.0396.88 ▼19.8575.03 ▲27.26
Donation /wp-admin/admin.php?page=ns-free-price-and-donation-for-woocommerce/ns-admin-options/ns_admin_option_dashboard.php8061.137.1627.31
/wp-admin/admin.php?page=plugineye2069201.6525.9222.66
How to install premium version /wp-admin/admin.php?page=how-to-install-premium-version6931.526.9819.07

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

🔸 Tests weight: 35 | All plugins must uninstall correctly, removing their source code and extra database tables they might have created
The following items require your attention
  • This plugin does not fully uninstall, leaving 8 options in the database
    • widget_theysaidso_widget
    • db_upgraded
    • widget_recent-comments
    • ns_gp_enabled_plugin
    • recovery_mode_email_last_sent
    • can_compress_scripts
    • theysaidso_admin_options
    • widget_recent-posts

Smoke tests 50% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | This is a shallow check for server-side errors
These server-side errors were triggered
    • > GET request to /wp-admin/admin.php?page=ns-free-price-and-donation-for-woocommerce/ns-admin-options/ns_admin_option_dashboard.php
    • > Error in wp-content/plugins/ns-free-price-and-donation-for-woocommerce/ns-admin-options/ns_settings_custom.php+5
    Uncaught Error: Call to undefined function get_woocommerce_currency_symbol() in wp-content/plugins/ns-free-price-and-donation-for-woocommerce/ns-admin-options/ns_settings_custom.php:5
    Stack trace:
    #0 wp-content/plugins/ns-free-price-and-donation-for-woocommerce/ns-admin-options/ns_admin_option_dashboard.php(41): require_once()
    #1 wp-admin/admin.php(293): include('/var/www/wordpr...')
    #2 {main}
    thrown
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=how-to-install-premium-version
    • > Warning in wp-includes/pluggable.php+1438
    Cannot modify header information - headers already sent by (output started at wp-includes/script-loader.php:2838)

SRP 50% 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
Almost there! Just fix the following items
  • 2× GET requests to PHP files trigger server-side errors or Error 500 responses:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/ns-free-price-and-donation-for-woocommerce/ns-free-price-and-donation-for-woocommerce-add-tab.php:6
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/ns-free-price-and-donation-for-woocommerce/plugineye/plugineye-ajax/plugineye_on_deactivation_function.php:2

User-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
There were no browser issues found

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 88% from 16 tests

The readme.txt file describes your plugin functionality and requirements and it is parsed to prepare the your plugin's listing
Please fix the following attributes:
  • Screenshots: These screenshots require images: #1 (Exemple on single product donation.), #2 (Total donatin in plugin settings.)
  • Tags: Please delete some tags, you are using 12 tag instead of maximum 10
Please take inspiration from this readme.txt

ns-free-price-and-donation-for-woocommerce/ns-free-price-and-donation-for-woocommerce.php Passed 13 tests

"NS Free Price and Donation for WooCommerce" version 2.4.4's main PHP file describes plugin functionality and also serves as the entry point to any WordPress functionality
40 characters long description:
Insert free price to one or many product

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | An overview of files in this plugin; executable files are not allowed
Success! There were no dangerous files found in this plugin1,120 lines of code in 21 files:
LanguageFilesBlank linesComment linesLines of code
PHP14100193704
CSS5288359
JavaScript216057

PHP code Passed 2 tests

This is a very shot review of cyclomatic complexity and code structure
This plugin has no cyclomatic complexity problems
Cyclomatic complexity
Average complexity per logical line of code0.23
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%
Functions26
▷ Named functions1661.54%
▷ Anonymous functions1038.46%
Constants2
▷ Global constants2100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

It is recommended to compress PNG files in your plugin to minimize bandwidth usage
9 PNG files occupy 0.09MB with 0.03MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
screenshot-2.png12.00KB5.92KB▼ 50.68%
ns-admin-options/img/placeholder.png2.75KB2.92KB0.00%
ns-admin-options/img/ns_banner_membership-500.png24.95KB26.27KB0.00%
img/backend-sidebar-icon.png1.48KB0.54KB▼ 63.47%
ns-admin-options/img/ns-theme-promo.png29.37KB8.96KB▼ 69.50%