78% pdf-password-protect

Code Review | PDF Password Protect

WordPress plugin PDF Password Protect scored78%from 54 tests.

About plugin

  • Plugin page: pdf-password-protect
  • Plugin version: 1.0.2
  • PHP compatiblity: 7.2.5+
  • PHP version: 7.4.16
  • WordPress compatibility: 5.8.0-6.3.1
  • WordPress version: 6.3.1
  • First release: Sep 15, 2022
  • Latest release: Oct 5, 2023
  • Number of updates: 12
  • Update frequency: every 32.2 days
  • Top authors: grandplugins (100%)

Code review

54 tests

User reviews

1 review

Install metrics

100+ active /777 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Verifying that this plugin installs correctly without errors
Installer ran successfully

Server metrics [RAM: ▲0.48MB] [CPU: ▼3.87ms] Passed 4 tests

Analyzing server-side resources used by PDF Password Protect
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /3.96 ▲0.5037.44 ▲1.53
Dashboard /wp-admin3.79 ▲0.4546.90 ▼11.58
Posts /wp-admin/edit.php3.84 ▲0.4949.04 ▲2.17
Add New Post /wp-admin/post-new.php6.38 ▲0.4990.17 ▼7.58
Media Library /wp-admin/upload.php3.72 ▲0.4936.92 ▲4.77
PDF Password Protected /wp-admin/upload.php?page=gpls-psrpdf-password-protected-pdf-pdf-password-protected-page4.14111.38

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

Analyzing filesystem and database footprints of this plugin
The plugin installed successfully
Filesystem: 312 new files
Database: no new tables, 6 new options
New WordPress options
widget_recent-comments
can_compress_scripts
widget_recent-posts
db_upgraded
theysaidso_admin_options
widget_theysaidso_widget

Browser metrics Passed 4 tests

A check of browser resources used by PDF Password Protect
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,806 ▲7114.74 ▲0.371.74 ▲0.0539.40 ▼5.10
Dashboard /wp-admin2,209 ▲175.80 ▲0.86137.32 ▲32.0057.29 ▲12.89
Posts /wp-admin/edit.php2,095 ▲32.01 ▼0.0239.06 ▼3.1334.63 ▼5.36
Add New Post /wp-admin/post-new.php1,546 ▲2118.46 ▼4.81602.61 ▼58.8451.98 ▼3.18
Media Library /wp-admin/upload.php1,394 ▲64.22 ▼0.0293.85 ▼2.7340.44 ▼4.25
PDF Password Protected /wp-admin/upload.php?page=gpls-psrpdf-password-protected-pdf-pdf-password-protected-page1,1112.4044.2565.77

