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

Code Review | Send PDF for Contact Form 7

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

About plugin

  • Plugin page: send-pdf-for-cont...
  • Plugin version: 0.9.1
  • PHP version: 7.4.16
  • WordPress compatibility: 3.0-5.9
  • WordPress version: 5.9.2
  • First release: Mar 6, 2016
  • Latest release: Jan 31, 2022
  • Number of updates: 338
  • Update frequency: every 6.4 days
  • Top authors: Florent73 (100%)

Code review

54 tests

User reviews

57 reviews

Install metrics

10,000+ active / 166,582 total downloads

Benchmarks

Plugin footprint 82% from 16 tests

Installer Passed 1 test

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

Server metrics [RAM: ▼0.96MB] [CPU: ▼328.61ms] Passed 4 tests

A check of server-side resources used by Send PDF for Contact Form 7
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /3.85 ▲0.3458.58 ▲6.14
Dashboard /wp-admin3.36 ▼0.0420.05 ▼18.39
Posts /wp-admin/edit.php3.37 ▼0.2720.42 ▼18.22
Add New Post /wp-admin/post-new.php3.36 ▼3.6020.07 ▼1,274.10
Media Library /wp-admin/upload.php3.37 ▲0.0720.25 ▼3.71

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

Filesystem and database footprint
Please try to fix the following items
  • Total filesystem usage should be limited to 25MB (currently using 93.61MB)
Filesystem: 657 new files
Database: 1 new table, 1 new option
New tables
wp_wpcf7pdf_files
New WordPress options
wpcf7pdf_version

Browser metrics Passed 4 tests

Send PDF for Contact Form 7: an overview of browser usage
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,812 ▲5415.74 ▲0.095.87 ▼0.39184.70 ▲182.22
Dashboard /wp-admin2,895 ▲386.24 ▲0.16120.84 ▼1.80163.60 ▼2.74
Posts /wp-admin/edit.php2,684 ▼43.25 ▲0.0267.42 ▲2.06205.21 ▲59.00
Add New Post /wp-admin/post-new.php1,655 ▼620.25 ▼1.84463.32 ▲43.53156.78 ▼51.34
Media Library /wp-admin/upload.php1,698 ▼05.49 ▲0.02144.36 ▲3.91190.60 ▼26.99

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

🔸 Tests weight: 35 | The uninstall procedure must remove all plugin files and extra database tables
It is recommended to fix the following
  • This plugin cannot be uninstalled
    • > Warning in wp-content/plugins/send-pdf-for-contact-form-7/classes/send-pdf.php+281
    Use of undefined constant WPCF7_ADMIN_READ_CAPABILITY - assumed 'WPCF7_ADMIN_READ_CAPABILITY' (this will throw an Error in a future version of PHP)

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 | The single-responsibility principle applies for WordPress plugins as well - please make sure your PHP files perform no actions when accessed directly
The following issues need your attention
  • 3× GET requests to PHP files return non-empty strings:
    • > /wp-content/plugins/send-pdf-for-contact-form-7/includes/shortcodes.php
    • > /wp-content/plugins/send-pdf-for-contact-form-7/views/send-pdf-admin.php
    • > /wp-content/plugins/send-pdf-for-contact-form-7/wpcf7-send-pdf.php
  • 210× PHP files trigger errors when accessed directly with GET requests (only 10 are shown):
    • > 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/Img.php:7
    • > 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/Option.php:7
    • > 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/Details.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/Form.php:5
    • > 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/Annotation.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/H4.php:5
    • > PHP Fatal error
      require_once(): Failed opening required 'lib/byte_safe_strings.php' (include_path='.:/usr/share/php') 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 'Psr\\Log\\LoggerAwareInterface' not found in wp-content/plugins/send-pdf-for-contact-form-7/mpdf/vendor/mpdf/mpdf/src/Writer/MetadataWriter.php:14
    • > PHP Fatal error
      Uncaught Error: Interface 'DeepCopy\\TypeFilter\\TypeFilter' not found in wp-content/plugins/send-pdf-for-contact-form-7/mpdf/vendor/myclabs/deep-copy/src/DeepCopy/TypeFilter/ReplaceFilter.php:8
    • > 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/Div.php:5

User-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the browser (console and network errors and warnings)
No browser issues were found

Optimizations

Plugin configuration 96% from 29 tests

readme.txt Passed 16 tests

The readme.txt file is important because it is parsed by WordPress.org for the public listing of your plugin
8 plugin tags: plugin, pdf, send, form, wordpress...

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

The main PHP file in "Send PDF for Contact Form 7" ver. 0.9.1 adds more information about the plugin and also serves as the entry point for this plugin
It is important to fix the following:
  • 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 | This is a short overview of programming languages used in this plugin, detecting executable files
No dangerous file extensions were detected80,267 lines of code in 441 files:
LanguageFilesBlank linesComment linesLines of code
PHP38611,54411,42077,341
Markdown837301,132
JSON30310565
CSS47318480
PO File1183263413
YAML5524154
JavaScript32312109
XML310070
Bourne Shell1203

PHP code 0% from 2 tests

This is a very shot review of cyclomatic complexity and code structure
Please tend to the following items
  • Class cyclomatic complexity should be reduced to less than 1000 (currently 7,009)
  • Cyclomatic complexity of methods should be reduced to less than 100 (currently 460)
Cyclomatic complexity
Average complexity per logical line of code0.52
Average class complexity61.54
▷ Minimum class complexity1.00
▷ Maximum class complexity7,009.00
Average method complexity14.20
▷ Minimum method complexity1.00
▷ Maximum method complexity460.00
Code structure
Namespaces44
Interfaces10
Traits6
Classes280
▷ Abstract classes93.21%
▷ Concrete classes27196.79%
▷ Final classes134.80%
Methods1,366
▷ Static methods14010.25%
▷ Public methods1,18386.60%
▷ Protected methods554.03%
▷ Private methods1289.37%
Functions33
▷ Named functions1030.30%
▷ Anonymous functions2369.70%
Constants431
▷ Global constants92.09%
▷ Class constants42297.91%
▷ Public constants422100.00%

Plugin size 0% from 2 tests

Image compression 0% from 2 tests

Using a strong compression for your PNG files is a great way to speed-up your plugin
9 PNG files occupy 1.12MB with 0.94MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
screenshot-3.png737.46KB276.86KB▼ 62.46%
(invalid) screenshot-1.png53.27KB0.00KB▼ 100.00%
images/onepixel.png0.90KB0.08KB▼ 91.14%
images/donate.png10.61KB3.53KB▼ 66.72%
(invalid) screenshot-2.png291.38KB0.00KB▼ 100.00%