79% save-page-to-pdf

Code Review | Save Page to PDF

WordPress plugin Save Page to PDF scored79%from 54 tests.

About plugin

  • Plugin page: save-page-to-pdf
  • Plugin version: 1.0
  • PHP compatiblity: 5.2.4+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.1-4.9.8
  • WordPress version: 6.3.1
  • First release: Nov 13, 2018
  • Latest release: Nov 13, 2018
  • Number of updates: 2
  • Update frequency: every 0.5 days
  • Top authors: api2pdf (100%)

Code review

54 tests

User reviews

3 reviews

Install metrics

20+ active /1,293 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
The plugin installed gracefully, with no errors

Server metrics [RAM: ▲0.03MB] [CPU: ▼7.37ms] Passed 4 tests

An overview of server-side resources used by Save Page to PDF
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /3.51 ▲0.0446.78 ▲3.69
Dashboard /wp-admin3.35 ▼0.0051.82 ▼11.08
Posts /wp-admin/edit.php3.46 ▲0.1050.13 ▼2.76
Add New Post /wp-admin/post-new.php5.93 ▲0.0486.42 ▼14.15
Media Library /wp-admin/upload.php3.27 ▲0.0436.83 ▼1.47
PDF Settings /wp-admin/options-general.php?page=save-page-to-pdf3.2232.13

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

Input-output and database impact of this plugin
The plugin installed successfully
Filesystem: 4 new files
Database: no new tables, 6 new options
New WordPress options
widget_recent-comments
can_compress_scripts
theysaidso_admin_options
db_upgraded
widget_theysaidso_widget
widget_recent-posts

Browser metrics Passed 4 tests

A check of browser resources used by Save Page to PDF
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,901 ▲15513.54 ▼1.068.66 ▲6.8642.76 ▲1.64
Dashboard /wp-admin2,199 ▲195.54 ▼0.1684.78 ▼3.6542.11 ▲2.93
Posts /wp-admin/edit.php2,104 ▲42.01 ▼0.0135.04 ▼2.4438.51 ▼1.23
Add New Post /wp-admin/post-new.php1,552 ▲2623.16 ▲5.68658.65 ▼17.5554.87 ▲5.69
Media Library /wp-admin/upload.php1,407 ▲134.18 ▼0.0395.42 ▼5.0343.39 ▼0.69
PDF Settings /wp-admin/options-general.php?page=save-page-to-pdf8102.0525.4727.78

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
Please fix the following items
  • This plugin did not uninstall successfully, leaving 6 options in the database
    • widget_theysaidso_widget
    • theysaidso_admin_options
    • can_compress_scripts
    • widget_recent-comments
    • db_upgraded
    • widget_recent-posts

Smoke tests 50% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
Almost there, just fix the following server-side errors
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/options-general.php?page=save-page-to-pdf
    • > Notice in wp-content/plugins/save-page-to-pdf/save-page-to-pdf.php+53
    Trying to access array offset on value of type bool
    • > GET request to /wp-admin/options-general.php?page=save-page-to-pdf
    • > Notice in wp-content/plugins/save-page-to-pdf/save-page-to-pdf.php+54
    Undefined variable: checked

SRP 50% from 2 tests

🔹 Tests weight: 20 | It is important to ensure that your PHP files perform no action when accessed directly, respecting the single-responsibility principle
Please take a closer look at the following
  • 1× PHP files trigger errors when accessed directly with GET requests:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function register_activation_hook() in wp-content/plugins/save-page-to-pdf/save-page-to-pdf.php:11

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
There were no browser issues found

Optimizations

Plugin configuration Passed 29 tests

readme.txt Passed 16 tests

The readme.txt file is important because it is parsed by WordPress.org for the public listing of your plugin
2 plugin tags: pdf, wkhtmltopdf

save-page-to-pdf/save-page-to-pdf.php Passed 13 tests

The entry point to "Save Page to PDF" version 1.0 is a PHP file that has certain tags in its header comment area
69 characters long description:
Allows visitors of your website to download the current page as a PDF

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short glimpse at programming languages used with this plugin and a check that no dangerous files are present
Good job! No executable or dangerous file extensions detected182 lines of code in 3 files:
LanguageFilesBlank linesComment linesLines of code
PHP24119173
JavaScript1009

PHP code Passed 2 tests

This is a very shot review of cyclomatic complexity and code structure
Although this was not an exhaustive test, there were no cyclomatic complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.16
Average class complexity12.00
▷ Minimum class complexity12.00
▷ Maximum class complexity12.00
Average method complexity2.38
▷ Minimum method complexity1.00
▷ Maximum method complexity3.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes1
▷ Abstract classes00.00%
▷ Concrete classes1100.00%
▷ Final classes00.00%
Methods8
▷ Static methods00.00%
▷ Public methods787.50%
▷ Protected methods00.00%
▷ Private methods112.50%
Functions14
▷ Named functions14100.00%
▷ Anonymous functions00.00%
Constants7
▷ Global constants7100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
No PNG images were found in this plugin