78% advanced-pdf-generator

Code Review | Advanced PDF Generator

WordPress plugin Advanced PDF Generator scored 78% 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: 5.9.2
  • 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

100+ active / 3,194 total downloads

Benchmarks

Plugin footprint 83% 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.07MB] [CPU: ▼298.23ms] Passed 4 tests

A check of server-side resources used by Advanced PDF Generator
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /3.57 ▲0.0552.48 ▲1.13
Dashboard /wp-admin3.49 ▲0.0932.29 ▼2.41
Posts /wp-admin/edit.php3.70 ▲0.0637.36 ▲0.97
Add New Post /wp-admin/post-new.php7.28 ▲0.3285.10 ▼1,188.64
Media Library /wp-admin/upload.php3.38 ▲0.0921.03 ▼2.85

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

A short overview of filesystem and database impact
The plugin installed successfully
Filesystem: 152 new files
Database: 1 new table, no new options
New tables
wp_apdfg_values

Browser metrics Passed 4 tests

Checking browser requirements for Advanced PDF Generator
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,937 ▲19316.41 ▲0.3910.42 ▲3.723.15 ▲0.70
Dashboard /wp-admin2,916 ▲586.29 ▲0.13117.18 ▼17.97159.10 ▼4.82
Posts /wp-admin/edit.php2,715 ▲213.24 ▲0.0070.49 ▲6.95142.31 ▼2.10
Add New Post /wp-admin/post-new.php1,678 ▲1816.48 ▲0.44411.69 ▼7.19151.09 ▼4.82
Media Library /wp-admin/upload.php1,723 ▲255.53 ▲0.01145.21 ▼5.09186.52 ▲4.48

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

🔸 Tests weight: 35 | All plugins must uninstall correctly, removing their source code and extra database tables they might have created
It is recommended to fix the following
  • The plugin did not uninstall successfully, leaving 1 table in the database
    • wp_apdfg_values

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 | 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 fix the following
  • 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 server-side errors or warnings when accessed directly (only 10 are shown):
    • > 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\\Renderer\\AbstractRenderer' not found in wp-content/plugins/advanced-pdf-generator/public/libs/dompdf/src/Renderer/ListBullet.php:23
    • > PHP Fatal error
      Uncaught Error: Class 'Dompdf\\FrameReflower\\AbstractFrameReflower' not found in wp-content/plugins/advanced-pdf-generator/public/libs/dompdf/src/FrameReflower/ListBullet.php:18
    • > 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
    • > PHP Fatal error
      Uncaught Error: Class 'Dompdf\\FrameReflower\\AbstractFrameReflower' not found in wp-content/plugins/advanced-pdf-generator/public/libs/dompdf/src/FrameReflower/NullFrameReflower.php:19
    • > 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 488
    • > PHP Fatal error
      Uncaught Error: Class 'Dompdf\\Positioner\\AbstractPositioner' not found in wp-content/plugins/advanced-pdf-generator/public/libs/dompdf/src/Positioner/Block.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/Page.php:24
    • > PHP Notice
      Undefined variable: values in wp-content/plugins/advanced-pdf-generator/admin/partials/advanced-pdf-generator-admin-display.php on line 38
    • > PHP Notice
      Undefined variable: values in wp-content/plugins/advanced-pdf-generator/admin/partials/advanced-pdf-generator-admin-display.php on line 21

User-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
No browser errors were detected

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 94% from 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
Attributes that need to be fixed: You can take inspiration from this readme.txt

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

The entry point to "Advanced PDF Generator" version 0.4.0 is a PHP file that has certain tags in its header comment area
Please take the time 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 | A short review of files and their extensions; it is not recommended to include executable files
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

Cyclomatic complexity and code structure are the fingerprint of this plugin
The following items need your attention
  • Cyclomatic complexity of methods 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

PNG files should be compressed to save space and 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%