68% watermark-pdf

Code Review | Watermark PDF for WordPress and WooCommerce

WordPress plugin Watermark PDF for WordPress and WooCommerce scored68%from 54 tests.

About plugin

  • Plugin page: watermark-pdf
  • Plugin version: 1.0.2
  • PHP compatiblity: 7.1.3+
  • PHP version: 7.4.16
  • WordPress compatibility: 5.3.0-6.3
  • WordPress version: 6.3.1
  • First release: Jan 8, 2023
  • Latest release: Nov 5, 2023
  • Number of updates: 6
  • Update frequency: every 50.7 days
  • Top authors: grandplugins (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /341 total downloads

Benchmarks

Plugin footprint 65% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | It is important to correctly install your plugin, without throwing errors or notices
The plugin installed successfully, without throwing any errors or notices

Server metrics [RAM: ▲0.65MB] [CPU: ▼5.59ms] Passed 4 tests

Analyzing server-side resources used by Watermark PDF for WordPress and WooCommerce
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /4.13 ▲0.6739.84 ▼4.31
Dashboard /wp-admin3.97 ▲0.6248.57 ▼12.90
Posts /wp-admin/edit.php4.02 ▲0.6653.12 ▲8.40
Add New Post /wp-admin/post-new.php6.55 ▲0.6694.84 ▼7.98
Media Library /wp-admin/upload.php3.89 ▲0.6637.99 ▲2.84
Settings /wp-admin/admin.php?page=gpls-wmpdf-watermark-pdf-settings-tab4.3036.34
Single PDF Watermarker /wp-admin/admin.php?page=gpls-wmpdf4.2239.46

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

Filesystem and database footprint
The plugin installed successfully
Filesystem: 334 new files
Database: no new tables, 6 new options
New WordPress options
widget_theysaidso_widget
db_upgraded
theysaidso_admin_options
widget_recent-comments
can_compress_scripts
widget_recent-posts

Browser metrics Passed 4 tests

This is an overview of browser requirements for Watermark PDF for WordPress and WooCommerce
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,819 ▲5714.35 ▲0.131.78 ▲0.1141.91 ▼2.56
Dashboard /wp-admin2,221 ▲445.55 ▼0.0798.27 ▲5.5038.00 ▼2.08
Posts /wp-admin/edit.php2,126 ▲261.94 ▼0.0039.83 ▲3.0337.19 ▲0.25
Add New Post /wp-admin/post-new.php1,550 ▲523.43 ▼1.68611.36 ▼51.9852.31 ▼0.92
Media Library /wp-admin/upload.php1,432 ▲294.18 ▼0.0097.17 ▼5.3441.21 ▼4.39
Settings /wp-admin/admin.php?page=gpls-wmpdf-watermark-pdf-settings-tab1,1133.4350.5293.27
Single PDF Watermarker /wp-admin/admin.php?page=gpls-wmpdf1,9453.9561.0133.67

Uninstaller [IO: ▲0.00MB] [DB: ▲0.00MB] 50% 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 cannot be uninstalled
    • > Warning in wp-content/plugins/watermark-pdf/includes/class-pdf-watermark.php+151
    rmdir(wp-content/uploads/gpls-wmpdf-watermark-pdf-assets): Directory not empty
  • This plugin does not fully uninstall, leaving 6 options in the database
    • widget_recent-posts
    • widget_theysaidso_widget
    • widget_recent-comments
    • db_upgraded
    • can_compress_scripts
    • theysaidso_admin_options

Smoke tests 50% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
Smoke test failed, please fix the following
    • > GET request to /wp-admin/admin.php?page=gpls-wmpdf-watermark-pdf-settings-tab
    • > User deprecated in wp-content/plugins/watermark-pdf/vendor/symfony/process/Process.php+147
    Passing a command as string when creating a "Symfony\Component\Process\Process" instance is deprecated since Symfony 4.2, pass it as an array of its arguments instead, or use the "Process::fromShellCommandline()" constructor if you need features provided by the shell.

SRP 50% from 2 tests

🔹 Tests weight: 20 | SRP (Single-Responsibility Principle) - PHP files must act as libraries and never output text or perform any action when accessed directly in a browser
Please fix the following items
  • 65× GET requests to PHP files have triggered server-side errors or warnings (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'Symfony\\Component\\Process\\Pipes\\AbstractPipes' not found in wp-content/plugins/watermark-pdf/vendor/symfony/process/Pipes/UnixPipes.php:23
    • > PHP Fatal error
      Uncaught Error: Class 'setasign\\Fpdi\\PdfParser\\Type\\PdfType' not found in wp-content/plugins/watermark-pdf/vendor/setasign/fpdi/src/PdfParser/Type/PdfBoolean.php:16
    • > PHP Fatal error
      Uncaught Error: Interface 'Symfony\\Component\\Process\\Exception\\ExceptionInterface' not found in wp-content/plugins/watermark-pdf/vendor/symfony/process/Exception/RuntimeException.php:19
    • > PHP Fatal error
      Uncaught Error: Class 'setasign\\Fpdi\\PdfParser\\Type\\PdfType' not found in wp-content/plugins/watermark-pdf/vendor/setasign/fpdi/src/PdfParser/Type/PdfDictionary.php:20
    • > PHP Fatal error
      Uncaught Error: Class 'setasign\\Fpdi\\PdfParser\\CrossReference\\AbstractReader' not found in wp-content/plugins/watermark-pdf/vendor/setasign/fpdi/src/PdfParser/CrossReference/LineReader.php:22
    • > PHP Fatal error
      Uncaught Error: Class 'PHPUnit_Framework_TestCase' not found in wp-content/plugins/watermark-pdf/vendor/xthiago/pdf-version-converter/tests/Converter/GhostscriptConverterCommandTest.php:19
    • > PHP Fatal error
      Uncaught Error: Interface 'Symfony\\Component\\Filesystem\\Exception\\IOExceptionInterface' not found in wp-content/plugins/watermark-pdf/vendor/symfony/filesystem/Exception/IOException.php:21
    • > PHP Fatal error
      Uncaught Error: Class 'FPDF' not found in wp-content/plugins/watermark-pdf/vendor/setasign/fpdf/tutorial/tuto1.php:4
    • > PHP Fatal error
      Uncaught Error: Interface 'setasign\\Fpdi\\PdfParser\\Filter\\FilterInterface' not found in wp-content/plugins/watermark-pdf/vendor/setasign/fpdi/src/PdfParser/Filter/Flate.php:16
    • > PHP Fatal error
      Uncaught Error: Class 'FPDF' not found in wp-content/plugins/watermark-pdf/vendor/setasign/fpdf/tutorial/tuto5.php:4

User-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
There were no browser issues found

Optimizations

Plugin configuration 90% from 29 tests

readme.txt 88% from 16 tests

You should put a lot of thought into formatting readme.txt as it is used by WordPress.org to prepare the public listing of your plugin
Attributes that need to be fixed:
  • Screenshots: Please add descriptions for these screenshots #1, #2, #3, #4 in watermark-pdf/assets to your readme.txt
  • Tags: Please reduce the number of tags, currently 12 tag instead of maximum 10
The official readme.txt might help

watermark-pdf/gpls-wmpdf-watermark-pdf.php 92% from 13 tests

This is the main PHP file of "Watermark PDF for WordPress and WooCommerce" version 1.0.2, providing information about the plugin in the header fields and serving as the principal entry point to the plugin's functions
You should first fix the following items:
  • Main file name: Even though not officially enforced, the main plugin file should be the same as the plugin slug ("watermark-pdf.php" instead of "gpls-wmpdf-watermark-pdf.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | Executable files are considered dangerous and should not be included with any WordPress plugin
Everything looks great! No dangerous files found in this plugin18,358 lines of code in 252 files:
LanguageFilesBlank linesComment linesLines of code
PHP1582,4155,85313,708
HTML597203,242
JSON800745
Markdown101160334
YAML180177
JavaScript92612999
XML12027
CSS60526

PHP code Passed 2 tests

A brief analysis of cyclomatic complexity and code structure for this plugin
No cyclomatic complexity issues were detected for this plugin
Cyclomatic complexity
Average complexity per logical line of code0.41
Average class complexity17.55
▷ Minimum class complexity1.00
▷ Maximum class complexity335.00
Average method complexity3.55
▷ Minimum method complexity1.00
▷ Maximum method complexity29.00
Code structure
Namespaces23
Interfaces10
Traits5
Classes101
▷ Abstract classes32.97%
▷ Concrete classes9897.03%
▷ Final classes44.08%
Methods751
▷ Static methods15320.37%
▷ Public methods59879.63%
▷ Protected methods10714.25%
▷ Private methods466.13%
Functions60
▷ Named functions4676.67%
▷ Anonymous functions1423.33%
Constants64
▷ Global constants34.69%
▷ Class constants6195.31%
▷ Public constants61100.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
7 PNG files occupy 0.02MB 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%
core/assets/dist/images/logo-icon-lg.png3.56KB2.72KB▼ 23.62%
core/assets/dist/images/logo-icon-sm.png0.62KB0.72KB0.00%
vendor/xthiago/pdf-version-converter/tests/files/repo/image.png0.55KB0.10KB▼ 82.27%
vendor/setasign/fpdf/tutorial/logo.png2.32KB2.26KB▼ 2.57%