77% send-pdf-for-contact-form-7

Code Review | Send PDF for Contact Form 7

WordPress plugin Send PDF for Contact Form 7 scored77%from 54 tests.

About plugin

  • Plugin page: send-pdf-for-cont...
  • Plugin version: 1.0.1.8
  • PHP version: 7.4.16
  • WordPress compatibility: 5.2-6.4
  • WordPress version: 6.3.1
  • First release: Mar 6, 2016
  • Latest release: Dec 2, 2023
  • Number of updates: 406
  • Update frequency: every 7.0 days
  • Top authors: Florent73 (100%)

Code review

54 tests

User reviews

72 reviews

Install metrics

10,000+ active /262,354 total downloads

Benchmarks

Plugin footprint 82% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
The plugin installed gracefully, with no errors

Server metrics [RAM: ▲0.39MB] [CPU: ▼1.62ms] Passed 4 tests

Analyzing server-side resources used by Send PDF for Contact Form 7
This plugin does not affect your website's performance
Page Memory (MB) CPU Time (ms)
Home / 3.88 ▲0.42 44.15 ▲3.05
Dashboard /wp-admin 3.70 ▲0.36 53.28 ▼7.44
Posts /wp-admin/edit.php 3.82 ▲0.46 51.91 ▲4.60
Add New Post /wp-admin/post-new.php 6.28 ▲0.40 96.37 ▼3.78
Media Library /wp-admin/upload.php 3.62 ▲0.40 37.12 ▲1.68
Create PDF /wp-admin/admin.php?page=wpcf7-send-pdf 4.26 39.99

Server storage [IO: ▲149.68MB] [DB: ▲0.00MB] 67% from 3 tests

A short overview of filesystem and database impact
These are issues you should consider
  • Total filesystem usage should be limited to 25MB (currently using 149.68MB)
Filesystem: 942 new files
Database: 1 new table, 8 new options
New tables
wp_wpcf7pdf_files
New WordPress options
db_upgraded
theysaidso_admin_options
widget_recent-comments
wpcf7pdf_path_temp
widget_theysaidso_widget
wpcf7pdf_version
can_compress_scripts
widget_recent-posts

Browser metrics Passed 4 tests

