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
PageMemory (MB)CPU Time (ms)
Home /3.88 ▲0.4244.15 ▲3.05
Dashboard /wp-admin3.70 ▲0.3653.28 ▼7.44
Posts /wp-admin/edit.php3.82 ▲0.4651.91 ▲4.60
Add New Post /wp-admin/post-new.php6.28 ▲0.4096.37 ▼3.78
Media Library /wp-admin/upload.php3.62 ▲0.4037.12 ▲1.68
Create PDF /wp-admin/admin.php?page=wpcf7-send-pdf4.2639.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
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,800 ▲5314.30 ▼0.421.70 ▼0.0748.02 ▲3.03
Dashboard /wp-admin2,195 ▲185.63 ▼0.0383.54 ▼19.8239.87 ▼7.13
Posts /wp-admin/edit.php2,100 ▼32.03 ▲0.0538.00 ▼0.9035.88 ▲0.16
Add New Post /wp-admin/post-new.php1,525 ▼121.14 ▼2.19596.43 ▼66.3042.34 ▼4.78
Media Library /wp-admin/upload.php1,394 ▼94.22 ▼0.1597.88 ▲0.2241.04 ▼1.45
Create PDF /wp-admin/admin.php?page=wpcf7-send-pdf1,0125.28102.6132.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:
LanguageFilesBlank linesComment linesLines of code
PHP35111,32010,24076,698
Markdown635101,096
CSS58118517
JSON5400485
JavaScript32312109
XML412184
Bourne Shell1203

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 code0.52
Average class complexity67.93
▷ Minimum class complexity1.00
▷ Maximum class complexity7,011.00
Average method complexity14.83
▷ Minimum method complexity1.00
▷ Maximum method complexity460.00
Code structure
Namespaces41
Interfaces8
Traits5
Classes255
▷ Abstract classes72.75%
▷ Concrete classes24897.25%
▷ Final classes135.24%
Methods1,301
▷ Static methods1289.84%
▷ Public methods1,12886.70%
▷ Protected methods393.00%
▷ Private methods13410.30%
Functions27
▷ Named functions1037.04%
▷ Anonymous functions1762.96%
Constants406
▷ Global constants122.96%
▷ Class constants39497.04%
▷ Public constants394100.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
FileSize - originalSize - compressedSavings
images/select_off.png3.68KB0.95KB▼ 74.07%
screenshot-3.png291.04KB128.81KB▼ 55.74%
images/logo-Extensions.png6.48KB3.01KB▼ 53.52%
images/icon_delete.png1.72KB1.37KB▼ 20.34%
images/donate.png10.61KB3.53KB▼ 66.72%