77% ilovepdf

Code Review | PDF Compressor & Watermark - iLovePDF

WordPress plugin PDF Compressor & Watermark - iLovePDF scored77%from 54 tests.

About plugin

  • Plugin page: ilovepdf
  • Plugin version: 2.0.3
  • PHP compatiblity: 7.4+
  • PHP version: 7.4.16
  • WordPress compatibility: 5.3-6.4.1
  • WordPress version: 6.3.1
  • First release: Sep 29, 2017
  • Latest release: Nov 15, 2023
  • Number of updates: 25
  • Update frequency: every 89.6 days
  • Top authors: ilovepdf (100%)

Code review

54 tests

User reviews

3 reviews

Install metrics

300+ active /16,097 total downloads

Benchmarks

Plugin footprint 82% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
This plugin's installer ran successfully

Server metrics [RAM: ▲0.05MB] [CPU: ▼7.26ms] 75% from 4 tests

A check of server-side resources used by PDF Compressor & Watermark - iLovePDF
The following require your attention
  • CPU: You should keep total CPU usage under 500.00ms (currently 772.29ms on /wp-admin/upload.php?page=ilove-pdf-content-statistics)
PageMemory (MB)CPU Time (ms)
Home /3.51 ▲0.0435.93 ▼1.67
Dashboard /wp-admin3.37 ▲0.0246.93 ▼9.21
Posts /wp-admin/edit.php3.42 ▲0.0646.02 ▼2.72
Add New Post /wp-admin/post-new.php5.96 ▲0.0779.94 ▼15.43
Media Library /wp-admin/upload.php3.29 ▲0.0635.22 ▲4.15
iLovePDF /wp-admin/upload.php?page=ilove-pdf-content-statistics3.27772.29
iLovePDF /wp-admin/options-general.php?page=ilove-pdf-content-setting3.2837.12

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

Analyzing filesystem and database footprints of this plugin
No storage issues were detected
Filesystem: 310 new files
Database: no new tables, 10 new options
New WordPress options
can_compress_scripts
widget_theysaidso_widget
ilove_pdf_display_settings_watermark
ilovepdf_initial_pdf_files_size
ilove_pdf_display_settings_format_watermark
widget_recent-comments
ilove_pdf_display_settings_compress
theysaidso_admin_options
widget_recent-posts
db_upgraded

Browser metrics Passed 4 tests