An overview of browser requirements for Send PDF for Contact Form 7
This plugin renders optimally with no browser resource issues detected
Page Nodes Memory (MB) Script (ms) Layout (ms)
Home / 2,800 ▲53 14.30 ▼0.42 1.70 ▼0.07 48.02 ▲3.03
Dashboard /wp-admin 2,195 ▲18 5.63 ▼0.03 83.54 ▼19.82 39.87 ▼7.13
Posts /wp-admin/edit.php 2,100 ▼3 2.03 ▲0.05 38.00 ▼0.90 35.88 ▲0.16
Add New Post /wp-admin/post-new.php 1,525 ▼1 21.14 ▼2.19 596.43 ▼66.30 42.34 ▼4.78
Media Library /wp-admin/upload.php 1,394 ▼9 4.22 ▼0.15 97.88 ▲0.22 41.04 ▼1.45
Create PDF /wp-admin/admin.php?page=wpcf7-send-pdf 1,012 5.28 102.61 32.43

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
The following items require your attention
  • The uninstall procedure has failed, leaving 6 options in the database
    • widget_recent-comments
    • db_upgraded
    • widget_recent-posts
    • can_compress_scripts
    • theysaidso_admin_options
    • widget_theysaidso_widget

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
Everything seems fine, however 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
Almost there! Just fix the following items
  • 6× GET requests to PHP files return non-empty strings:
    • > /wp-content/plugins/send-pdf-for-contact-form-7/views/send-pdf-admin.php
    • > /wp-content/plugins/send-pdf-for-contact-form-7/classes/prepare-pdf.php
    • > /wp-content/plugins/send-pdf-for-contact-form-7/classes/settings.php
    • > /wp-content/plugins/send-pdf-for-contact-form-7/wpcf7-send-pdf.php
    • > /wp-content/plugins/send-pdf-for-contact-form-7/includes/shortcodes.php
    • > /wp-content/plugins/send-pdf-for-contact-form-7/classes/generate.php
  • 179× PHP files trigger errors when accessed directly with GET requests (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'Mpdf\\Tag\\BlockTag' not found in wp-content/plugins/send-pdf-for-contact-form-7/mpdf/vendor/mpdf/mpdf/src/Tag/H4.php:5
    • > PHP Fatal error
      Uncaught Error: Class 'Mpdf\\Tag\\BlockTag' not found in wp-content/plugins/send-pdf-for-contact-form-7/mpdf/vendor/mpdf/mpdf/src/Tag/HGroup.php:5
    • > PHP Fatal error
      Uncaught Error: Class 'Mpdf\\Tag\\InlineTag' not found in wp-content/plugins/send-pdf-for-contact-form-7/mpdf/vendor/mpdf/mpdf/src/Tag/Bdi.php:5
    • > PHP Fatal error
      Uncaught Error: Class 'Mpdf\\Barcode\\AbstractBarcode' not found in wp-content/plugins/send-pdf-for-contact-form-7/mpdf/vendor/mpdf/mpdf/src/Barcode/I25.php:10
    • > PHP Fatal error
      Uncaught Error: Class 'Mpdf\\Tag\\Tag' not found in wp-content/plugins/send-pdf-for-contact-form-7/mpdf/vendor/mpdf/mpdf/src/Tag/THead.php:5
    • > PHP Warning
      require_once(lib/byte_safe_strings.php): failed to open stream: No such file or directory in wp-content/plugins/send-pdf-for-contact-form-7/mpdf/vendor/paragonie/random_compat/psalm-autoload.php on line 3
    • > PHP Fatal error
      Uncaught Error: Interface 'DeepCopy\\Filter\\Filter' not found in wp-content/plugins/send-pdf-for-contact-form-7/mpdf/vendor/myclabs/deep-copy/src/DeepCopy/Filter/Doctrine/DoctrineProxyFilter.php:10
    • > PHP Fatal error
      Uncaught Error: Class 'Mpdf\\Barcode\\AbstractBarcode' not found in wp-content/plugins/send-pdf-for-contact-form-7/mpdf/vendor/mpdf/mpdf/src/Barcode/Msi.php:9
    • > PHP Fatal error
      Uncaught Error: Class 'Mpdf\\Tag\\BlockTag' not found in wp-content/plugins/send-pdf-for-contact-form-7/mpdf/vendor/mpdf/mpdf/src/Tag/H3.php:5
    • > PHP Fatal error
      Uncaught Error: Class 'Mpdf\\Tag\\InlineTag' not found in wp-content/plugins/send-pdf-for-contact-form-7/mpdf/vendor/mpdf/mpdf/src/Tag/S.php:5

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
Everything seems fine, but this is not an exhaustive test

Optimizations

Plugin configuration 96% from 29 tests

readme.txt Passed 16 tests

Often overlooked, readme.txt is one of the most important files in your plugin
8 plugin tags: cf7, contact form, send, attachment, plugin...

send-pdf-for-contact-form-7/wpcf7-send-pdf.php 92% from 13 tests

The main PHP script in "Send PDF for Contact Form 7" version 1.0.1.8 is automatically included on every request by WordPress
You should first fix the following items:
  • Main file name: Name the main plugin file the same as the plugin slug ("send-pdf-for-contact-form-7.php" instead of "wpcf7-send-pdf.php")

Code Analysis 95% from 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short glimpse at programming languages used with this plugin and a check that no dangerous files are present
There were no executable files found in this plugin78,992 lines of code in 424 files:
Language Files Blank lines Comment lines Lines of code
PHP 351 11,320 10,240 76,698
Markdown 6 351 0 1,096
CSS 5 81 18 517
JSON 54 0 0 485
JavaScript 3 23 12 109
XML 4 12 1 84
Bourne Shell 1 2 0 3

PHP code 0% from 2 tests

Analyzing cyclomatic complexity and code structure
Please fix the following
  • Cyclomatic complexity of classes should be reduced to less than 1000 (currently 7,011)
  • Method cyclomatic complexity has to be reduced to less than 100 (currently 460)
Cyclomatic complexity
Average complexity per logical line of code 0.52
Average class complexity 67.93
▷ Minimum class complexity 1.00
▷ Maximum class complexity 7,011.00
Average method complexity 14.83
▷ Minimum method complexity 1.00
▷ Maximum method complexity 460.00
Code structure
Namespaces 41
Interfaces 8
Traits 5
Classes 255
▷ Abstract classes 7 2.75%
▷ Concrete classes 248 97.25%
▷ Final classes 13 5.24%
Methods 1,301
▷ Static methods 128 9.84%
▷ Public methods 1,128 86.70%
▷ Protected methods 39 3.00%
▷ Private methods 134 10.30%
Functions 27
▷ Named functions 10 37.04%
▷ Anonymous functions 17 62.96%
Constants 406
▷ Global constants 12 2.96%
▷ Class constants 394 97.04%
▷ Public constants 394 100.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
11 PNG files occupy 0.69MB with 0.37MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
File Size - original Size - compressed Savings
images/select_off.png 3.68KB 0.95KB ▼ 74.07%
screenshot-3.png 291.04KB 128.81KB ▼ 55.74%
images/logo-Extensions.png 6.48KB 3.01KB ▼ 53.52%
images/icon_delete.png 1.72KB 1.37KB ▼ 20.34%
images/donate.png 10.61KB 3.53KB ▼ 66.72%