62% blog-as-pdf

Code Review | Blog as PDF

WordPress plugin Blog as PDF scored 62% from 54 tests.

About plugin

  • Plugin page: blog-as-pdf
  • Plugin version: 1.2
  • PHP version: 7.4.16
  • WordPress compatibility: 4.0-5.3
  • WordPress version: 5.8.1
  • First release: Oct 12, 2009
  • Latest release: Nov 19, 2019
  • Number of updates: 34
  • Update frequency: every 108.5 days
  • Top authors: insistimento (58.82%)rezehnde (44.12%)

Code review

54 tests

User reviews

1 review

Install metrics

100+ active / 7,440 total downloads

Benchmarks

Plugin footprint 82% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | It is important to correctly install your plugin, without throwing errors or notices
This plugin's installer ran successfully

Server metrics [RAM: ▼0.91MB] [CPU: ▼174.59ms] Passed 4 tests

Server-side resources used by Blog as PDF
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /2.84 ▲0.0134.16 ▲7.16
Dashboard /wp-admin2.74 ▼0.3119.95 ▼29.42
Posts /wp-admin/edit.php2.74 ▼0.3621.51 ▼21.22
Add New Post /wp-admin/post-new.php2.74 ▼2.6924.26 ▼634.62
Media Library /wp-admin/upload.php2.74 ▼0.2620.01 ▼13.10
Blog as PDF /wp-admin/options-general.php?page=blog-as-pdf/blog-as-pdf.php2.7422.00

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

Analyzing filesystem and database footprints of this plugin
Please try to fix the following items
  • Try to limit filesystem usage to 25MB (currently using 30.69MB)
Filesystem: 390 new files
Database: no new tables, no new options

Browser metrics Passed 4 tests

A check of browser resources used by Blog as PDF
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,684 ▲8815.98 ▲0.359.86 ▼0.5450.11 ▲3.78
Dashboard /wp-admin2,978 ▲415.94 ▼0.07148.44 ▼0.89106.89 ▲3.40
Posts /wp-admin/edit.php2,744 ▲52.72 ▼0.0163.69 ▼4.3487.79 ▼6.98
Add New Post /wp-admin/post-new.php1,503 ▲518.59 ▼0.23374.14 ▼48.74104.72 ▼2.54
Media Library /wp-admin/upload.php1,812 ▲55.06 ▲0.06150.54 ▼1.70117.67 ▲7.29
Blog as PDF /wp-admin/options-general.php?page=blog-as-pdf/blog-as-pdf.php1,0702.0654.8879.06

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
These items require your attention
  • This plugin cannot be uninstalled
    • > User deprecated in wp-includes/functions.php+5495
    has_cap was called with an argument that is deprecated since version 2.0.0! Usage of user levels is deprecated. Use capabilities instead.

