57% wp-invoice

Code Review | WP-Invoice - Web Invoice and Billing

WordPress plugin WP-Invoice - Web Invoice and Billing scored 57% from 54 tests.

About plugin

  • Plugin page: wp-invoice
  • Plugin version: 4.3.1
  • PHP version: 7.4.16
  • WordPress compatibility: 4.0-5.4
  • WordPress version: 5.9.2
  • First release: Dec 31, 2008
  • Latest release: Oct 5, 2021
  • Number of updates: 498
  • Update frequency: every 9.4 days
  • Top authors: andypotanin (100%)

Code review

54 tests

User reviews

61 reviews

Install metrics

2,000+ active / 262,962 total downloads

Benchmarks

Plugin footprint 65% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
Installer ran successfully

Server metrics [RAM: ▲0.56MB] [CPU: ▼290.23ms] Passed 4 tests

A check of server-side resources used by WP-Invoice - Web Invoice and Billing
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /4.03 ▲0.5256.00 ▲5.10
Dashboard /wp-admin4.02 ▲0.62897.90 ▲866.11
Posts /wp-admin/edit.php4.24 ▲0.6046.12 ▲8.98
Add New Post /wp-admin/post-new.php7.52 ▲0.5298.21 ▼1,181.81
Media Library /wp-admin/upload.php3.89 ▲0.6029.13 ▲6.82

Server storage [IO: ▲26.84MB] [DB: ▲0.02MB] 67% from 3 tests

Input-output and database impact of this plugin
It is recommended to fix the following issues
  • Total filesystem usage should be limited to 25MB (currently using 26.84MB)
Filesystem: 1,607 new files
Database: 1 new table, 10 new options
New tables
wp_wpi_object_log
New WordPress options
udl_wp-invoice/wp-invoice-url
widget_invoicelookupwidget
wp-invoice-splash-version
widget_invoice_history
wp-invoice-current-version
ud_prod_AB8k6zVmTfBlJj
wpi_options
wpi_activation_time
wp_invoice_version
ud_ping_wp-invoicewp-invoice

Browser metrics Passed 4 tests

An overview of browser requirements for WP-Invoice - Web Invoice and Billing
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,073 ▼1,68115.22 ▼0.385.39 ▼0.502.36 ▲0.07
Dashboard /wp-admin3,018 ▲1606.54 ▲0.35135.27 ▲2.87207.93 ▲50.33
Posts /wp-admin/edit.php2,819 ▲1343.30 ▲0.0764.87 ▲1.84210.60 ▲67.51
Add New Post /wp-admin/post-new.php1,745 ▲8416.10 ▼0.08433.43 ▼6.81156.98 ▲0.31
Media Library /wp-admin/upload.php1,823 ▲1255.68 ▲0.22128.14 ▼9.36221.04 ▲32.90

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
You still need to fix the following
  • Zombie tables were found after uninstall: 1 table
    • wp_wpi_object_log
  • This plugin does not fully uninstall, leaving 10 options in the database
    • ud_ping_wp-invoicewp-invoice
    • widget_invoicelookupwidget
    • wp_invoice_version
    • udl_wp-invoice/wp-invoice-url
    • wpi_activation_time
    • widget_invoice_history
    • wp-invoice-splash-version
    • ud_prod_AB8k6zVmTfBlJj
    • wpi_options
    • wp-invoice-current-version

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the server (in the Apache logs)
Even though no errors were found, this is by no means an exhaustive test

SRP 0% from 2 tests

