84% pdf-viewer

Code Review | PDF Viewer

WordPress plugin PDF Viewer scored 84% from 54 tests.

About plugin

  • Plugin page: pdf-viewer
  • Plugin version: 1.1.0
  • PHP compatiblity: 7.0+
  • PHP version: 7.4.16
  • WordPress compatibility: 3.8-6.1.1
  • WordPress version: 6.3.1
  • First release: May 18, 2015
  • Latest release: Jan 3, 2023
  • Number of updates: 5
  • Update frequency: every 557.8 days
  • Top authors: envigeek (100%)

Code review

54 tests

User reviews

14 reviews

Install metrics

10,000+ active / 147,515 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

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

Server metrics [RAM: ▲0.00MB] [CPU: ▼5.37ms] Passed 4 tests

Server-side resources used by PDF Viewer
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /3.46 ▲0.0036.59 ▼4.14
Dashboard /wp-admin3.31 ▲0.0044.15 ▼3.25
Posts /wp-admin/edit.php3.36 ▲0.0047.56 ▼0.16
Add New Post /wp-admin/post-new.php5.89 ▲0.0083.35 ▼13.93
Media Library /wp-admin/upload.php3.23 ▲0.0033.16 ▲0.30

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

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

Browser metrics Passed 4 tests

An overview of browser requirements for PDF Viewer
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,800 ▲4313.28 ▼1.064.66 ▲2.6740.59 ▼4.20
Dashboard /wp-admin2,203 ▲185.79 ▲0.90100.86 ▼19.1638.04 ▼9.59
Posts /wp-admin/edit.php2,092 ▲32.00 ▼0.0240.01 ▲1.6136.28 ▲2.76
Add New Post /wp-admin/post-new.php1,534 ▲118.49 ▼4.64629.39 ▼22.1477.32 ▲24.24
Media Library /wp-admin/upload.php1,388 ▼34.18 ▼0.0894.25 ▼2.8041.68 ▼3.60

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

🔸 Tests weight: 35 | It is important to correctly uninstall your plugin, without leaving any traces
These items require your attention
  • Zombie WordPress options were found after uninstall: 6 options
    • widget_recent-posts
    • db_upgraded
    • theysaidso_admin_options
    • can_compress_scripts
    • widget_recent-comments
    • widget_theysaidso_widget

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for server-side errors
Even though no errors were found, this is by no means an exhaustive test

SRP 50% 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
Please fix the following
  • 1× GET requests to PHP files have triggered server-side errors or warnings:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function register_activation_hook() in wp-content/plugins/pdf-viewer/pdf-viewer.php:26

User-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
Everything seems fine on the user side

Optimizations

Plugin configuration 97% from 29 tests

readme.txt 94% from 16 tests

It's important to format your readme.txt file correctly as it is parsed for the public listing of your plugin
These attributes need your attention:
  • Screenshots: Add a description for screenshot #2 in pdf-viewer/assets to your readme.txt
You can look at the official readme.txt

pdf-viewer/pdf-viewer.php Passed 13 tests

The principal PHP file in "PDF Viewer" v. 1.1.0 is loaded by WordPress automatically on each request
26 characters long description:
HTML5-compliant PDF Viewer

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short review of files and their extensions; it is not recommended to include executable files
There were no executable files found in this plugin97,365 lines of code in 60 files:
LanguageFilesBlank linesComment linesLines of code
JavaScript579338493,741
CSS2404482,702
HTML14816369
SVG5000291
PHP25169262

PHP code Passed 2 tests

This is a very shot review of cyclomatic complexity and code structure
Everything seems fine, there were no complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.26
Average class complexity22.00
▷ Minimum class complexity22.00
▷ Maximum class complexity22.00
Average method complexity2.11
▷ Minimum method complexity1.00
▷ Maximum method complexity6.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes1
▷ Abstract classes00.00%
▷ Concrete classes1100.00%
▷ Final classes00.00%
Methods19
▷ Static methods210.53%
▷ Public methods1894.74%
▷ Protected methods00.00%
▷ Private methods15.26%
Functions0
▷ Named functions00.00%
▷ Anonymous functions00.00%
Constants1
▷ Global constants00.00%
▷ Class constants1100.00%
▷ Public constants1100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
1 compressed PNG file occupies 0.00MB
Potential savings
Compression of 1 random PNG file using pngquant
FileSize - originalSize - compressedSavings
stable/web/images/shadow.png0.26KB0.35KB0.00%