Smoke tests 25% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | A shallow check that no server-side errors were triggered
These errors were triggered by the plugin
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/options-general.php?page=blog-as-pdf/blog-as-pdf.php
    • > User deprecated in wp-includes/functions.php+5495
    has_cap was called with an argument that is deprecated since version 2.0.0! Usage of user levels is deprecated. Use capabilities instead.

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
  • 83× PHP files output text when accessed directly (only 10 are shown):
    • > /wp-content/plugins/blog-as-pdf/tcpdf/examples/example_061.php
    • > /wp-content/plugins/blog-as-pdf/tcpdf/examples/example_055.php
    • > /wp-content/plugins/blog-as-pdf/tcpdf/examples/barcodes/example_2d_datamatrix_png.php
    • > /wp-content/plugins/blog-as-pdf/tcpdf/examples/example_002.php
    • > /wp-content/plugins/blog-as-pdf/tcpdf/examples/example_062.php
    • > /wp-content/plugins/blog-as-pdf/tcpdf/examples/example_028.php
    • > /wp-content/plugins/blog-as-pdf/tcpdf/examples/barcodes/example_2d_qrcode_svgi.php
    • > /wp-content/plugins/blog-as-pdf/tcpdf/examples/example_046.php
    • > /wp-content/plugins/blog-as-pdf/tcpdf/examples/example_033.php
    • > /wp-content/plugins/blog-as-pdf/tcpdf/examples/barcodes/example_1d_svg.php
  • 84× PHP files trigger server errors when accessed directly (only 10 are shown):
    • > PHP Warning
      chr() expects parameter 1 to be int, string given in wp-content/plugins/blog-as-pdf/tcpdf/include/tcpdf_fonts.php on line 1671
    • > PHP Notice
      Trying to access array offset on value of type int in wp-content/plugins/blog-as-pdf/tcpdf/tcpdf.php on line 4701
    • > PHP Warning
      chr() expects parameter 1 to be int, string given in wp-content/plugins/blog-as-pdf/tcpdf/include/tcpdf_fonts.php on line 1671
    • > PHP Warning
      chr() expects parameter 1 to be int, string given in wp-content/plugins/blog-as-pdf/tcpdf/include/tcpdf_fonts.php on line 1671
    • > PHP Notice
      Trying to access array offset on value of type int in wp-content/plugins/blog-as-pdf/tcpdf/tcpdf.php on line 12327
    • > PHP Warning
      chr() expects parameter 1 to be int, string given in wp-content/plugins/blog-as-pdf/tcpdf/include/tcpdf_fonts.php on line 1671
    • > PHP Warning
      chr() expects parameter 1 to be int, string given in wp-content/plugins/blog-as-pdf/tcpdf/include/tcpdf_fonts.php on line 1671
    • > PHP Warning
      chr() expects parameter 1 to be int, string given in wp-content/plugins/blog-as-pdf/tcpdf/include/tcpdf_fonts.php on line 1671
    • > PHP Warning
      chr() expects parameter 1 to be int, string given in wp-content/plugins/blog-as-pdf/tcpdf/include/tcpdf_fonts.php on line 1671
    • > PHP Notice
      Trying to access array offset on value of type int in wp-content/plugins/blog-as-pdf/tcpdf/tcpdf.php on line 4701

User-side errors Passed 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
There were no browser issues found

Optimizations

Plugin configuration Passed 29 tests

readme.txt Passed 16 tests

The readme.txt file is undoubtedly the most important file in your plugin, preparing it for public listing on WordPress.org
3 plugin tags: ebook, posts, pdf

blog-as-pdf/blog-as-pdf.php Passed 13 tests

Analyzing the main PHP file in "Blog as PDF" version 1.2
57 characters long description:
Export posts from your wordpress blog as PDF. Choose some

Code Analysis 0% from 3 tests

File types 0% from 1 test

🔸 Test weight: 35 | A short check of programming languages and file extensions; no executable files are allowed
These items require your attention
  • You should never include executable (binary) or otherwise dangerous files in your plugin
    • .crt - Security Certificate in Firefox, IE, Chrome, Safari
      • wp-content/plugins/blog-as-pdf/tcpdf/examples/data/cert/tcpdf.crt
53,516 lines of code in 234 files:
LanguageFilesBlank linesComment linesLines of code
PHP2293,95217,59451,524
SVG3111,882
Markdown121063
JSON10047

PHP code 0% from 2 tests

A brief analysis of cyclomatic complexity and code structure for this plugin
Please tend to the following items
  • Cyclomatic complexity of classes should be reduced to less than 1000 (currently 4,368)
  • Cyclomatic complexity of methods should be reduced to less than 100 (currently 502)
Cyclomatic complexity
Average complexity per logical line of code0.36
Average class complexity322.50
▷ Minimum class complexity1.00
▷ Maximum class complexity4,368.00
Average method complexity10.03
▷ Minimum method complexity1.00
▷ Maximum method complexity502.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes20
▷ Abstract classes00.00%
▷ Concrete classes20100.00%
▷ Final classes00.00%
Methods712
▷ Static methods10915.31%
▷ Public methods43661.24%
▷ Protected methods27638.76%
▷ Private methods00.00%
Functions4
▷ Named functions4100.00%
▷ Anonymous functions00.00%
Constants138
▷ Global constants138100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

It is recommended to compress PNG files in your plugin to minimize bandwidth usage
10 PNG files occupy 0.58MB with 0.18MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
tcpdf/examples/images/img.png190.57KB64.69KB▼ 66.06%
images/error.png0.68KB0.72KB0.00%
tcpdf/examples/images/_blank.png0.13KB0.09KB▼ 30.66%
tcpdf/examples/images/alpha.png23.33KB30.34KB0.00%
images/twitter.png14.50KB5.94KB▼ 59.07%