67% simple-pdf-exporter

Code Review | Simple PDF Exporter

WordPress plugin Simple PDF Exporter scored67%from 54 tests.

About plugin

  • Plugin page: simple-pdf-exporter
  • Plugin version: 2.0
  • PHP version: 7.4.16
  • WordPress version: 6.3.1
  • First release: Mar 6, 2016
  • Latest release: Jan 13, 2023
  • Number of updates: 75
  • Update frequency: every 33.4 days
  • Top authors: Dukessa (100%)

Code review

54 tests

User reviews

4 reviews

Install metrics

300+ active /11,204 total downloads

Benchmarks

Plugin footprint 65% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | It is important to correctly install your plugin, without throwing errors or notices
The plugin installed gracefully, with no errors

Server metrics [RAM: ▲0.05MB] [CPU: ▼3.74ms] Passed 4 tests

Server-side resources used by Simple PDF Exporter
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /3.52 ▲0.0638.40 ▲2.66
Dashboard /wp-admin3.35 ▲0.0543.08 ▼2.59
Posts /wp-admin/edit.php3.40 ▲0.0542.99 ▼9.72
Add New Post /wp-admin/post-new.php5.93 ▲0.0587.97 ▼5.32
Media Library /wp-admin/upload.php3.27 ▲0.0537.42 ▲6.03
PDF Export /wp-admin/tools.php?page=simple_pdf_export_settings3.2431.45

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

A short overview of filesystem and database impact
It is recommended to fix the following issues
  • Try to limit filesystem usage to 25MB (currently using 38.88MB)
Filesystem: 630 new files
Database: no new tables, 6 new options
New WordPress options
can_compress_scripts
widget_theysaidso_widget
theysaidso_admin_options
widget_recent-posts
widget_recent-comments
db_upgraded

Browser metrics Passed 4 tests

Checking browser requirements for Simple PDF Exporter
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,804 ▲5813.13 ▼1.272.19 ▲0.5343.66 ▲2.24
Dashboard /wp-admin2,210 ▲224.80 ▼1.03100.68 ▼4.5238.71 ▼6.08
Posts /wp-admin/edit.php2,093 ▲12.02 ▲0.0635.49 ▼3.1335.20 ▼1.88
Add New Post /wp-admin/post-new.php1,536 ▲823.16 ▲4.84677.91 ▲44.5564.06 ▲10.22
Media Library /wp-admin/upload.php1,389 ▲14.25 ▲0.0894.02 ▼10.4843.07 ▼2.54
PDF Export /wp-admin/tools.php?page=simple_pdf_export_settings8412.0424.4226.26

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
It is recommended to fix the following
  • The plugin did not uninstall gracefully
    • > Warning in wp-content/plugins/simple-pdf-exporter/simple-pdf-exporter.php+128
    rmdir(wp-content/uploads/pdf-export//pdf): Directory not empty
  • Zombie WordPress options detected upon uninstall: 6 options
    • can_compress_scripts
    • theysaidso_admin_options
    • db_upgraded
    • widget_recent-posts
    • widget_theysaidso_widget
    • widget_recent-comments

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)
Everything seems fine, however this is by no means an exhaustive test

SRP 0% from 2 tests

