58% kvoucher

Code Review | KVoucher

WordPress plugin KVoucher scored 58% from 54 tests.

About plugin

  • Plugin page: kvoucher
  • Plugin version: 1.1.1
  • PHP compatiblity: 5.6+
  • PHP version: 7.4.16
  • WordPress compatibility: 5.2-5.8
  • WordPress version: 5.8.1
  • First release: Jul 15, 2021
  • Latest release: Aug 6, 2021
  • Number of updates: 29
  • Update frequency: every 0.8 days
  • Top authors: lostboy7 (100%)

Code review

54 tests

User reviews

2 reviews

Install metrics

10+ active / 200 total downloads

Benchmarks

Plugin footprint 47% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | All plugins must install correctly, without throwing any errors, warnings, or notices
Install script ran successfully

Server metrics [RAM: ▲5.14MB] [CPU: ▼106.58ms] 75% from 4 tests

A check of server-side resources used by KVoucher
It is recommended to improve the following
  • Extra RAM: Try to keep extra memory usage under 5MB (currently 5.14MB on /wp-admin/admin.php?page=freemius)
PageMemory (MB)CPU Time (ms)
Home /8.58 ▲5.8650.03 ▲32.76
Dashboard /wp-admin8.60 ▲5.5575.06 ▲30.41
Posts /wp-admin/edit.php8.60 ▲5.5073.45 ▲30.33
Add New Post /wp-admin/post-new.php9.34 ▲3.91115.98 ▼513.22
Media Library /wp-admin/upload.php8.60 ▲5.6057.40 ▲26.18
Freemius Debug [v.2.4.2] /wp-admin/admin.php?page=freemius8.6055.04

Server storage [IO: ▲3.10MB] [DB: ▲0.01MB] Passed 3 tests

Analyzing filesystem and database footprints of this plugin
The plugin installed successfully
Filesystem: 189 new files
Database: 1 new table, 9 new options
New tables
wp_usr_kvoucher
New WordPress options
fs_accounts
fs_debug_mode
kvoucher_plugin_paypal_textfiels
kvoucher_coupon_id
kvoucher_plugin_style_textfiels
fs_active_plugins
fs_gdpr
kvoucher_plugin_company_textfiels
kvoucher_plugin_terms_of_service_textfields

Browser metrics Passed 4 tests

KVoucher: an overview of browser usage
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /4,332 ▲73619.02 ▲3.5024.85 ▲16.4145.35 ▼1.38
Dashboard /wp-admin3,204 ▲3147.51 ▲1.67149.07 ▲7.88129.80 ▲24.96
Posts /wp-admin/edit.php3,031 ▲2924.41 ▲1.7177.21 ▲11.97110.81 ▲15.50
Add New Post /wp-admin/post-new.php1,706 ▲3418.42 ▼0.50336.19 ▼35.75129.16 ▲17.70
Media Library /wp-admin/upload.php1,804 ▼64.75 ▼0.25119.25 ▼29.07144.24 ▲29.79
Freemius Debug [v.2.4.2] /wp-admin/admin.php?page=freemius1,7333.3672.8298.46

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

