51% wp-advanced-pdf

Code Review | WP Advanced PDF

WordPress plugin WP Advanced PDF scored51%from 54 tests.

About plugin

  • Plugin page: wp-advanced-pdf
  • Plugin version: 1.1.7
  • PHP version: 7.4.16
  • WordPress compatibility: 5.0-6.0
  • WordPress version: 6.3.1
  • First release: Apr 2, 2016
  • Latest release: Jun 15, 2022
  • Number of updates: 53
  • Update frequency: every 42.8 days
  • Top authors: cedcommerce (100%)

Code review

54 tests

User reviews

18 reviews

Install metrics

1,000+ active /51,572 total downloads

Benchmarks

Plugin footprint 65% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
The plugin installed successfully, without throwing any errors or notices

Server metrics [RAM: ▲0.16MB] [CPU: ▼22.54ms] Passed 4 tests

Analyzing server-side resources used by WP Advanced PDF
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /3.84 ▲0.3842.76 ▼0.50
Dashboard /wp-admin3.51 ▲0.1632.45 ▼33.45
Posts /wp-admin/edit.php3.59 ▲0.2337.27 ▼18.58
Add New Post /wp-admin/post-new.php5.82 ▼0.0774.42 ▼33.17
Media Library /wp-admin/upload.php3.53 ▲0.3033.65 ▼4.97
WP Advanced PDF /wp-admin/options-general.php?page=wp-advanced-pdf/wp-advanced-pdf.php3.4929.28

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

Analyzing filesystem and database footprints of this plugin
These are issues you should consider
  • Total filesystem usage should be limited to 25MB (currently using 28.01MB)
Filesystem: 401 new files
Database: 1 new table, 8 new options
New tables
wp_ExporttoPDFRecord
New WordPress options
db_upgraded
widget_recent-comments
Export_db_version
widget_theysaidso_widget
widget_recent-posts
can_compress_scripts
theysaidso_admin_options
ptpdf

Browser metrics Passed 4 tests

Checking browser requirements for WP Advanced PDF
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,930 ▲18413.90 ▼0.496.27 ▲4.4444.72 ▲1.11
Dashboard /wp-admin2,217 ▲295.28 ▼0.58112.75 ▲5.2540.32 ▲1.34
Posts /wp-admin/edit.php2,098 ▲62.41 ▲0.4242.16 ▲1.3835.51 ▼0.54
Add New Post /wp-admin/post-new.php1,528 ▼522.22 ▼1.06684.73 ▲69.4661.91 ▲1.04
Media Library /wp-admin/upload.php1,412 ▲304.63 ▲0.43102.58 ▼2.1743.85 ▼0.25
WP Advanced PDF /wp-admin/options-general.php?page=wp-advanced-pdf/wp-advanced-pdf.php4,1222.3045.5049.63

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

