77% post-to-pdf

Code Review | Post to Pdf

WordPress plugin Post to Pdf scored77%from 54 tests.

About plugin

  • Plugin page: post-to-pdf
  • Plugin version: 1.0
  • PHP version: 7.4.16
  • WordPress version: 6.3.1
  • First release: May 5, 2021
  • Latest release: Apr 23, 2023
  • Number of updates: 11
  • Update frequency: every 65.4 days
  • Top authors: gravitymaster97 (100%)

Code review

54 tests

User reviews

1 review

Install metrics

100+ active /1,874 total downloads

Benchmarks

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

Analyzing server-side resources used by Post to Pdf
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /3.53 ▲0.0739.55 ▲5.45
Dashboard /wp-admin3.37 ▲0.0345.11 ▼12.21
Posts /wp-admin/edit.php3.48 ▲0.1344.66 ▼1.21
Add New Post /wp-admin/post-new.php5.97 ▲0.0891.99 ▼8.66
Media Library /wp-admin/upload.php3.29 ▲0.0635.44 ▲4.29

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

Input-output and database impact of this plugin
No storage issues were detected
Filesystem: 337 new files
Database: no new tables, 17 new options
New WordPress options
widget_theysaidso_widget
can_compress_scripts
gmptp_single_display_location
gmpcp_show_hide
gmptp_shop_display_location
theysaidso_admin_options
gmpcp_background_color
gmptp_shop_button_text
gmpcp_footer_text
gmpcp_hf_background_color
...

Browser metrics Passed 4 tests

Post to Pdf: an overview of browser usage
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,837 ▲9113.80 ▼0.851.78 ▲0.0537.56 ▼2.41
Dashboard /wp-admin2,243 ▲575.16 ▲0.25105.04 ▼3.0540.04 ▼5.21
Posts /wp-admin/edit.php2,125 ▲362.34 ▲0.2835.72 ▼1.3532.14 ▲1.41
Add New Post /wp-admin/post-new.php1,552 ▲1918.59 ▼4.62613.21 ▼23.4135.35 ▼17.55
Media Library /wp-admin/upload.php1,422 ▲314.47 ▲0.24101.14 ▲7.0643.82 ▲0.01

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
The following items require your attention
  • The uninstall procedure has failed, leaving 17 options in the database
    • gmpcp_show_hide
    • db_upgraded
    • gmptp_single_button_text
    • gmpcp_header_text
    • gmpcp_footer_text
    • gmpcp_hf_background_color
    • gmpcp_background_color
    • gmptp_single_display_location
    • theysaidso_admin_options
    • gmptp_shop_button_text
    • ...

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for server-side errors
Even though everything seems fine, this is not an exhaustive test

SRP 0% from 2 tests

