77% sprout-invoices

Code Review | Client Invoicing by Sprout Invoices - Easy Estimates and Invoices for WordPress

WordPress plugin Client Invoicing by Sprout Invoices - Easy Estimates and Invoices for WordPress scored77%from 54 tests.

About plugin

  • Plugin page: sprout-invoices
  • Plugin version: 20.5.5
  • PHP version: 7.4.16
  • WordPress compatibility: 5.1-6.4
  • WordPress version: 6.3.1
  • First release: Sep 2, 2014
  • Latest release: Nov 9, 2023
  • Number of updates: 332
  • Update frequency: every 10.1 days
  • Top authors: dancameron (90.06%)avonville1 (6.63%)boldgrid (3.31%)

Code review

54 tests

User reviews

179 reviews

Install metrics

2,000+ active /184,241 total downloads

Benchmarks

Plugin footprint 82% 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: ▲1.78MB] [CPU: ▲8.17ms] 75% from 4 tests

This is a short check of server-side resources used by Client Invoicing by Sprout Invoices - Easy Estimates and Invoices for WordPress
Please take the time to fix the following items
  • CPU: The total CPU usage must kept under 500.00ms (currently 1,331.12ms on /wp-admin/admin.php?page=sprout-invoices-addons)
PageMemory (MB)CPU Time (ms)
Home /4.96 ▲1.5049.43 ▲8.51
Dashboard /wp-admin5.21 ▲1.9171.96 ▲19.98
Posts /wp-admin/edit.php5.29 ▲1.9362.43 ▲16.42
Add New Post /wp-admin/post-new.php7.65 ▲1.7694.60 ▼12.22
Media Library /wp-admin/upload.php5.21 ▲1.9859.51 ▲25.62
Tools /wp-admin/admin.php?page=sprout-invoices-import5.1958.04
Estimates /wp-admin/edit.php?post_type=sa_estimate5.2855.92
Add Estimate /wp-admin/post-new.php?post_type=sa_estimate5.3179.99
Notifications /wp-admin/admin.php?page=sprout-invoices-notifications5.1955.17
Add-ons /wp-admin/admin.php?page=sprout-invoices-addons6.101,331.12
Projects /wp-admin/edit.php?post_type=sa_project5.2852.64
Payments /wp-admin/edit.php?post_type=sa_invoice&page=sprout-apps/invoice_payments5.1950.66
Notifications /wp-admin/edit.php?post_type=sa_notification4.5935.26
Payment Processors /wp-admin/admin.php?page=sprout-invoices-payments5.1951.39
General Settings /wp-admin/admin.php?page=sprout-invoices-settings5.1956.19

Server storage [IO: ▲19.21MB] [DB: ▲0.23MB] Passed 3 tests

Filesystem and database footprint
The plugin installed successfully
Filesystem: 541 new files
Database: no new tables, 13 new options
New WordPress options
si_est_theme_template
si_notifications
widget_theysaidso_widget
si_inv_theme_template
widget_recent-comments
db_upgraded
can_compress_scripts
si_money_format
si_current_version
si_active_addons_v3
...

Browser metrics Passed 4 tests

A check of browser resources used by Client Invoicing by Sprout Invoices - Easy Estimates and Invoices for WordPress
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,226 ▲46413.27 ▼1.141.69 ▼0.0833.46 ▼10.56
Dashboard /wp-admin2,595 ▲4184.95 ▼0.69105.45 ▲2.5951.61 ▲9.16
Posts /wp-admin/edit.php2,311 ▲2112.37 ▲0.3541.05 ▲3.2236.69 ▲3.35
Add New Post /wp-admin/post-new.php1,671 ▲14523.22 ▼0.17709.73 ▲21.2859.20 ▲4.38
Media Library /wp-admin/upload.php1,611 ▲2114.40 ▲0.23104.44 ▼1.8547.10 ▲2.25
Tools /wp-admin/admin.php?page=sprout-invoices-import2,1173.2561.5940.09
Estimates /wp-admin/edit.php?post_type=sa_estimate1,3962.3641.5037.10
Add Estimate /wp-admin/post-new.php?post_type=sa_estimate5,6548.45202.9183.96
Notifications /wp-admin/admin.php?page=sprout-invoices-notifications2,4666.00113.0890.08
Add-ons /wp-admin/admin.php?page=sprout-invoices-addons5,0993.8784.7851.44
Projects /wp-admin/edit.php?post_type=sa_project1,3402.5238.4530.71
Payments /wp-admin/edit.php?post_type=sa_invoice&page=sprout-apps/invoice_payments1,2392.1430.3829.16
Notifications /wp-admin/edit.php?post_type=sa_notification2,4605.77100.0859.07
Payment Processors /wp-admin/admin.php?page=sprout-invoices-payments1,5852.9947.3440.95
General Settings /wp-admin/admin.php?page=sprout-invoices-settings7,3814.4487.9456.79

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

