79% pdfjs-shortcode

Code Review | PDF.js Shortcode

WordPress plugin PDF.js Shortcode scored79%from 54 tests.

About plugin

  • Plugin page: pdfjs-shortcode
  • Plugin version: 1.0
  • PHP version: 7.4.16
  • WordPress compatibility: 3.0.1-4.3
  • WordPress version: 6.3.1
  • First release: Sep 23, 2015
  • Latest release: Sep 23, 2015
  • Number of updates: 2
  • Update frequency: every 7.0 days
  • Top authors: aruvi (100%)

Code review

54 tests

User reviews

2 reviews

Install metrics

100+ active /3,147 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
The plugin installed gracefully, with no errors

Server metrics [RAM: ▲0.01MB] [CPU: ▼8.14ms] Passed 4 tests

Server-side resources used by PDF.js Shortcode
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /3.47 ▲0.0136.87 ▼11.26
Dashboard /wp-admin3.31 ▲0.0142.97 ▼5.58
Posts /wp-admin/edit.php3.36 ▲0.0146.98 ▲0.93
Add New Post /wp-admin/post-new.php5.89 ▲0.0184.00 ▼16.63
Media Library /wp-admin/upload.php3.23 ▲0.0135.18 ▲2.07

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

Input-output and database impact of this plugin
There were no storage issued detected upon installing this plugin
Filesystem: 482 new files
Database: no new tables, 6 new options
New WordPress options
widget_recent-comments
theysaidso_admin_options
db_upgraded
can_compress_scripts
widget_recent-posts
widget_theysaidso_widget

Browser metrics Passed 4 tests

A check of browser resources used by PDF.js Shortcode
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,800 ▲5413.52 ▼0.914.07 ▲2.1840.45 ▲0.72
Dashboard /wp-admin2,206 ▲184.84 ▼1.00108.72 ▼9.1839.34 ▼2.80
Posts /wp-admin/edit.php2,089 ▼02.06 ▲0.0541.39 ▲4.3735.34 ▲1.48
Add New Post /wp-admin/post-new.php1,542 ▲918.28 ▼5.06642.74 ▼48.5659.39 ▼11.07
Media Library /wp-admin/upload.php1,388 ▼04.26 ▲0.1297.37 ▼9.4342.15 ▼1.08

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

🔸 Tests weight: 35 | All plugins must uninstall correctly, removing their source code and extra database tables they might have created
These items require your attention
  • The uninstall procedure has failed, leaving 6 options in the database
    • can_compress_scripts
    • widget_recent-comments
    • db_upgraded
    • widget_recent-posts
    • widget_theysaidso_widget
    • theysaidso_admin_options

Smoke tests 50% 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)
The smoke test was a success, however most plugin functionality was not tested

SRP 0% 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
  • 1× GET requests to PHP files return non-empty strings:
    • > /wp-content/plugins/pdfjs-shortcode/web/viewer.php
  • 1× PHP files trigger server-side errors or warnings when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_shortcode() in wp-content/plugins/pdfjs-shortcode/pdfjs-shortcode.php:14

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

Don't ignore readme.txt as it is the file that instructs WordPress.org on how to present your plugin to the world
7 plugin tags: pdfjs, chrome, shortcode, reader, mozilla...

pdfjs-shortcode/pdfjs-shortcode.php Passed 13 tests

This is the main PHP file of "PDF.js Shortcode" version 1.0, providing information about the plugin in the header fields and serving as the principal entry point to the plugin's functions
22 characters long description:
View pdf's with pdf.js

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
Everything looks great! No dangerous files found in this plugin130,592 lines of code in 57 files:
LanguageFilesBlank linesComment linesLines of code
JavaScript4310,33710,220128,274
CSS1241261,734
PHP26717391
SVG1000191
Markdown1102

PHP code Passed 2 tests

An short overview of logical lines of code, cyclomatic complexity, and other code metrics
No cyclomatic complexity issues were detected for this plugin
Cyclomatic complexity
Average complexity per logical line of code0.08
Average class complexity0.00
▷ Minimum class complexity0.00
▷ Maximum class complexity0.00
Average method complexity0.00
▷ Minimum method complexity0.00
▷ Maximum method complexity0.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes0
▷ Abstract classes00.00%
▷ Concrete classes00.00%
▷ Final classes00.00%
Methods0
▷ Static methods00.00%
▷ Public methods00.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions2
▷ Named functions2100.00%
▷ Anonymous functions00.00%
Constants0
▷ Global constants00.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
66 compressed PNG files occupy 0.04MB
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
web/images/toolbarButton-sidebarToggle-rtl.png0.22KB0.33KB0.00%
web/images/secondaryToolbarButton-documentProperties@2x.png0.91KB1.34KB0.00%
web/images/toolbarButton-zoomOut.png0.09KB0.12KB0.00%
web/images/findbarButton-previous.png0.19KB0.31KB0.00%
web/images/toolbarButton-secondaryToolbarToggle-rtl@2x.png0.45KB0.79KB0.00%