84% gs-only-pdf-preview

Code Review | GS Only PDF Preview

WordPress plugin GS Only PDF Preview scored84%from 54 tests.

About plugin

  • Plugin page: gs-only-pdf-preview
  • Plugin version: 1.0.7
  • PHP version: 7.4.16
  • WordPress compatibility: 4.7.0-4.8.0
  • WordPress version: 6.3.1
  • First release: Jan 17, 2017
  • Latest release: Jun 13, 2017
  • Number of updates: 21
  • Update frequency: every 6.9 days
  • Top authors: gitlost (100%)

Code review

54 tests

User reviews

8 reviews

Install metrics

2,000+ active /11,587 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
This plugin's installer ran successfully

Server metrics [RAM: ▲0.16MB] [CPU: ▼9.00ms] Passed 4 tests

Server-side resources used by GS Only PDF Preview
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /3.59 ▲0.1238.52 ▼4.26
Dashboard /wp-admin3.45 ▲0.1049.08 ▼9.21
Posts /wp-admin/edit.php3.56 ▲0.2043.81 ▼1.86
Add New Post /wp-admin/post-new.php6.12 ▲0.2381.28 ▼20.65
Media Library /wp-admin/upload.php3.46 ▲0.2237.39 ▲3.37
Regen. PDF Previews /wp-admin/tools.php?page=gopp-regen-pdf-previews3.4131.88

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

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

Browser metrics Passed 4 tests

An overview of browser requirements for GS Only PDF Preview
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,820 ▲7413.15 ▼1.201.71 ▼0.0241.98 ▲0.50
Dashboard /wp-admin2,213 ▲285.83 ▲0.9596.76 ▼4.3741.76 ▼2.60
Posts /wp-admin/edit.php2,093 ▲42.06 ▲0.0535.15 ▼1.1233.23 ▼0.82
Add New Post /wp-admin/post-new.php1,536 ▲1621.11 ▼2.03658.98 ▼15.5663.00 ▼3.92
Media Library /wp-admin/upload.php1,394 ▲64.21 ▼0.0395.37 ▼3.7044.92 ▼1.01
Regen. PDF Previews /wp-admin/tools.php?page=gopp-regen-pdf-previews7602.0724.5624.50

Uninstaller [IO: ▲0.00MB] [DB: ▲0.00MB] 75% from 4 tests

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
You still need to fix the following
  • This plugin did not uninstall successfully, leaving 6 options in the database
    • can_compress_scripts
    • widget_recent-posts
    • theysaidso_admin_options
    • db_upgraded
    • widget_recent-comments
    • widget_theysaidso_widget

Smoke tests 75% 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 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
  • 6× GET requests to PHP files trigger server-side errors or Error 500 responses:
    • > PHP Fatal error
      Uncaught Error: Class 'WP_Image_Editor' not found in wp-content/plugins/gs-only-pdf-preview/includes/class-gopp-image-editor-gs.php:21
    • > PHP Warning
      Use of undefined constant ABSPATH - assumed 'ABSPATH' (this will throw an Error in a future version of PHP) in wp-content/plugins/gs-only-pdf-preview/includes/debug-gopp-image-editor-gs.php on line 6
    • > PHP Fatal error
      require_once(): Failed opening required 'ABSPATHWPINC/class-wp-image-editor.php' (include_path='.:/usr/share/php') in wp-content/plugins/gs-only-pdf-preview/includes/debug-gopp-image-editor-gs.php on line 6
    • > PHP Warning
      Use of undefined constant DAY_IN_SECONDS - assumed 'DAY_IN_SECONDS' (this will throw an Error in a future version of PHP) in wp-content/plugins/gs-only-pdf-preview/includes/class-gopp-image-editor-gs.php on line 10
    • > PHP Warning
      Use of undefined constant WPINC - assumed 'WPINC' (this will throw an Error in a future version of PHP) in wp-content/plugins/gs-only-pdf-preview/includes/debug-gopp-image-editor-gs.php on line 6
    • > PHP Warning
      require_once(ABSPATHWPINC/class-wp-image-editor.php): failed to open stream: No such file or directory in wp-content/plugins/gs-only-pdf-preview/includes/debug-gopp-image-editor-gs.php on line 6

User-side errors Passed 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
There were no browser issues found

Optimizations

Plugin configuration Passed 29 tests

readme.txt Passed 16 tests

Perhaps the most important file in your plugin readme.txt gets parsed in order to generate the public listing of your plugin
4 plugin tags: pdf, ghostscript, ghostscript only, pdf preview

gs-only-pdf-preview/gs-only-pdf-preview.php Passed 13 tests

"GS Only PDF Preview" version 1.0.7's main PHP file describes plugin functionality and also serves as the entry point to any WordPress functionality
51 characters long description:
Uses Ghostscript directly to generate PDF previews.

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | Executable files are not allowed as they can serve as attack vectors
Success! There were no dangerous files found in this plugin1,475 lines of code in 7 files:
LanguageFilesBlank linesComment linesLines of code
PHP4157544977
JavaScript23849266
PO File15890232

PHP code Passed 2 tests

This plugin's cyclomatic complexity and code structure detailed below
All good! No complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.65
Average class complexity87.33
▷ Minimum class complexity17.00
▷ Maximum class complexity149.00
Average method complexity5.47
▷ Minimum method complexity1.00
▷ Maximum method complexity37.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes3
▷ Abstract classes00.00%
▷ Concrete classes3100.00%
▷ Final classes00.00%
Methods58
▷ Static methods4374.14%
▷ Public methods4882.76%
▷ Protected methods1017.24%
▷ Private methods00.00%
Functions0
▷ Named functions00.00%
▷ Anonymous functions00.00%
Constants5
▷ Global constants5100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
There are no PNG files in this plugin