81% generate-pdf-using-contact-form-7

Code Review | Generate PDF using Contact Form 7

WordPress plugin Generate PDF using Contact Form 7 scored 81% from 54 tests.

About plugin

  • Plugin page: generate-pdf-usin...
  • Plugin version: 2.10
  • PHP compatiblity: 5.6+
  • PHP version: 7.4.16
  • WordPress compatibility: 3.0.1-5.8
  • WordPress version: 5.8.1
  • First release: Apr 30, 2020
  • Latest release: Oct 19, 2021
  • Number of updates: 72
  • Update frequency: every 7.5 days
  • Top authors: zealopensource (100%)

Code review

54 tests

User reviews

16 reviews

Install metrics

2,000+ active / 16,743 total downloads


Plugin footprint Passed 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Verifying that this plugin installs correctly without errors
Install script ran successfully

Server metrics [RAM: ▼0.00MB] [CPU: ▼132.30ms] Passed 4 tests

A check of server-side resources used by Generate PDF using Contact Form 7
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /2.83 ▲0.1240.99 ▲17.59
Dashboard /wp-admin3.06 ▲0.0059.87 ▲12.00
Posts /wp-admin/edit.php3.11 ▲0.0052.41 ▼0.59
Add New Post /wp-admin/post-new.php5.42 ▼0.02122.32 ▼542.12
Media Library /wp-admin/upload.php3.00 ▲0.0036.44 ▲1.53
PDF with CF7 /wp-admin/admin.php?page=wp-cf7-send-pdf2.7421.76

Server storage [IO: ▲19.51MB] [DB: ▲0.00MB] Passed 3 tests

How much does this plugin use your filesystem and database?
No storage issues were detected
Filesystem: 1,283 new files
Database: no new tables, no new options

Browser metrics Passed 4 tests

A check of browser resources used by Generate PDF using Contact Form 7
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,703 ▲10715.86 ▼0.0925.40 ▲13.2550.69 ▼0.32
Dashboard /wp-admin2,970 ▲365.93 ▼0.00168.52 ▲14.59122.17 ▲7.21
Posts /wp-admin/edit.php2,739 ▼02.72 ▲0.0180.30 ▲4.5197.81 ▲3.89
Add New Post /wp-admin/post-new.php1,683 ▼018.17 ▲1.60462.78 ▲39.06115.76 ▼1.81
Media Library /wp-admin/upload.php1,807 ▼05.00 ▼0.00166.64 ▲1.04120.04 ▼0.37
PDF with CF7 /wp-admin/admin.php?page=wp-cf7-send-pdf280.900.0712.57

Uninstaller [IO: ▲0.00MB] [DB: ▲0.00MB] Passed 4 tests

🔸 Tests weight: 35 | The uninstall procedure must remove all plugin files and extra database tables
This plugin's uninstaller ran successfully

Smoke tests 25% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
Everything seems fine, however this is by no means an exhaustive test

SRP 0% from 2 tests

🔹 Tests weight: 20 | SRP (Single-Responsibility Principle) - PHP files must act as libraries and never output text or perform any action when accessed directly in a browser
Please take a closer look at the following
  • 6× PHP files perform the action of outputting non-empty strings when accessed directly:
    • > /wp-content/plugins/generate-pdf-using-contact-form-7/inc/lib/mpdf/vendor/masterminds/html5/bin/entities.php
    • > /wp-content/plugins/generate-pdf-using-contact-form-7/inc/lib/mpdf/vendor/querypath/querypath/examples/html.php
    • > /wp-content/plugins/generate-pdf-using-contact-form-7/inc/templates/cf7-pdf-generation.admin.html.php
    • > /wp-content/plugins/generate-pdf-using-contact-form-7/inc/lib/mpdf/vendor/querypath/querypath/examples/at_a_glance.php
    • > /wp-content/plugins/generate-pdf-using-contact-form-7/inc/lib/mpdf/vendor/querypath/querypath/bin/compactor.php
    • > /wp-content/plugins/generate-pdf-using-contact-form-7/inc/lib/mpdf/vendor/querypath/querypath/phar/basic_loader.php
  • 472× PHP files trigger server-side errors or warnings when accessed directly (only 10 are shown):
    • > PHP Fatal error
      require_once(): Failed opening required '../src/QueryPath/QueryPath.php' (include_path='.:/usr/share/php') in wp-content/plugins/generate-pdf-using-contact-form-7/inc/lib/mpdf/vendor/querypath/querypath/examples/svg.php on line 19
    • > PHP Fatal error
      Uncaught Error: Interface 'QueryPath\\Query' not found in wp-content/plugins/generate-pdf-using-contact-form-7/inc/lib/mpdf/vendor/querypath/querypath/src/QueryPath/DOMQuery.php:38
    • > PHP Fatal error
      Uncaught Error: Interface 'DeepCopy\\TypeFilter\\TypeFilter' not found in wp-content/plugins/generate-pdf-using-contact-form-7/inc/lib/mpdf/vendor/myclabs/deep-copy/src/DeepCopy/TypeFilter/ShallowCopyFilter.php:8
    • > PHP Fatal error
      Uncaught Error: Class 'Monolog\\TestCase' not found in wp-content/plugins/generate-pdf-using-contact-form-7/inc/lib/mpdf/vendor/monolog/monolog/tests/Monolog/Handler/DynamoDbHandlerTest.php:16
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit_Framework_TestCase' not found in wp-content/plugins/generate-pdf-using-contact-form-7/inc/lib/mpdf/vendor/codeguy/upload/tests/Storage/FileSystemTest.php:2
    • > PHP Fatal error
      Uncaught Error: Interface 'DeepCopy\\Filter\\Filter' not found in wp-content/plugins/generate-pdf-using-contact-form-7/inc/lib/mpdf/vendor/myclabs/deep-copy/src/DeepCopy/Filter/Doctrine/DoctrineCollectionFilter.php:11
    • > PHP Fatal error
      Uncaught Error: Class 'FPDF' not found in wp-content/plugins/generate-pdf-using-contact-form-7/inc/lib/mpdf/vendor/setasign/fpdi/fpdi_bridge.php:23
    • > PHP Fatal error
      Uncaught Error: Class 'Upload\\Validation\\Base' not found in wp-content/plugins/generate-pdf-using-contact-form-7/inc/lib/mpdf/vendor/codeguy/upload/src/Upload/Validation/Size.php:44
    • > PHP Fatal error
      require_once(): Failed opening required '../src/QueryPath/QueryPath.php' (include_path='.:/usr/share/php') in wp-content/plugins/generate-pdf-using-contact-form-7/inc/lib/mpdf/vendor/querypath/querypath/examples/simple_example.php on line 25
    • > PHP Fatal error
      Uncaught Error: Class 'Monolog\\Handler\\AbstractSyslogHandler' not found in wp-content/plugins/generate-pdf-using-contact-form-7/inc/lib/mpdf/vendor/monolog/monolog/src/Monolog/Handler/SyslogUdpHandler.php:22