🔸 Tests weight: 35 | The uninstall procedure must remove all plugin files and extra database tables
Please fix the following items
  • The plugin did not uninstall gracefully
    • > Notice in wp-content/plugins/kvoucher/freemius/includes/class-freemius.php+8552
    Undefined property: stdClass::$plugins
  • The uninstall procedure failed, leaving 1 table in the database
    • wp_usr_kvoucher
  • This plugin did not uninstall successfully, leaving 9 options in the database
    • kvoucher_plugin_style_textfiels
    • kvoucher_plugin_terms_of_service_textfields
    • fs_accounts
    • fs_active_plugins
    • kvoucher_plugin_company_textfiels
    • fs_debug_mode
    • kvoucher_coupon_id
    • fs_gdpr
    • kvoucher_plugin_paypal_textfiels

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 | The single-responsibility principle: PHP files have to remain inert when accessed directly, throwing no errors and performing no actions
Almost there! Just fix the following items
  • 1× PHP files output text when accessed directly:
    • > /wp-content/plugins/kvoucher/freemius/templates/ajax-loader.php
  • 13× PHP files trigger server-side errors or warnings when accessed directly (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/kvoucher/php/ScTermsOfServiceSettings.php:18
    • > PHP Notice
      Undefined variable: VARS in wp-content/plugins/kvoucher/freemius/templates/account/partials/addon.php on line 8
    • > PHP Fatal error
      Uncaught Error: Call to undefined function freemius() in wp-content/plugins/kvoucher/freemius/templates/partials/network-activation.php:6
    • > PHP Notice
      Undefined variable: VARS in wp-content/plugins/kvoucher/freemius/templates/account/partials/addon.php on line 6
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/kvoucher/php/ScCompanySettings.php:48
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/kvoucher/php/ScPayPalSettings.php:20
    • > PHP Notice
      Trying to access array offset on value of type null in wp-content/plugins/kvoucher/freemius/templates/account/partials/addon.php on line 6
    • > PHP Notice
      Trying to access array offset on value of type null in wp-content/plugins/kvoucher/freemius/templates/account/partials/addon.php on line 8
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/kvoucher/php/ScStyleSettings.php:50
    • > PHP Notice
      Undefined variable: VARS in wp-content/plugins/kvoucher/freemius/templates/account/partials/addon.php on line 7

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
No browser errors were detected

Optimizations

Plugin configuration 96% from 29 tests

readme.txt Passed 16 tests

Perhaps the most important file in your plugin readme.txt gets parsed in order to generate the public listing of your plugin
6 plugin tags: pdf voucher, coupon, pdf, pdf coupon, voucher...

kvoucher/kvoucher.php 92% from 13 tests

The entry point to "KVoucher" version 1.1.1 is a PHP file that has certain tags in its header comment area
The following require your attention:
  • Text Domain: You no longer need to specify the text domain since WordPress 4.6; it must be the same as the plugin slug

Code Analysis 97% from 3 tests

File types Passed 1 test

🔸 Test weight: 35 | An overview of files in this plugin; executable files are not allowed
No dangerous file extensions were detected32,712 lines of code in 140 files:
LanguageFilesBlank linesComment linesLines of code
PHP1177,63416,17531,697
PO File2234317496
JavaScript58975309
CSS132523141
SVG30069

PHP code 50% from 2 tests

A short review of cyclomatic complexity and code structure
It is recommended to fix the following
  • Cyclomatic complexity of classes has to be reduced to less than 1000 (currently 2,907)
Cyclomatic complexity
Average complexity per logical line of code0.62
Average class complexity85.69
▷ Minimum class complexity1.00
▷ Maximum class complexity2,907.00
Average method complexity4.67
▷ Minimum method complexity1.00
▷ Maximum method complexity86.00
Code structure
Namespaces3
Interfaces0
Traits0
Classes49
▷ Abstract classes24.08%
▷ Concrete classes4795.92%
▷ Final classes00.00%
Methods1,163
▷ Static methods19116.42%
▷ Public methods80569.22%
▷ Protected methods151.29%
▷ Private methods34329.49%
Functions150
▷ Named functions14898.67%
▷ Anonymous functions21.33%
Constants124
▷ Global constants9979.84%
▷ Class constants2520.16%
▷ Public constants25100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
6 PNG files occupy 0.03MB with 0.00MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
img/help_kcoupon.png0.85KB0.70KB▼ 17.03%
img/kvoucherpro.png0.36KB0.33KB▼ 8.31%
img/koboldsoft_black_solutions.png5.29KB4.04KB▼ 23.57%
img/koboldcouponpro.png0.45KB0.46KB0.00%
freemius/assets/img/plugin-icon.png9.16KB5.26KB▼ 42.58%