Uninstaller [IO: ▲0.00MB] [DB: ▲0.00MB] 75% 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
  • Zombie WordPress options detected upon uninstall: 6 options
    • db_upgraded
    • widget_recent-comments
    • widget_theysaidso_widget
    • theysaidso_admin_options
    • can_compress_scripts
    • widget_recent-posts

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no server-side errors were triggered
Even though everything seems fine, this is not an exhaustive test

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
Almost there! Just fix the following items
  • 8× PHP files perform the task of outputting text when accessed with GET requests:
    • > /wp-content/plugins/pdf-password-protect/vendor/setasign/fpdf/tutorial/tuto5.php
    • > /wp-content/plugins/pdf-password-protect/vendor/setasign/fpdf/tutorial/tuto2.php
    • > /wp-content/plugins/pdf-password-protect/vendor/setasign/fpdf/tutorial/tuto1.php
    • > /wp-content/plugins/pdf-password-protect/vendor/setasign/fpdf/tutorial/makefont.php
    • > /wp-content/plugins/pdf-password-protect/vendor/setasign/fpdf/tutorial/tuto7.php
    • > /wp-content/plugins/pdf-password-protect/vendor/setasign/fpdf/tutorial/tuto4.php
    • > /wp-content/plugins/pdf-password-protect/vendor/setasign/fpdf/tutorial/tuto6.php
    • > /wp-content/plugins/pdf-password-protect/vendor/setasign/fpdf/tutorial/tuto3.php
  • 63× GET requests to PHP files trigger server-side errors or Error 500 responses (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Interface 'setasign\\Fpdi\\PdfParser\\Filter\\FilterInterface' not found in wp-content/plugins/pdf-password-protect/vendor/setasign/fpdi/src/PdfParser/Filter/Flate.php:16
    • > PHP Fatal error
      Uncaught Error: Class 'setasign\\Fpdi\\PdfParser\\CrossReference\\AbstractReader' not found in wp-content/plugins/pdf-password-protect/vendor/setasign/fpdi/src/PdfParser/CrossReference/LineReader.php:22
    • > PHP Fatal error
      Uncaught Error: Class 'setasign\\Fpdi\\PdfParser\\Type\\PdfType' not found in wp-content/plugins/pdf-password-protect/vendor/setasign/fpdi/src/PdfParser/Type/PdfDictionary.php:20
    • > PHP Fatal error
      Uncaught Error: Interface 'Symfony\\Component\\Filesystem\\Exception\\ExceptionInterface' not found in wp-content/plugins/pdf-password-protect/vendor/symfony/filesystem/Exception/InvalidArgumentException.php:17
    • > PHP Fatal error
      Uncaught Error: Class 'tFPDF' not found in wp-content/plugins/pdf-password-protect/vendor/setasign/fpdi/src/Tfpdf/FpdfTpl.php:20
    • > PHP Fatal error
      Uncaught Error: Class 'Symfony\\Polyfill\\Php80\\PhpToken' not found in wp-content/plugins/pdf-password-protect/vendor/symfony/polyfill-php80/Resources/stubs/PhpToken.php:13
    • > PHP Fatal error
      Uncaught Error: Class 'setasign\\Fpdi\\PdfParser\\Type\\PdfType' not found in wp-content/plugins/pdf-password-protect/vendor/setasign/fpdi/src/PdfParser/Type/PdfNumeric.php:16
    • > PHP Fatal error
      Uncaught Error: Class 'setasign\\Fpdi\\PdfParser\\Type\\PdfType' not found in wp-content/plugins/pdf-password-protect/vendor/setasign/fpdi/src/PdfParser/Type/PdfArray.php:21
    • > PHP Fatal error
      Uncaught Error: Class 'setasign\\Fpdi\\PdfParser\\Type\\PdfType' not found in wp-content/plugins/pdf-password-protect/vendor/setasign/fpdi/src/PdfParser/Type/PdfBoolean.php:16
    • > PHP Fatal error
      Uncaught Error: Class 'setasign\\Fpdi\\FpdfTpl' not found in wp-content/plugins/pdf-password-protect/vendor/setasign/fpdi/src/Fpdi.php:23

User-side errors Passed 1 test

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

Optimizations

Plugin configuration 90% from 29 tests

readme.txt 88% from 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
Attributes that require attention:
  • Screenshots: These screenshots need descriptions #1, #2, #3, #4, #5 in pdf-password-protect/assets to your readme.txt
  • Tags: You are using too many tags: 11 tag instead of maximum 10
You can take inspiration from this readme.txt

pdf-password-protect/pdf-password-protect.php 92% from 13 tests

The primary PHP file in "PDF Password Protect" version 1.0.2 is used by WordPress to initiate all plugin functionality
It is important to fix the following:
  • Description: Please keep the plugin description shorter than 140 characters (currently 169 characters long)

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short check of programming languages and file extensions; no executable files are allowed
No dangerous file extensions were detected17,959 lines of code in 248 files:
LanguageFilesBlank linesComment linesLines of code
PHP1562,4606,02113,185
HTML597203,257
JSON900843
Markdown111340378
YAML2180220
XML25747
CSS60526
JavaScript3063

PHP code Passed 2 tests

This is a very shot review of cyclomatic complexity and code structure
There were no cyclomatic complexity issued detected
Cyclomatic complexity
Average complexity per logical line of code0.39
Average class complexity17.24
▷ Minimum class complexity1.00
▷ Maximum class complexity342.00
Average method complexity3.53
▷ Minimum method complexity1.00
▷ Maximum method complexity29.00
Code structure
Namespaces26
Interfaces10
Traits5
Classes99
▷ Abstract classes55.05%
▷ Concrete classes9494.95%
▷ Final classes44.26%
Methods738
▷ Static methods12617.07%
▷ Public methods57778.18%
▷ Protected methods12416.80%
▷ Private methods375.01%
Functions61
▷ Named functions4675.41%
▷ Anonymous functions1524.59%
Constants72
▷ Global constants22.78%
▷ Class constants7097.22%
▷ Public constants70100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Using a strong compression for your PNG files is a great way to speed-up your plugin
6 PNG files occupy 0.01MB with 0.00MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
core/assets/dist/images/logo-icon-md.png0.91KB0.96KB0.00%
vendor/xthiago/pdf-version-converter/tests/files/repo/image.png0.55KB0.10KB▼ 82.27%
core/assets/dist/images/full-logo.png6.58KB3.86KB▼ 41.28%
core/assets/dist/images/logo-icon-sm.png0.62KB0.72KB0.00%
core/assets/dist/images/logo-icon-lg.png3.56KB2.72KB▼ 23.62%