🔹 Tests weight: 20 | The single-responsibility principle: PHP files have to remain inert when accessed directly, throwing no errors and performing no actions
The following issues need your attention
  • 2× GET requests to PHP files return non-empty strings:
    • > /wp-content/plugins/simple-pdf-exporter/libs/dompdf/vendor/masterminds/html5/bin/entities.php
    • > /wp-content/plugins/simple-pdf-exporter/libs/pdfmerger/tcpdf/tools/tcpdf_addfont.php
  • 182× GET requests to PHP files have triggered server-side errors or warnings (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'FPDF' not found in wp-content/plugins/simple-pdf-exporter/libs/fpdi/src/FpdfTpl.php:19
    • > PHP Fatal error
      Uncaught Error: Class 'Svg\\Tag\\Shape' not found in wp-content/plugins/simple-pdf-exporter/libs/dompdf/vendor/phenx/php-svg-lib/src/Svg/Tag/Text.php:13
    • > PHP Fatal error
      Uncaught Error: Class 'Sabberworm\\CSS\\Value\\CSSFunction' not found in wp-content/plugins/simple-pdf-exporter/libs/dompdf/vendor/sabberworm/php-css-parser/src/Value/Color.php:10
    • > PHP Warning
      include(): Failed opening 'PDFMerger.php' for inclusion (include_path='.:/usr/share/php') in wp-content/plugins/simple-pdf-exporter/libs/pdfmerger/sample.php on line 2
    • > PHP Fatal error
      Uncaught Error: Class 'Dompdf\\FrameDecorator\\AbstractFrameDecorator' not found in wp-content/plugins/simple-pdf-exporter/libs/dompdf/vendor/dompdf/dompdf/src/FrameDecorator/NullFrameDecorator.php:17
    • > PHP Fatal error
      Uncaught Error: Class 'Sabberworm\\CSS\\CSSList\\CSSBlockList' not found in wp-content/plugins/simple-pdf-exporter/libs/dompdf/vendor/sabberworm/php-css-parser/src/CSSList/AtRuleBlockList.php:11
    • > PHP Fatal error
      Uncaught Error: Class 'Dompdf\\Positioner\\AbstractPositioner' not found in wp-content/plugins/simple-pdf-exporter/libs/dompdf/vendor/dompdf/dompdf/src/Positioner/TableRow.php:16
    • > PHP Fatal error
      Uncaught Error: Class 'FontLib\\BinaryStream' not found in wp-content/plugins/simple-pdf-exporter/libs/dompdf/vendor/phenx/php-font-lib/src/FontLib/Glyph/Outline.php:20
    • > PHP Fatal error
      Uncaught Error: Interface 'Sabberworm\\CSS\\Property\\AtRule' not found in wp-content/plugins/simple-pdf-exporter/libs/dompdf/vendor/sabberworm/php-css-parser/src/Property/CSSNamespace.php:11
    • > PHP Fatal error
      Uncaught Error: Class 'setasign\\Fpdi\\PdfParser\\Type\\PdfType' not found in wp-content/plugins/simple-pdf-exporter/libs/fpdi/src/PdfParser/Type/PdfArray.php:21

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 97% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file describes your plugin functionality and requirements and it is parsed to prepare the your plugin's listing
These attributes need to be fixed:
  • Requires at least: Invalid plugin version format
You can look at the official readme.txt

simple-pdf-exporter/simple-pdf-exporter.php Passed 13 tests

This is the main PHP file of "Simple PDF Exporter" version 2.0, providing information about the plugin in the header fields and serving as the principal entry point to the plugin's functions
123 characters long description:
Export in a single PDF, all posts, a single one, or a custom post type. Requires at least 512MB of free RAM on your server.

Code Analysis 95% from 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short check of programming languages and file extensions; no executable files are allowed
Everything looks great! No dangerous files found in this plugin97,832 lines of code in 407 files:
LanguageFilesBlank linesComment linesLines of code
PHP37711,40831,87595,204
Markdown1444401,466
JSON1000686
CSS39436416
YAML19035
HTML10017
SVG1008

PHP code 0% from 2 tests

This is a short overview of cyclomatic complexity and code structure for this plugin
Please fix the following
  • Please reduce cyclomatic complexity of classes to less than 1000 (currently 4,349)
  • Method cyclomatic complexity has to be reduced to less than 100 (currently 499)
Cyclomatic complexity
Average complexity per logical line of code0.41
Average class complexity52.71
▷ Minimum class complexity1.00
▷ Maximum class complexity4,349.00
Average method complexity5.41
▷ Minimum method complexity1.00
▷ Maximum method complexity499.00
Code structure
Namespaces47
Interfaces11
Traits2
Classes257
▷ Abstract classes145.45%
▷ Concrete classes24394.55%
▷ Final classes00.00%
Methods3,267
▷ Static methods2858.72%
▷ Public methods2,43674.56%
▷ Protected methods76023.26%
▷ Private methods712.17%
Functions53
▷ Named functions2241.51%
▷ Anonymous functions3158.49%
Constants395
▷ Global constants14436.46%
▷ Class constants25163.54%
▷ Public constants24698.01%

Plugin size Passed 2 tests

Image compression Passed 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
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
libs/dompdf/vendor/dompdf/dompdf/lib/res/broken_image.png0.60KB0.47KB▼ 22.33%