🔹 Tests weight: 20 | A shallow check of the single-responsibility principle; PHP files should perform no action - including output of placeholder text - and trigger no errors when accessed directly
Please fix the following items
  • 2× PHP files perform the task of outputting text when accessed with GET requests:
    • > /wp-content/plugins/post-to-pdf/dompdf-master/demo.php
    • > /wp-content/plugins/post-to-pdf/dompdf-master/lib/php-css-parser/tests/quickdump.php
  • 188× PHP files trigger server-side errors or warnings when accessed directly (only 10 are shown):
    • > PHP Notice
      Undefined variable: fontDir in wp-content/plugins/post-to-pdf/dompdf-master/lib/fonts/dompdf_font_family_cache.php on line 77
    • > PHP Fatal error
      Uncaught Error: Class 'Dompdf\\FrameReflower\\AbstractFrameReflower' not found in wp-content/plugins/post-to-pdf/dompdf-master/src/FrameReflower/Text.php:21
    • > PHP Notice
      Undefined variable: fontDir in wp-content/plugins/post-to-pdf/dompdf-master/lib/fonts/dompdf_font_family_cache.php on line 6
    • > PHP Notice
      Undefined variable: fontDir in wp-content/plugins/post-to-pdf/dompdf-master/lib/fonts/dompdf_font_family_cache.php on line 78
    • > PHP Notice
      Undefined variable: fontDir in wp-content/plugins/post-to-pdf/dompdf-master/lib/fonts/dompdf_font_family_cache.php on line 72
    • > PHP Fatal error
      Uncaught Error: Class 'Dompdf\\FrameDecorator\\AbstractFrameDecorator' not found in wp-content/plugins/post-to-pdf/dompdf-master/src/FrameDecorator/Image.php:20
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit_Framework_TestCase' not found in wp-content/plugins/post-to-pdf/dompdf-master/lib/php-svg-lib/tests/Svg/StyleTest.php:15
    • > PHP Notice
      Undefined variable: fontDir in wp-content/plugins/post-to-pdf/dompdf-master/lib/fonts/dompdf_font_family_cache.php on line 21
    • > PHP Fatal error
      Uncaught Error: Interface 'Dompdf\\Canvas' not found in wp-content/plugins/post-to-pdf/dompdf-master/src/Adapter/GD.php:24
    • > PHP Fatal error
      Uncaught Error: Class 'Sabberworm\\CSS\\Value\\PrimitiveValue' not found in wp-content/plugins/post-to-pdf/dompdf-master/lib/php-css-parser/lib/Sabberworm/CSS/Value/CSSString.php:5

User-side errors Passed 1 test

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

Optimizations

Plugin configuration 87% from 29 tests

readme.txt 88% from 16 tests

The readme.txt file is undoubtedly the most important file in your plugin, preparing it for public listing on WordPress.org
Attributes that require attention:
  • Screenshots: These screenshots need descriptions #1, #2, #3, #4 in post-to-pdf/assets to your readme.txt
  • Contributors: Plugin contributors not specified
The official readme.txt is a good inspiration

post-to-pdf/post-catalog-pdf.php 85% from 13 tests

This is the main PHP file of "Post to Pdf" version 1.0, providing information about the plugin in the header fields and serving as the principal entry point to the plugin's functions
You should first fix the following items:
  • Main file name: Name the main plugin file the same as the plugin slug ("post-to-pdf.php" instead of "post-catalog-pdf.php")
  • Text Domain: You no longer need to specify the text domain since WordPress 4.6; it must be the same as the plugin slug

Code Analysis 97% from 3 tests

File types Passed 1 test

🔸 Test weight: 35 | Executable files are considered dangerous and should not be included with any WordPress plugin
Everything looks great! No dangerous files found in this plugin53,036 lines of code in 257 files:
LanguageFilesBlank linesComment linesLines of code
PHP2058,57715,38151,390
CSS3213560707
Markdown41810707
JSON40091
YAML416363
XML43046
HTML10017
SVG1008
JavaScript2107

PHP code 50% from 2 tests

This is a very shot review of cyclomatic complexity and code structure
Please tend to the following items
  • Cyclomatic complexity of methods should be reduced to less than 100 (currently 652)
Cyclomatic complexity
Average complexity per logical line of code0.42
Average class complexity36.49
▷ Minimum class complexity1.00
▷ Maximum class complexity797.00
Average method complexity4.37
▷ Minimum method complexity1.00
▷ Maximum method complexity652.00
Code structure
Namespaces33
Interfaces5
Traits0
Classes181
▷ Abstract classes126.63%
▷ Concrete classes16993.37%
▷ Final classes00.00%
Methods2,026
▷ Static methods803.95%
▷ Public methods1,72385.04%
▷ Protected methods21010.37%
▷ Private methods934.59%
Functions16
▷ Named functions16.25%
▷ Anonymous functions1593.75%
Constants178
▷ Global constants63.37%
▷ Class constants17296.63%
▷ Public constants172100.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
dompdf-master/lib/res/broken_image.png0.60KB0.47KB▼ 22.33%