61% pdf-print

Code Review | PDF & Print by BestWebSoft - WordPress Posts and Pages PDF Generator Plugin

WordPress plugin PDF & Print by BestWebSoft - WordPress Posts and Pages PDF Generator Plugin scored61%from 54 tests.

About plugin

  • Plugin page: pdf-print
  • Plugin version: 2.3.4
  • PHP version: 7.4.16
  • WordPress compatibility: 5.6-6.4.1
  • WordPress version: 6.3.1
  • First release: Nov 1, 2013
  • Latest release: Dec 1, 2023
  • Number of updates: 75
  • Update frequency: every 49.1 days
  • Top authors: bestwebsoft (100%)

Code review

54 tests

User reviews

98 reviews

Install metrics

10,000+ active /519,455 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
Install script ran successfully

Server metrics [RAM: ▲0.75MB] [CPU: ▼8.93ms] Passed 4 tests

A check of server-side resources used by PDF & Print by BestWebSoft - WordPress Posts and Pages PDF Generator Plugin
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /5.08 ▲1.6253.20 ▲13.29
Dashboard /wp-admin4.42 ▲1.0754.39 ▼5.54
Posts /wp-admin/edit.php4.47 ▲1.1155.14 ▲9.16
Add New Post /wp-admin/post-new.php5.64 ▼0.2549.18 ▼52.61
Media Library /wp-admin/upload.php4.28 ▲1.0545.30 ▲13.31

Server storage [IO: ▲28.04MB] [DB: ▲0.07MB] 67% from 3 tests

Input-output and database impact of this plugin
Just a few items left to fix
  • The filesystem usage should be lower than 25MB (currently using 28.04MB)
Filesystem: 703 new files
Database: no new tables, 9 new options
New WordPress options
widget_recent-comments
widget_recent-posts
can_compress_scripts
widget_theysaidso_widget
bstwbsftwppdtplgns_options
theysaidso_admin_options
widget_pdfprnt_buttons
pdfprnt_options
db_upgraded

Browser metrics Passed 4 tests

A check of browser resources used by PDF & Print by BestWebSoft - WordPress Posts and Pages PDF Generator Plugin
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,916 ▲16914.34 ▼0.011.59 ▼0.1337.34 ▼6.87
Dashboard /wp-admin2,309 ▲1285.62 ▼0.1197.93 ▼14.4543.49 ▲0.13
Posts /wp-admin/edit.php2,227 ▲1272.19 ▲0.1939.75 ▲1.4936.00 ▲2.39
Add New Post /wp-admin/post-new.php1,643 ▲11723.40 ▲0.45690.82 ▲105.4061.72 ▲18.89
Media Library /wp-admin/upload.php1,517 ▲1174.20 ▲0.0396.02 ▲0.3742.90 ▲1.03
Headers & Footers /wp-admin/pdf-print-templates.php260.410.1216.68
Settings /wp-admin/pdf-print.php260.410.076.82
BWS Panel /wp-admin/pdf-print.php?page=pdfprnt-bws-panel260.410.085.69

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
You still need to fix the following
  • This plugin cannot be uninstalled
    • > Warning in wp-content/plugins/pdf-print/pdf-print.php+2004
    array_key_exists(): The first argument should be either a string or an integer
  • Zombie WordPress options were found after uninstall: 6 options
    • widget_recent-comments
    • widget_theysaidso_widget
    • theysaidso_admin_options
    • db_upgraded
    • widget_recent-posts
    • can_compress_scripts

Smoke tests 25% 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
Please fix the following
  • 5× PHP files perform the action of outputting non-empty strings when accessed directly:
    • > /wp-content/plugins/pdf-print/mpdf/compress.php
    • > /wp-content/plugins/pdf-print/mpdf/utils/image_details.php
    • > /wp-content/plugins/pdf-print/mpdf/qrcode/image.php
    • > /wp-content/plugins/pdf-print/mpdf/qrcode/index.php
    • > /wp-content/plugins/pdf-print/mpdf/utils/index.php
  • 50× GET requests to PHP files trigger server-side errors or Error 500 responses (only 10 are shown):
    • > PHP Warning
      include_once(): Failed opening '_JPGRAPH_PATHjpgraph_line.php' for inclusion (include_path='.:/usr/share/php') in wp-content/plugins/pdf-print/mpdf/graph.php on line 24
    • > PHP Warning
      Use of undefined constant _JPGRAPH_PATH - assumed '_JPGRAPH_PATH' (this will throw an Error in a future version of PHP) in wp-content/plugins/pdf-print/mpdf/graph.php on line 23
    • > PHP Fatal error
      Uncaught MpdfException: mPDF Error - cannot find TTF TrueType font file - wp-content/plugins/pdf-print/mpdf/ttfonts/DejaVuSerifCondensed.ttf in /var/www/wordpress/wp-content/plugins/pdf-print/mpdf/mpdf.php:3843
    • > PHP Fatal error
      Uncaught Error: Using $this when not in object context in wp-content/plugins/pdf-print/mpdf/config.php:4
    • > PHP Warning
      include_once(_JPGRAPH_PATHjpgraph_bar.php): failed to open stream: No such file or directory in wp-content/plugins/pdf-print/mpdf/graph.php on line 30
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/pdf-print/bws_menu/class-bws-settings.php:1452
    • > PHP Fatal error
      Uncaught Error: Class 'UCDN' not found in wp-content/plugins/pdf-print/mpdf/config_script2lang.php:5
    • > PHP Fatal error
      Uncaught Error: Class 'FPDF' not found in wp-content/plugins/pdf-print/mpdf/vendor/setasign/fpdi/fpdi_bridge.php:23
    • > PHP Warning
      Use of undefined constant _JPGRAPH_PATH - assumed '_JPGRAPH_PATH' (this will throw an Error in a future version of PHP) in wp-content/plugins/pdf-print/mpdf/graph.php on line 27
    • > PHP Warning
      include_once(_JPGRAPH_PATHjpgraph.php): failed to open stream: No such file or directory in wp-content/plugins/pdf-print/mpdf/graph.php on line 23