Checking browser requirements for PDF Compressor & Watermark - iLovePDF
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,886 ▲11414.73 ▲0.461.71 ▼0.1642.40 ▼3.04
Dashboard /wp-admin2,260 ▲834.88 ▼0.74106.26 ▲8.9539.89 ▼9.48
Posts /wp-admin/edit.php2,184 ▲812.35 ▲0.3443.10 ▼0.5331.06 ▼6.79
Add New Post /wp-admin/post-new.php1,592 ▲6623.29 ▲0.70651.99 ▲50.9035.53 ▼13.50
Media Library /wp-admin/upload.php1,476 ▲824.46 ▲0.27107.22 ▲3.3342.00 ▼0.92
iLovePDF /wp-admin/upload.php?page=ilove-pdf-content-statistics9022.0831.2324.73
iLovePDF /wp-admin/options-general.php?page=ilove-pdf-content-setting1,1843.4243.0258.98

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
  • The uninstall procedure has failed, leaving 12 options in the database
    • db_upgraded
    • theysaidso_admin_options
    • can_compress_scripts
    • ilove_pdf_display_settings_watermark
    • widget_theysaidso_widget
    • ilove_pdf_display_settings_compress
    • ilovepdf_watermarked_files
    • widget_recent-comments
    • ilove_pdf_display_settings_format_watermark
    • ilovepdf_compressed_files
    • ...

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
Everything seems fine, however this is by no means 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
  • 1× PHP files output text when accessed directly:
    • > /wp-content/plugins/ilovepdf/admin/partials/ilove-pdf-admin-display.php
  • 182× GET requests to PHP files have triggered server-side errors or warnings (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'Ilovepdf\\Sign\\Elements\\ElementAbstract' not found in wp-content/plugins/ilovepdf/vendor/ilovepdf/ilovepdf-php/src/Sign/Elements/ElementName.php:6
    • > PHP Warning
      require_once(../vendor/autoload.php): failed to open stream: No such file or directory in wp-content/plugins/ilovepdf/vendor/ilovepdf/ilovepdf-php/samples/unlock_advanced.php on line 3
    • > PHP Fatal error
      Uncaught Error: Class 'GuzzleHttp\\Exception\\TransferException' not found in wp-content/plugins/ilovepdf/vendor/guzzlehttp/guzzle/src/Exception/RequestException.php:15
    • > PHP Fatal error
      require_once(): Failed opening required '../vendor/autoload.php' (include_path='.:/usr/share/php') in wp-content/plugins/ilovepdf/vendor/ilovepdf/ilovepdf-php/samples/unlock_advanced.php on line 3
    • > PHP Fatal error
      Uncaught Error: Interface 'Psr\\Http\\Message\\StreamInterface' not found in wp-content/plugins/ilovepdf/vendor/guzzlehttp/psr7/src/LimitStream.php:12
    • > PHP Fatal error
      Uncaught Error: Class 'Ilovepdf\\Sign\\Elements\\ElementAbstract' not found in wp-content/plugins/ilovepdf/vendor/ilovepdf/ilovepdf-php/src/Sign/Elements/ElementInitials.php:6
    • > PHP Fatal error
      Uncaught Error: Interface 'GuzzleHttp\\BodySummarizerInterface' not found in wp-content/plugins/ilovepdf/vendor/guzzlehttp/guzzle/src/BodySummarizer.php:7
    • > PHP Fatal error
      Uncaught Error: Class 'Ilovepdf\\Sign\\Elements\\ElementAbstract' not found in wp-content/plugins/ilovepdf/vendor/ilovepdf/ilovepdf-php/src/Sign/Elements/ElementDate.php:6
    • > PHP Fatal error
      require_once(): Failed opening required '../vendor/autoload.php' (include_path='.:/usr/share/php') in wp-content/plugins/ilovepdf/vendor/ilovepdf/ilovepdf-php/samples/watermark_basic.php on line 3
    • > PHP Fatal error
      Uncaught Error: Interface 'GuzzleHttp\\Handler\\CurlFactoryInterface' not found in wp-content/plugins/ilovepdf/vendor/guzzlehttp/guzzle/src/Handler/CurlFactory.php:20

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)
There were no browser issues found

Optimizations

Plugin configuration 86% from 29 tests

readme.txt 94% 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
These attributes need your attention:
  • Screenshots: Screenshot #4 (PDF actions) image required
The official readme.txt might help

ilovepdf/ilove-pdf.php 77% from 13 tests

The entry point to "PDF Compressor & Watermark - iLovePDF" version 2.0.3 is a PHP file that has certain tags in its header comment area
It is important to fix the following:
  • Description: The description should be shorter than 140 characters (currently 202 characters long)
  • Text Domain: You no longer need to specify the text domain since WordPress 4.6; it must be the same as the plugin slug
  • Main file name: Even though not officially enforced, the main plugin file should be the same as the plugin slug ("ilovepdf.php" instead of "ilove-pdf.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | There should be no dangerous file extensions present in any WordPress plugin
Success! There were no dangerous files found in this plugin25,474 lines of code in 292 files:
LanguageFilesBlank linesComment linesLines of code
PHP2473,8699,38516,647
Markdown231,68204,551
CSS473392,174
JSON13001,621
JavaScript15840390
XML30072
SVG10019

PHP code Passed 2 tests

This plugin's cyclomatic complexity and code structure detailed below
There are no cyclomatic complexity problems detected for this plugin
Cyclomatic complexity
Average complexity per logical line of code0.38
Average class complexity10.30
▷ Minimum class complexity1.00
▷ Maximum class complexity99.00
Average method complexity2.40
▷ Minimum method complexity1.00
▷ Maximum method complexity27.00
Code structure
Namespaces24
Interfaces27
Traits4
Classes148
▷ Abstract classes21.35%
▷ Concrete classes14698.65%
▷ Final classes3624.66%
Methods1,161
▷ Static methods18716.11%
▷ Public methods1,00786.74%
▷ Protected methods100.86%
▷ Private methods14412.40%
Functions181
▷ Named functions8546.96%
▷ Anonymous functions9653.04%
Constants81
▷ Global constants44.94%
▷ Class constants7795.06%
▷ Public constants5672.73%

Plugin size Passed 2 tests

Image compression Passed 2 tests

PNG files should be compressed to save space and minimize bandwidth usage
There were not PNG files found in your plugin