🔸 Tests weight: 35 | It is important to correctly uninstall your plugin, without leaving any traces
The following items require your attention
  • This plugin did not uninstall successfully, leaving 13 options in the database
    • si_current_version
    • si_inv_theme_template
    • si_money_format
    • widget_recent-posts
    • si_import_progress
    • si_est_theme_template
    • db_upgraded
    • theysaidso_admin_options
    • si_notifications
    • can_compress_scripts
    • ...

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no server-side errors were triggered
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
Please fix the following
  • 14× PHP files output non-empty strings when accessed directly via GET requests (only 10 are shown):
    • > /wp-content/plugins/sprout-invoices/views/notifications/admin-request-submitted.php
    • > /wp-content/plugins/sprout-invoices/importers/lib/freshbooks/FreshBooksRequest.php
    • > /wp-content/plugins/sprout-invoices/views/notifications/admin-estimate-accepted.php
    • > /wp-content/plugins/sprout-invoices/views/notifications/payment-reminder.php
    • > /wp-content/plugins/sprout-invoices/views/notifications/estimate.php
    • > /wp-content/plugins/sprout-invoices/views/notifications/request-received.php
    • > /wp-content/plugins/sprout-invoices/views/notifications/payment-final.php
    • > /wp-content/plugins/sprout-invoices/importers/lib/freshbooks/XmlDomConstruct.php
    • > /wp-content/plugins/sprout-invoices/views/templates/invoice/payment-options.php
    • > /wp-content/plugins/sprout-invoices/views/notifications/admin-estimate-declined.php
  • 267× PHP files trigger server errors when accessed directly (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_attr() in wp-content/plugins/sprout-invoices/views/templates/checkout/checks/form.php:2
    • > PHP Notice
      Undefined variable: processor_settings in wp-content/plugins/sprout-invoices/views/admin/payment-processors/cc-settings.php on line 1
    • > PHP Fatal error
      Uncaught Error: Class 'SI_Estimates' not found in wp-content/plugins/sprout-invoices/controllers/estimates/Estimates_Edit.php:11
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_html_e() in wp-content/plugins/sprout-invoices/views/admin/dashboards/premium/requests-converted-chart.php:7
    • > PHP Fatal error
      Uncaught Error: Call to undefined function do_action() in wp-content/plugins/sprout-invoices/views/admin/reports/payments.php:1
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_html_e() in wp-content/plugins/sprout-invoices/views/templates/theme/default/attachments-info/thumbnails-pdf.php:3
    • > PHP Fatal error
      Uncaught Error: Class 'SI_Controller' not found in wp-content/plugins/sprout-invoices/controllers/fees/Fees.php:9
    • > PHP Fatal error
      Uncaught Error: Call to undefined function wp_enqueue_style() in wp-content/plugins/sprout-invoices/views/templates/theme/basic/invoice/invoice-pdf.php:16
    • > PHP Notice
      Undefined variable: post in wp-content/plugins/sprout-invoices/views/admin/meta-boxes/projects/submit.php on line 8
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_html_e() in wp-content/plugins/sprout-invoices/views/admin/options/form-integrations-cta.php:5

User-side errors Passed 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
No browser issues were found

Optimizations

Plugin configuration 83% 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
These attributes need your attention:
  • Screenshots: These screenshots do not have images: #1 (Invoice Template), #2 (Easy Invoice Management), #3 (Easy Invoice Management), #4 (A dashboard with charts and summaries answer the question "how am I doing?".), #5 (Dynamic reports allow for date filtering, sorting, search, and exporting.), #6 (Common management tasks are sped up by Sprout Invoices utilization of AJAX.), #7 (Easy Estimate Management)
  • Tags: Please delete some tags, you are using 18 tag instead of maximum 10
The official readme.txt is a good inspiration

sprout-invoices/sprout-invoices.php 77% from 13 tests

The main PHP file in "Client Invoicing by Sprout Invoices - Easy Estimates and Invoices for WordPress" ver. 20.5.5 adds more information about the plugin and also serves as the entry point for this plugin
The following require your attention:
  • Description: Please keep the plugin description shorter than 140 characters (currently 169 characters long)
  • Domain Path: The domain path must begin with a forward slash character ("/languages")
  • Domain Path: Note that the domain path follows the same naming rules as the domain name, using only dashes and lowercase characters ("languages")

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
Everything looks great! No dangerous files found in this plugin124,198 lines of code in 391 files:
LanguageFilesBlank linesComment linesLines of code
PO File1923,97338,79159,791
PHP2676,27512,06335,013
JavaScript713,9902,46620,232
CSS121,3353957,993
Sass131316535
HTML2441503
Markdown342070
SVG10032
JSON30029

PHP code Passed 2 tests

A short review 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.42
Average class complexity33.17
▷ Minimum class complexity1.00
▷ Maximum class complexity207.00
Average method complexity3.16
▷ Minimum method complexity1.00
▷ Maximum method complexity61.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes99
▷ Abstract classes77.07%
▷ Concrete classes9292.93%
▷ Final classes00.00%
Methods1,474
▷ Static methods91361.94%
▷ Public methods1,39894.84%
▷ Protected methods382.58%
▷ Private methods382.58%
Functions243
▷ Named functions23797.53%
▷ Anonymous functions62.47%
Constants554
▷ Global constants325.78%
▷ Class constants52294.22%
▷ Public constants522100.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

It is recommended to compress PNG files in your plugin to minimize bandwidth usage
92 PNG files occupy 7.10MB with 3.73MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
bundles/default.png25.29KB8.44KB▼ 66.62%
resources/admin/img/basic.png167.01KB58.83KB▼ 64.78%
resources/front-end/img/diners.png3.57KB2.50KB▼ 30.06%
resources/front-end/img/gift-card.png3.98KB2.44KB▼ 38.61%
resources/admin/img/stripe.png95.64KB35.81KB▼ 62.56%