94% pdf-or-image-generator

Code Review | PDF or image generator

WordPress plugin PDF or image generator scored 94% from 54 tests.

About plugin

  • Plugin page: pdf-or-image-gene...
  • Plugin version: 1.0
  • PHP compatiblity: 5.5+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.0-4.9
  • WordPress version: 5.9.2
  • First release: Sep 16, 2017
  • Latest release: Nov 14, 2017
  • Number of updates: 19
  • Update frequency: every 3.2 days
  • Top authors: wposmosys (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active / 776 total downloads

Benchmarks

Plugin footprint Passed 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
The plugin installed gracefully, with no errors

Server metrics [RAM: ▲0.05MB] [CPU: ▼295.75ms] Passed 4 tests

Server-side resources used by PDF or image generator
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /3.65 ▲0.1369.81 ▲11.84
Dashboard /wp-admin3.49 ▲0.0835.10 ▲0.54
Posts /wp-admin/edit.php3.71 ▲0.0739.62 ▲1.37
Add New Post /wp-admin/post-new.php6.95 ▼0.0296.34 ▼1,188.44
Media Library /wp-admin/upload.php3.37 ▲0.0727.90 ▲3.52
PDF or image generator settings /wp-admin/options-general.php?page=PDF-image-settings3.3927.21

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

How much does this plugin use your filesystem and database?
This plugin was installed successfully
Filesystem: 12 new files
Database: no new tables, no new options

Browser metrics Passed 4 tests

PDF or image generator: an overview of browser usage
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,790 ▲3315.93 ▲0.165.68 ▼0.422.41 ▼0.11
Dashboard /wp-admin2,890 ▲366.17 ▼0.02132.11 ▼13.10212.12 ▲48.51
Posts /wp-admin/edit.php2,696 ▲113.24 ▲0.0164.85 ▲1.63140.44 ▼9.27
Add New Post /wp-admin/post-new.php1,763 ▲10222.94 ▲7.32431.18 ▼72.69203.33 ▲17.87
Media Library /wp-admin/upload.php1,700 ▲55.51 ▼0.05134.91 ▼25.98213.25 ▼22.96
PDF or image generator settings /wp-admin/options-general.php?page=PDF-image-settings1,2062.4456.66144.57

Uninstaller [IO: ▲0.00MB] [DB: ▲0.00MB] Passed 4 tests

🔸 Tests weight: 35 | The uninstall procedure must remove all plugin files and extra database tables
Uninstall script ran successfully

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the server (in the Apache logs)
Even though everything seems fine, this is not an exhaustive test

SRP 50% from 2 tests

🔹 Tests weight: 20 | A shallow check of the single-responsibility principle; PHP files should perform no action - including output of placeholder text - and trigger no errors when accessed directly
Please fix the following
  • 4× PHP files trigger errors when accessed directly with GET requests:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function _e() in wp-content/plugins/pdf-or-image-generator/templates/admin/PDF-image-settings.php:11
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_dir_url() in wp-content/plugins/pdf-or-image-generator/PDF-image-generator.php:15
    • > PHP Fatal error
      Uncaught Error: Call to undefined function _e() in wp-content/plugins/pdf-or-image-generator/templates/admin/PDFIG-admin-demo-template.php:26
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_transient() in wp-content/plugins/pdf-or-image-generator/templates/PDFIG-demo-template.php:23

User-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
No browser errors were detected

Optimizations

Plugin configuration 93% from 29 tests

readme.txt Passed 16 tests

Often overlooked, readme.txt is one of the most important files in your plugin
5 plugin tags: html to pdf, image converter, html to image, pdf converter, converter

pdf-or-image-generator/PDF-image-generator.php 85% from 13 tests

Analyzing the main PHP file in "PDF or image generator" version 1.0
It is important to fix the following:
  • Main file name: The principal plugin file should be the same as the plugin slug ("pdf-or-image-generator.php" instead of "PDF-image-generator.php")
  • Text Domain: The text domain should only use lowercase characters and dashes

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
Good job! No executable or dangerous file extensions detected576 lines of code in 8 files:
LanguageFilesBlank linesComment linesLines of code
PHP680114468
PO File123073
Markdown124035

PHP code Passed 2 tests

A short review of cyclomatic complexity and code structure
This plugin has no cyclomatic complexity problems
Cyclomatic complexity
Average complexity per logical line of code0.27
Average class complexity21.00
▷ Minimum class complexity17.00
▷ Maximum class complexity25.00
Average method complexity2.82
▷ Minimum method complexity1.00
▷ Maximum method complexity17.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes2
▷ Abstract classes00.00%
▷ Concrete classes2100.00%
▷ Final classes00.00%
Methods22
▷ Static methods00.00%
▷ Public methods1463.64%
▷ Protected methods00.00%
▷ Private methods836.36%
Functions5
▷ Named functions5100.00%
▷ Anonymous functions00.00%
Constants9
▷ Global constants555.56%
▷ Class constants444.44%
▷ Public constants4100.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
1 PNG file occupies 0.21MB with 0.15MB in potential savings
Potential savings
Compression of 1 random PNG file using pngquant
FileSize - originalSize - compressedSavings
img/pdf-image-generator-settings.png215.81KB62.51KB▼ 71.03%