🔹 Tests weight: 20 | A shallow check of the single-responsibility principle; PHP files should perform no action - including output of placeholder text - and trigger no errors when accessed directly
Please fix the following items
  • 8× PHP files perform the action of outputting non-empty strings when accessed directly:
    • > /wp-content/plugins/wp-invoice/lib/gateways/js/wpi_gateways.js.php
    • > /wp-content/plugins/wp-invoice/addons/wp-invoice-pdf/vendor/phenx/php-font-lib/index.php
    • > /wp-content/plugins/wp-invoice/lib/gateways/templates/payment_header.tpl.php
    • > /wp-content/plugins/wp-invoice/vendor/usabilitydynamics/lib-ud-api-client/static/templates/admin-notice.php
    • > /wp-content/plugins/wp-invoice/lib/third-party/stripe/test/Stripe.php
    • > /wp-content/plugins/wp-invoice/addons/wp-invoice-pdf/vendor/phenx/php-font-lib/www/font_list.php
    • > /wp-content/plugins/wp-invoice/addons/wp-invoice-pdf/lib/third-party/dompdf/lib/php-css-parser/tests/quickdump.php
    • > /wp-content/plugins/wp-invoice/addons/wp-invoice-pdf/vendor/phenx/php-font-lib/www/index.php
  • 355× PHP files trigger errors when accessed directly with GET requests (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Call to undefined function _e() in wp-content/plugins/wp-invoice/addons/wp-invoice-pdf/static/views/pdf_quote_remastered.php:114
    • > PHP Fatal error
      Uncaught Error: Class 'Stripe_Util_Set' not found in wp-content/plugins/wp-invoice/lib/third-party/stripe/lib/Stripe/Object.php:9
    • > PHP Fatal error
      Uncaught Error: Class 'Sabberworm\\CSS\\CSSList\\CSSList' not found in wp-content/plugins/wp-invoice/addons/wp-invoice-pdf/lib/third-party/dompdf/lib/php-css-parser/lib/Sabberworm/CSS/CSSList/CSSBlockList.php:16
    • > PHP Fatal error
      Uncaught Error: Class 'Font_Binary_Stream' not found in wp-content/plugins/wp-invoice/addons/wp-invoice-pdf/vendor/phenx/php-font-lib/classes/Font_Table_Directory_Entry.php:14
    • > PHP Fatal error
      Uncaught Error: Class 'Stripe_ApiResource' not found in wp-content/plugins/wp-invoice/lib/third-party/stripe/lib/Stripe/Transfer.php:3
    • > PHP Warning
      "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in wp-content/plugins/wp-invoice/addons/wp-invoice-pdf/lib/third-party/dompdf/lib/Cpdf.php on line 481
    • > PHP Fatal error
      Uncaught Error: Class 'wpi_gateway_base' not found in wp-content/plugins/wp-invoice/lib/gateways/class_wpi_paypal.php:11
    • > PHP Fatal error
      Uncaught Error: Class 'UsabilityDynamics\\WP\\Bootstrap_Plugin' not found in wp-content/plugins/wp-invoice/addons/wp-invoice-quotes/lib/classes/class-WPI_Q_Bootstrap.php:11
    • > PHP Fatal error
      Uncaught Error: Class 'Svg\\Tag\\Shape' not found in wp-content/plugins/wp-invoice/addons/wp-invoice-pdf/lib/third-party/dompdf/lib/php-svg-lib/src/Svg/Tag/Circle.php:11
    • > PHP Fatal error
      Uncaught Error: Class 'UsabilityDynamics\\WP\\Bootstrap_Plugin' not found in wp-content/plugins/wp-invoice/addons/wp-invoice-spc/lib/classes/class-WPI_SPC_Bootstrap.php:11

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 90% from 29 tests

readme.txt 88% from 16 tests

The readme.txt file is an important file in your plugin as it is parsed by WordPress.org to prepare the public listing of your plugin
These attributes need to be fixed:
  • Screenshots: These screenshots require images: #1 (Add can add custom payments and charges), #2 (Insert pre-defined line items and discounts), #3 (Quickly view invoice status and progression), #4 (Easily filter and find invoices), #5 (Show invoice receipts and invoice history), #6 (Create notification e-mail templates), #7 (Create pre-defined line items), #8 (View 3 standard reports - collected vs uncollected invoices, 10 most valuable clients and top grossing line items)
  • Tags: You are using too many tags: 18 tag instead of maximum 10
You can look at the official readme.txt

wp-invoice/wp-invoice.php 92% from 13 tests

The principal PHP file in "WP-Invoice - Web Invoice and Billing" v. 4.3.1 is loaded by WordPress automatically on each request
Please make the necessary changes and fix the following:
  • Description: Please keep the plugin description shorter than 140 characters (currently 195 characters long)

Code Analysis 3% from 3 tests

File types 0% from 1 test

🔸 Test weight: 35 | An overview of files in this plugin; executable files are not allowed
Please make sure to remedy the following
  • Even if your plugin relies on executable files (for example a companion app), never distribute executable files with your plugin
    • .crt - Security Certificate in Firefox, IE, Chrome, Safari
      • wp-content/plugins/wp-invoice/lib/third-party/stripe/lib/data/ca-certificates.crt
171,780 lines of code in 1,246 files:
LanguageFilesBlank linesComment linesLines of code
PHP50117,03227,85390,585
PO File3228,91769,77133,751
JavaScript5315,9936,50128,181
CSS685606668,316
LESS124381484,476
JSON39002,944
Markdown3962802,090
HTML9140761
XML733287
SVG100264
YAML620379
Bourne Shell117046

PHP code 50% from 2 tests

An short overview of logical lines of code, cyclomatic complexity, and other code metrics
Please fix the following
  • Cyclomatic complexity of methods should be reduced to less than 100 (currently 652)
Cyclomatic complexity
Average complexity per logical line of code0.42
Average class complexity27.67
▷ Minimum class complexity1.00
▷ Maximum class complexity765.00
Average method complexity4.23
▷ Minimum method complexity1.00
▷ Maximum method complexity652.00
Code structure
Namespaces49
Interfaces5
Traits0
Classes428
▷ Abstract classes214.91%
▷ Concrete classes40795.09%
▷ Final classes122.95%
Methods3,629
▷ Static methods59016.26%
▷ Public methods3,21688.62%
▷ Protected methods2557.03%
▷ Private methods1584.35%
Functions169
▷ Named functions13378.70%
▷ Anonymous functions3621.30%
Constants252
▷ Global constants228.73%
▷ Class constants23091.27%
▷ Public constants230100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

PNG files should be compressed to save space and minimize bandwidth usage
76 PNG files occupy 0.17MB with 0.04MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
vendor/usabilitydynamics/lib-ud-api-client/static/images/ud.png10.34KB5.31KB▼ 48.69%
addons/wp-invoice-pdf/lib/third-party/dompdf/lib/res/broken_image.png0.60KB0.47KB▼ 22.33%
vendor/usabilitydynamics/lib-ui/static/styles/fields/jqueryui/img/ui-bg_glass_95_fef1ec_1x400.png0.12KB0.14KB0.00%
addons/wp-invoice-pdf/vendor/phenx/php-font-lib/www/css/ui-lightness/images/ui-icons_ef8c08_256x240.png4.27KB4.11KB▼ 3.78%
static/img/wp-invoice.png4.37KB2.23KB▼ 49.05%