68% advanced-pdf-generator

Code Review | Advanced PDF Generator

WordPress plugin Advanced PDF Generator scored68%from 54 tests.

About plugin

  • Plugin page: advanced-pdf-gene...
  • Plugin version: 0.4.0
  • PHP compatiblity: 5.6.1+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.5-4.8.3
  • WordPress version: 6.3.1
  • First release: Nov 3, 2017
  • Latest release: Dec 13, 2017
  • Number of updates: 25
  • Update frequency: every 1.6 days
  • Top authors: jcmlmorav (100%)

Code review

54 tests

User reviews

3 reviews

Install metrics

90+ active /3,630 total downloads

Benchmarks

Plugin footprint 65% 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.79MB] [CPU: ▼9.90ms] Passed 4 tests

This is a short check of server-side resources used by Advanced PDF Generator
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /4.24 ▲0.7848.48 ▲1.76
Dashboard /wp-admin4.12 ▲0.8146.36 ▼5.83
Posts /wp-admin/edit.php4.15 ▲0.7945.86 ▼10.39
Add New Post /wp-admin/post-new.php6.76 ▲0.8879.74 ▼21.42
Media Library /wp-admin/upload.php3.99 ▲0.7636.59 ▼1.97

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

Input-output and database impact of this plugin
There were no storage issued detected upon installing this plugin
Filesystem: 152 new files
Database: 1 new table, 6 new options
New tables
wp_apdfg_values
New WordPress options
can_compress_scripts
widget_theysaidso_widget
theysaidso_admin_options
widget_recent-comments
widget_recent-posts
db_upgraded

Browser metrics Passed 4 tests

This is an overview of browser requirements for Advanced PDF Generator
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,937 ▲18013.57 ▼0.8210.38 ▲8.0742.22 ▼3.45
Dashboard /wp-admin2,226 ▲385.83 ▲0.8194.61 ▼19.6239.49 ▼8.60
Posts /wp-admin/edit.php2,112 ▲232.00 ▼0.0233.61 ▼2.1329.85 ▼5.19
Add New Post /wp-admin/post-new.php1,531 ▲1717.37 ▼0.38652.35 ▼18.4761.31 ▲3.86
Media Library /wp-admin/upload.php1,411 ▲204.20 ▲0.0394.24 ▼8.4441.19 ▼0.22

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
The following items require your attention
  • This plugin does not fully uninstall, leaving 1 table in the database
    • wp_apdfg_values
  • The uninstall procedure has failed, leaving 6 options in the database
    • widget_recent-posts
    • can_compress_scripts
    • widget_theysaidso_widget
    • theysaidso_admin_options
    • widget_recent-comments
    • db_upgraded

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
Even though everything seems fine, this is not an exhaustive test

SRP 0% from 2 tests

🔹 Tests weight: 20 | It is important to ensure that your PHP files perform no action when accessed directly, respecting the single-responsibility principle
Please fix the following items
  • 1× PHP files output non-empty strings when accessed directly via GET requests:
    • > /wp-content/plugins/advanced-pdf-generator/public/partials/plugin-name-public-display.php
  • 86× PHP files trigger errors when accessed directly with GET requests (only 10 are shown):
    • > PHP Warning
      "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in wp-content/plugins/advanced-pdf-generator/public/libs/dompdf/lib/Cpdf.php on line 481
    • > PHP Notice
      Trying to get property 'submit_label' of non-object in wp-content/plugins/advanced-pdf-generator/admin/partials/advanced-pdf-generator-admin-display.php on line 101
    • > PHP Notice
      Undefined variable: values in wp-content/plugins/advanced-pdf-generator/admin/partials/advanced-pdf-generator-admin-display.php on line 45
    • > PHP Warning
      "continue" targeting switch is equivalent to "break". Did you mean to use "continue 2"? in wp-content/plugins/advanced-pdf-generator/public/libs/dompdf/lib/Cpdf.php on line 467
    • > PHP Notice
      Undefined variable: values in wp-content/plugins/advanced-pdf-generator/admin/partials/advanced-pdf-generator-admin-display.php on line 87
    • > PHP Fatal error
      Uncaught Error: Class 'Dompdf\\FrameDecorator\\Block' not found in wp-content/plugins/advanced-pdf-generator/public/libs/dompdf/src/FrameDecorator/TableCell.php:19
    • > PHP Fatal error
      Uncaught Error: Class 'Dompdf\\Positioner\\AbstractPositioner' not found in wp-content/plugins/advanced-pdf-generator/public/libs/dompdf/src/Positioner/ListBullet.php:19
    • > PHP Fatal error
      Uncaught Error: Class 'Dompdf\\FrameDecorator\\AbstractFrameDecorator' not found in wp-content/plugins/advanced-pdf-generator/public/libs/dompdf/src/FrameDecorator/Text.php:24
    • > PHP Notice
      Trying to get property 'success_message' of non-object in wp-content/plugins/advanced-pdf-generator/admin/partials/advanced-pdf-generator-admin-display.php on line 87
    • > PHP Fatal error
      Uncaught Error: Class 'Dompdf\\FrameDecorator\\AbstractFrameDecorator' not found in wp-content/plugins/advanced-pdf-generator/public/libs/dompdf/src/FrameDecorator/Inline.php:22

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)
Everything seems fine, but this is not an exhaustive test

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 94% from 16 tests

Often overlooked, readme.txt is one of the most important files in your plugin
These attributes need to be fixed: You can look at the official readme.txt

advanced-pdf-generator/advanced-pdf-generator.php 92% from 13 tests

The main PHP script in "Advanced PDF Generator" version 0.4.0 is automatically included on every request by WordPress
It is important to fix the following:
  • Text Domain: The text domain must be the same as the plugin slug, although optional since WordPress version 4.6

Code Analysis 97% from 3 tests

File types Passed 1 test

🔸 Test weight: 35 | An overview of files in this plugin; executable files are not allowed
Success! There were no dangerous files found in this plugin23,012 lines of code in 102 files:
LanguageFilesBlank linesComment linesLines of code
PHP915,64213,16322,157
CSS39552430
Markdown3910218
XML102140
JSON10044
HTML10017
JavaScript24546

PHP code 50% from 2 tests

This plugin's cyclomatic complexity and code structure detailed below
The following items need your attention
  • Method cyclomatic complexity has to be reduced to less than 100 (currently 652)
Cyclomatic complexity
Average complexity per logical line of code0.47
Average class complexity54.37
▷ Minimum class complexity1.00
▷ Maximum class complexity765.00
Average method complexity5.07
▷ Minimum method complexity1.00
▷ Maximum method complexity652.00
Code structure
Namespaces10
Interfaces1
Traits0
Classes83
▷ Abstract classes44.82%
▷ Concrete classes7995.18%
▷ Final classes00.00%
Methods1,130
▷ Static methods625.49%
▷ Public methods95584.51%
▷ Protected methods12210.80%
▷ Private methods534.69%
Functions11
▷ Named functions327.27%
▷ Anonymous functions872.73%
Constants84
▷ Global constants33.57%
▷ Class constants8196.43%
▷ Public constants81100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

It is recommended to compress PNG files in your plugin to minimize bandwidth usage
1 PNG file occupies 0.00MB with 0.00MB in potential savings
Potential savings
Compression of 1 random PNG file using pngquant
FileSize - originalSize - compressedSavings
public/libs/dompdf/lib/res/broken_image.png0.60KB0.47KB▼ 22.33%