10% save-as-pdf

Code Review | Save as PDF Button

WordPress plugin Save as PDF Button scored10%from 54 tests.

About plugin

  • Plugin page: save-as-pdf
  • Plugin version: 1.9.2
  • PHP compatiblity: 5.2.4+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.1-5.2.1
  • WordPress version: 6.3.1
  • First release: May 27, 2019
  • Latest release: Jan 1, 2020
  • Number of updates: 20
  • Update frequency: every 11.0 days
  • Top authors: restpack (100%)

Code review

54 tests

User reviews

1 review

Install metrics

50+ active /2,301 total downloads

Benchmarks

Plugin footprint 58% from 16 tests

Installer 0% from 1 test

🔺 Critical test (weight: 50) | All plugins must install correctly, without throwing any errors, warnings, or notices
Please fix the following installer errors
  • Install procedure had errors
    • > Notice in wp-content/plugins/save-as-pdf/save-as-pdf.php+123
    Undefined index: text_string

Server metrics [RAM: ▼0.29MB] [CPU: ▼15.76ms] Passed 4 tests

Analyzing server-side resources used by Save as PDF Button
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /3.45 ▼0.0133.60 ▼7.56
Dashboard /wp-admin3.35 ▲0.0445.52 ▼3.29
Posts /wp-admin/edit.php3.40 ▲0.0445.97 ▼1.99
Add New Post /wp-admin/post-new.php4.64 ▼1.2544.01 ▼48.55
Media Library /wp-admin/upload.php3.27 ▲0.0434.38 ▼3.65
Restpack PDF /wp-admin/options-general.php?page=save-as-pdf/save-as-pdf.php3.2136.43

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

Filesystem and database footprint
There were no storage issued detected upon installing this plugin
Filesystem: 16 new files
Database: no new tables, 7 new options
New WordPress options
theysaidso_admin_options
widget_theysaidso_widget
rpkeyoptions
db_upgraded
can_compress_scripts
widget_recent-comments
widget_recent-posts

Browser metrics Passed 4 tests

Save as PDF Button: an overview of browser usage
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,835 ▲10013.33 ▼1.054.31 ▲2.6142.55 ▼11.31
Dashboard /wp-admin2,210 ▲255.85 ▲0.9598.25 ▼3.6037.71 ▼3.96
Posts /wp-admin/edit.php2,096 ▲21.98 ▼0.0334.57 ▼21.6031.27 ▼11.85
Add New Post /wp-admin/post-new.php1,545 ▲1018.49 ▼4.68636.33 ▼48.7650.37 ▼10.41
Media Library /wp-admin/upload.php1,386 ▼54.22 ▲0.0498.87 ▼5.9141.83 ▼2.26
Restpack PDF /wp-admin/options-general.php?page=save-as-pdf/save-as-pdf.php1,4122.0828.6726.74

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

🔸 Tests weight: 35 | It is important to correctly uninstall your plugin, without leaving any traces
These items require your attention
  • Zombie WordPress options were found after uninstall: 7 options
    • widget_recent-comments
    • widget_theysaidso_widget
    • theysaidso_admin_options
    • can_compress_scripts
    • rpkeyoptions
    • widget_recent-posts
    • db_upgraded