🔸 Tests weight: 35 | The uninstall procedure must remove all plugin files and extra database tables
You still need to fix the following
  • This plugin does not fully uninstall, leaving 1 table in the database
    • wp_ExporttoPDFRecord
  • This plugin does not fully uninstall, leaving 8 options in the database
    • Export_db_version
    • ptpdf
    • widget_theysaidso_widget
    • db_upgraded
    • theysaidso_admin_options
    • can_compress_scripts
    • widget_recent-comments
    • widget_recent-posts

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
Please fix the following server-side errors
    • > GET request to /wp-admin/options-general.php?page=wp-advanced-pdf/wp-advanced-pdf.php
    • > User notice in wp-includes/functions.php+5905
    Function WP_Scripts::localize was called incorrectly. The $l10n parameter must be an array. To pass arbitrary data to scripts, use the wp_add_inline_script() function instead. Please see Debugging in WordPress for more information. (This message was added in version 5.7.0.)
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/options-general.php?page=wp-advanced-pdf/wp-advanced-pdf.php
    • > Notice in wp-content/plugins/wp-advanced-pdf/libs/wpppdf-tab-general.php+362
    Undefined index: availability
  • 3 occurences, only the last one shown
    • > GET request to /wp-admin/options-general.php?page=wp-advanced-pdf/wp-advanced-pdf.php
    • > Notice in wp-content/plugins/wp-advanced-pdf/libs/wpppdf-tab-general.php+398
    Undefined index: cache_updation_sch
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/options-general.php?page=wp-advanced-pdf/wp-advanced-pdf.php
    • > Notice in wp-content/plugins/wp-advanced-pdf/libs/wpppdf-tab-general.php+409
    Undefined index: ced_file_name
  • 8 occurences, only the last one shown
    • > GET request to /wp-admin/options-general.php?page=wp-advanced-pdf/wp-advanced-pdf.php
    • > Notice in wp-content/plugins/wp-advanced-pdf/libs/wpppdf-tab-general.php+423
    Undefined index: authorDetail
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/options-general.php?page=wp-advanced-pdf/wp-advanced-pdf.php
    • > Notice in wp-content/plugins/wp-advanced-pdf/libs/wpppdf-tab-general.php+520
    Undefined index: link_button
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/options-general.php?page=wp-advanced-pdf/wp-advanced-pdf.php
    • > Notice in wp-content/plugins/wp-advanced-pdf/libs/wpppdf-tab-general.php+704
    Undefined index: page_header
  • 4 occurences, only the last one shown
    • > GET request to /wp-admin/options-general.php?page=wp-advanced-pdf/wp-advanced-pdf.php
    • > Notice in wp-content/plugins/wp-advanced-pdf/libs/wpppdf-tab-general.php+872
    Undefined index: footer_align
  • 14 occurences, only the last one shown
    • > GET request to /wp-admin/options-general.php?page=wp-advanced-pdf/wp-advanced-pdf.php
    • > Notice in wp-content/plugins/wp-advanced-pdf/libs/wpppdf-tab-general.php+909
    Undefined index: water_font

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 take a closer look at the following
  • 83× PHP files perform the action of outputting non-empty strings when accessed directly (only 10 are shown):
    • > /wp-content/plugins/wp-advanced-pdf/tcpdf_min/examples/example_013.php
    • > /wp-content/plugins/wp-advanced-pdf/tcpdf_min/examples/barcodes/example_2d_qrcode_svg.php
    • > /wp-content/plugins/wp-advanced-pdf/tcpdf_min/examples/example_012.php
    • > /wp-content/plugins/wp-advanced-pdf/tcpdf_min/examples/example_039.php
    • > /wp-content/plugins/wp-advanced-pdf/tcpdf_min/examples/example_028.php
    • > /wp-content/plugins/wp-advanced-pdf/tcpdf_min/examples/example_036.php
    • > /wp-content/plugins/wp-advanced-pdf/tcpdf_min/examples/example_024.php
    • > /wp-content/plugins/wp-advanced-pdf/tcpdf_min/tools/tcpdf_addfont.php
    • > /wp-content/plugins/wp-advanced-pdf/tcpdf_min/examples/barcodes/example_2d_qrcode_png.php
    • > /wp-content/plugins/wp-advanced-pdf/tcpdf_min/examples/example_054.php
  • 3× GET requests to PHP files trigger server-side errors or Error 500 responses:
    • > PHP Warning
      require_once(wp-content/plugins/wp-advanced-pdf/tcpdf_min/examples/../vendor/autoload.php): failed to open stream: No such file or directory in wp-content/plugins/wp-advanced-pdf/tcpdf_min/examples/example_066.php on line 20
    • > PHP Fatal error
      require_once(): Failed opening required 'wp-content/plugins/wp-advanced-pdf/tcpdf_min/examples/../vendor/autoload.php' (include_path='.:/usr/share/php') in wp-content/plugins/wp-advanced-pdf/tcpdf_min/examples/example_066.php on line 20
    • > PHP Fatal error
      Uncaught Error: Call to undefined function bcadd() in wp-content/plugins/wp-advanced-pdf/tcpdf_min/tcpdf_barcodes_1d.php:2080

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
Everything seems fine on the user side

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 94% 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 need to be fixed:
  • Tags: Please delete some tags, you are using 11 tag instead of maximum 10
You can take inspiration from this readme.txt

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

The primary PHP file in "WP Advanced PDF" version 1.1.7 is used by WordPress to initiate all plugin functionality
You should first fix the following items:
  • Description: Keep the plugin description shorter than 140 characters (currently 188 characters long)

Code Analysis 0% from 3 tests

File types 0% from 1 test

🔸 Test weight: 35 | An overview of files in this plugin; executable files are not allowed
Please make sure to remedy the following
  • Do not include executable or dangerous files in your plugin
    • .crt - Security Certificate in Firefox, IE, Chrome, Safari
      • wp-content/plugins/wp-advanced-pdf/tcpdf_min/examples/data/cert/tcpdf.crt
59,256 lines of code in 246 files:
LanguageFilesBlank linesComment linesLines of code
PHP2344,45718,24656,317
SVG3111,882
JavaScript34447364
PO File1147150349
CSS364234
Markdown121063
JSON10047

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,413)
  • Cyclomatic complexity of methods should be reduced to less than 100 (currently 502)
Cyclomatic complexity
Average complexity per logical line of code0.38
Average class complexity305.58
▷ Minimum class complexity1.00
▷ Maximum class complexity4,413.00
Average method complexity9.67
▷ Minimum method complexity1.00
▷ Maximum method complexity502.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes24
▷ Abstract classes00.00%
▷ Concrete classes24100.00%
▷ Final classes00.00%
Methods843
▷ Static methods11113.17%
▷ Public methods54965.12%
▷ Protected methods29434.88%
▷ Private methods00.00%
Functions7
▷ Named functions7100.00%
▷ Anonymous functions00.00%
Constants165
▷ Global constants165100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
12 PNG files occupy 0.65MB with 0.31MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
tcpdf_min/examples/images/image_with_alpha.png238.49KB61.71KB▼ 74.12%
tcpdf_min/examples/images/img.png190.57KB64.69KB▼ 66.06%
tcpdf_min/examples/images/logo_example.png18.96KB17.68KB▼ 6.71%
asset/images/pdf.png7.22KB3.39KB▼ 53.05%
asset/images/Windows-error.png19.72KB11.92KB▼ 39.54%