User-side errors 0% from 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
Please fix the following user-side errors
    • > GET request to /wp-admin/pdf-print-templates.php
    • > Network (severe)
    wp-admin/pdf-print-templates.php - Failed to load resource: the server responded with a status of 404 (Not Found)
    • > GET request to /wp-admin/pdf-print.php
    • > Network (severe)
    wp-admin/pdf-print.php - Failed to load resource: the server responded with a status of 404 (Not Found)
    • > GET request to /wp-admin/pdf-print.php?page=pdfprnt-bws-panel
    • > Network (severe)
    wp-admin/pdf-print.php?page=pdfprnt-bws-panel - Failed to load resource: the server responded with a status of 404 (Not Found)

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 88% 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
Please fix the following attributes:
  • Screenshots: These screenshots have no corresponding images in /assets: #1 (Displaying PDF&Print buttons in the post on your WordPress website.), #2 (Displaying PDF&Print buttons on archive page of your WordPress website.), #3 (Displaying PDF&Print buttons in widget.), #4 (Printing output page example.), #5 (PDF output page example.), #6 (Settings page (Settings tab) for the PDF&Print in admin panel.), #7 (Settings page (Output tab) for the PDF&Print in admin panel.)
  • Tags: Please delete some tags, you are using 12 tag instead of maximum 10
You can look at the official readme.txt

pdf-print/pdf-print.php Passed 13 tests

The main PHP script in "PDF & Print by BestWebSoft - WordPress Posts and Pages PDF Generator Plugin" version 2.3.4 is automatically included on every request by WordPress
107 characters long description:
Generate PDF files and print WordPress posts/pages. Customize document header/footer styles and appearance.

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 plugin127,609 lines of code in 188 files:
LanguageFilesBlank linesComment linesLines of code
PHP1387,6889,70079,294
JavaScript114,4195,11524,276
PO File167,41513,39817,408
CSS162542986,335
SVG400150
JSON20083
Markdown124063

PHP code 0% from 2 tests

An short overview of logical lines of code, cyclomatic complexity, and other code metrics
The following items need your attention
  • Cyclomatic complexity of classes has to be reduced to less than 1000 (currently 8,315)
  • Method cyclomatic complexity should be reduced to less than 100 (currently 1,542)
Cyclomatic complexity
Average complexity per logical line of code0.53
Average class complexity397.76
▷ Minimum class complexity1.00
▷ Maximum class complexity8,315.00
Average method complexity20.72
▷ Minimum method complexity1.00
▷ Maximum method complexity1,542.00
Code structure
Namespaces1
Interfaces0
Traits0
Classes45
▷ Abstract classes00.00%
▷ Concrete classes45100.00%
▷ Final classes00.00%
Methods905
▷ Static methods697.62%
▷ Public methods84693.48%
▷ Protected methods465.08%
▷ Private methods131.44%
Functions136
▷ Named functions136100.00%
▷ Anonymous functions00.00%
Constants379
▷ Global constants5514.51%
▷ Class constants32485.49%
▷ Public constants324100.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

PNG files should be compressed to save space and minimize bandwidth usage
71 PNG files occupy 5.24MB with 2.19MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
bws_menu/css/jquery-ui-styles/1.12.1/images/ui-icons_888888_256x240.png6.94KB4.18KB▼ 39.78%
bws_menu/css/jquery-ui-styles/1.10.4/images/ui-bg_highlight-soft_75_cccccc_1x100.png0.32KB0.21KB▼ 34.34%
bws_menu/icons/themes/renty.png657.95KB198.11KB▼ 69.89%
screenshot-2.png360.89KB149.33KB▼ 58.62%
bws_menu/css/jquery-ui-styles/1.10.4/images/ui-icons_cd0a0a_256x240.png4.49KB4.20KB▼ 6.46%