User-side errors 0% from 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
There are user-side issues you should fix
    • > GET request to /wp-admin/admin.php?page=wp-cf7-send-pdf
    • > Network (severe)
    wp-admin/admin.php?page=wp-cf7-send-pdf - Failed to load resource: the server responded with a status of 403 (Forbidden)


Plugin configuration 90% from 29 tests

readme.txt Passed 16 tests

You should put a lot of thought into formatting readme.txt as it is used by WordPress.org to prepare the public listing of your plugin
7 plugin tags: pdf mail, form, email, contact corm 7, contact form...

generate-pdf-using-contact-form-7/cf7-pdf-generation.php 77% from 13 tests

The primary PHP file in "Generate PDF using Contact Form 7" version 2.10 is used by WordPress to initiate all plugin functionality
You should first fix the following items:
  • Description: If Twitter did it, so should we! Keep the description under 140 characters (currently 173 characters long)
  • Main file name: Even though not officially enforced, the main plugin file should be the same as the plugin slug ("generate-pdf-using-contact-form-7.php" instead of "cf7-pdf-generation.php")
  • Text Domain: Since WordPress version 4.6 the text domain is optional; if specified, it must be the same as the plugin slug

Code Analysis 95% from 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is an overview of file extensions present in this plugin and a short test that no dangerous files are bundled with this plugin
Success! There were no dangerous files found in this plugin147,203 lines of code in 858 files:
LanguageFilesBlank linesComment linesLines of code
Bourne Shell510844

PHP code 0% from 2 tests

Analyzing cyclomatic complexity and code structure
These items need your attention
  • Class cyclomatic complexity should be reduced to less than 1000 (currently 7,031)
  • Please reduce cyclomatic complexity of methods to less than 100 (currently 460)
Cyclomatic complexity
Average complexity per logical line of code0.44
Average class complexity35.17
▷ Minimum class complexity1.00
▷ Maximum class complexity7,031.00
Average method complexity6.75
▷ Minimum method complexity1.00
▷ Maximum method complexity460.00
Code structure
▷ Abstract classes193.35%
▷ Concrete classes54996.65%
▷ Final classes152.73%
▷ Static methods2246.02%
▷ Public methods3,09883.23%
▷ Protected methods3719.97%
▷ Private methods2536.80%
▷ Named functions7641.30%
▷ Anonymous functions10858.70%
▷ Global constants233.70%
▷ Class constants59896.30%
▷ Public constants598100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
7 PNG files occupy 0.06MB with 0.03MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
inc/lib/mpdf/vendor/myclabs/deep-copy/doc/clone.png12.09KB5.48KB▼ 54.70%
assets/images/arrow-right-top.png5.97KB2.68KB▼ 55.17%
assets/images/pdf-logo.png7.99KB4.14KB▼ 48.19%
assets/css/images/ui-icons_444444_256x240.png6.84KB4.18KB▼ 38.90%
inc/lib/mpdf/vendor/myclabs/deep-copy/doc/graph.png6.29KB3.03KB▼ 51.86%