Smoke tests 50% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | This is a shallow check for server-side errors
These server-side errors were triggered
  • 15 occurences, only the last one shown
    • > GET request to /wp-admin/options-general.php?page=save-as-pdf/save-as-pdf.php
    • > Notice in wp-content/plugins/save-as-pdf/save-as-pdf.php+505
    Undefined index: placeholder
  • 7 occurences, only the last one shown
    • > GET request to /wp-admin/options-general.php?page=save-as-pdf/save-as-pdf.php
    • > Notice in wp-content/plugins/save-as-pdf/save-as-pdf.php+497
    Undefined index: textarea
  • 11 occurences, only the last one shown
    • > GET request to /wp-admin/options-general.php?page=save-as-pdf/save-as-pdf.php
    • > Notice in wp-content/plugins/save-as-pdf/save-as-pdf.php+500
    Undefined index: readonly
    • > GET request to /wp-admin/options-general.php?page=save-as-pdf/save-as-pdf.php
    • > Notice in wp-content/plugins/save-as-pdf/save-as-pdf.php+398
    Undefined index: display_pages
    • > GET request to /wp-admin/options-general.php?page=save-as-pdf/save-as-pdf.php
    • > Notice in wp-content/plugins/save-as-pdf/save-as-pdf.php+398
    Undefined index: api_key
    • > GET request to /wp-admin/options-general.php?page=save-as-pdf/save-as-pdf.php
    • > Notice in wp-content/plugins/save-as-pdf/save-as-pdf.php+398
    Undefined index: pdf_margins
    • > GET request to /wp-admin/options-general.php?page=save-as-pdf/save-as-pdf.php
    • > Notice in wp-content/plugins/save-as-pdf/save-as-pdf.php+398
    Undefined index: pdf_header
    • > GET request to /wp-admin/options-general.php?page=save-as-pdf/save-as-pdf.php
    • > Notice in wp-content/plugins/save-as-pdf/save-as-pdf.php+398
    Undefined index: pdf_footer
    • > GET request to /wp-admin/options-general.php?page=save-as-pdf/save-as-pdf.php
    • > Notice in wp-content/plugins/save-as-pdf/save-as-pdf.php+398
    Undefined index: width
    • > GET request to /wp-admin/options-general.php?page=save-as-pdf/save-as-pdf.php
    • > Notice in wp-content/plugins/save-as-pdf/save-as-pdf.php+398
    Undefined index: emulate_media
    • > GET request to /wp-admin/options-general.php?page=save-as-pdf/save-as-pdf.php
    • > Notice in wp-content/plugins/save-as-pdf/save-as-pdf.php+398
    Undefined index: js
    • > GET request to /wp-admin/options-general.php?page=save-as-pdf/save-as-pdf.php
    • > Notice in wp-content/plugins/save-as-pdf/save-as-pdf.php+398
    Undefined index: css
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/options-general.php?page=save-as-pdf/save-as-pdf.php
    • > Notice in wp-content/plugins/save-as-pdf/save-as-pdf.php+428
    Undefined index: form_data
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/options-general.php?page=save-as-pdf/save-as-pdf.php
    • > Notice in wp-content/plugins/save-as-pdf/save-as-pdf.php+428
    Undefined index: block_cookie_warnings
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/options-general.php?page=save-as-pdf/save-as-pdf.php
    • > Notice in wp-content/plugins/save-as-pdf/save-as-pdf.php+428
    Undefined index: block_ads
    • > GET request to /wp-admin/options-general.php?page=save-as-pdf/save-as-pdf.php
    • > Notice in wp-content/plugins/save-as-pdf/save-as-pdf.php+398
    Undefined index: http_headers

SRP 50% 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
  • 1× GET requests to PHP files trigger server-side errors or Error 500 responses:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function register_activation_hook() in wp-content/plugins/save-as-pdf/save-as-pdf.php:49

User-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the browser (console and network errors and warnings)
Everything seems fine, but this is not an exhaustive test

Optimizations

Plugin configuration Passed 29 tests

readme.txt Passed 16 tests

The readme.txt file is an important file in your plugin as it is parsed by WordPress.org to prepare the public listing of your plugin
7 plugin tags: html2pdf, pdf, article to pdf, create pdf, convert to pdf...

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

The principal PHP file in "Save as PDF Button" v. 1.9.2 is loaded by WordPress automatically on each request
48 characters long description:
Allows visitors to save current page as PDF file

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | An overview of files in this plugin; executable files are not allowed
Success! There were no dangerous files found in this plugin652 lines of code in 13 files:
LanguageFilesBlank linesComment linesLines of code
PHP18812528
SVG1100116
JavaScript1008

PHP code Passed 2 tests

Analyzing cyclomatic complexity and code structure
No complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.30
Average class complexity37.00
▷ Minimum class complexity37.00
▷ Maximum class complexity37.00
Average method complexity3.06
▷ Minimum method complexity1.00
▷ Maximum method complexity20.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes1
▷ Abstract classes00.00%
▷ Concrete classes1100.00%
▷ Final classes00.00%
Methods19
▷ Static methods00.00%
▷ Public methods19100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions0
▷ Named functions00.00%
▷ Anonymous functions00.00%
Constants0
▷ Global constants00.00%
▷ Class constants00.00%
▷ Public constants00.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
PNG images were not found in this plugin