84% pdf-viewer-block

Code Review | PDF Viewer Block for Gutenberg

WordPress plugin PDF Viewer Block for Gutenberg scored84%from 54 tests.

About plugin

  • Plugin page: pdf-viewer-block
  • Plugin version: 1.1
  • PHP compatiblity: 5.6+
  • PHP version: 7.4.16
  • WordPress compatibility: 5.0-6.1
  • WordPress version: 6.3.1
  • First release: Jan 29, 2019
  • Latest release: Oct 26, 2022
  • Number of updates: 19
  • Update frequency: every 72.0 days
  • Top authors: audrasjb (100%)

Code review

54 tests

User reviews

7 reviews

Install metrics

8,000+ active /46,008 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Verifying that this plugin installs correctly without errors
This plugin's installer ran successfully

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

Analyzing server-side resources used by PDF Viewer Block for Gutenberg
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /3.47 ▲0.0044.72 ▲4.22
Dashboard /wp-admin3.32 ▼0.0349.63 ▼13.42
Posts /wp-admin/edit.php3.37 ▲0.0151.74 ▲1.98
Add New Post /wp-admin/post-new.php5.91 ▲0.0187.41 ▼18.99
Media Library /wp-admin/upload.php3.24 ▲0.0135.14 ▼3.84

Server storage [IO: ▲15.95MB] [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: 391 new files
Database: no new tables, 6 new options
New WordPress options
can_compress_scripts
db_upgraded
widget_theysaidso_widget
widget_recent-posts
theysaidso_admin_options
widget_recent-comments

Browser metrics Passed 4 tests

PDF Viewer Block for Gutenberg: an overview of browser usage
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,789 ▲1814.20 ▼0.151.86 ▲0.1344.72 ▲5.66
Dashboard /wp-admin2,192 ▲215.50 ▼0.0784.40 ▼3.1639.84 ▼7.10
Posts /wp-admin/edit.php2,100 ▼31.99 ▲0.0135.36 ▼5.7633.62 ▼6.21
Add New Post /wp-admin/post-new.php6,194 ▲4,66619.02 ▼4.09929.78 ▲291.9255.32 ▼5.38
Media Library /wp-admin/upload.php1,397 ▼64.20 ▼0.0198.29 ▼0.1343.40 ▼0.60

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
These items require your attention
  • The uninstall procedure has failed, leaving 6 options in the database
    • db_upgraded
    • widget_theysaidso_widget
    • widget_recent-posts
    • theysaidso_admin_options
    • widget_recent-comments
    • can_compress_scripts

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 everything seems fine, this is not an exhaustive test

SRP 50% 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
Almost there! Just fix the following items
  • 1× PHP files trigger server-side errors or warnings when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/pdf-viewer-block/public/public.php:22

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
No browser errors were detected

Optimizations

Plugin configuration Passed 29 tests

readme.txt Passed 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
9 plugin tags: liseuse, reader, pdf reader, block, pdf...

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

Analyzing the main PHP file in "PDF Viewer Block for Gutenberg" version 1.1
88 characters long description:
A simple and 100% free Gutenberg Block to display PDF Viewers / Readers on your website.

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is a short overview of programming languages used in this plugin, detecting executable files
Good job! No executable or dangerous file extensions detected50,706 lines of code in 27 files:
LanguageFilesBlank linesComment linesLines of code
JavaScript84,4184,31148,371
CSS3239261,741
HTML14917353
SVG1000166
PHP4105962
JSON10013

PHP code Passed 2 tests

An overview of cyclomatic complexity and code structure
There are no cyclomatic complexity problems detected for this plugin
Cyclomatic complexity
Average complexity per logical line of code0.31
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

All PNG images should be compressed to minimize bandwidth usage for end users
70 compressed PNG files occupy 0.47MB
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
inc/pdfjs/web/images/secondaryToolbarButton-firstPage.png0.17KB0.27KB0.00%
inc/pdfjs/web/images/toolbarButton-print@2x.png0.45KB0.63KB0.00%
inc/pdfjs/web/images/toolbarButton-menuArrows@2x.png0.15KB0.19KB0.00%
inc/pdfjs/web/images/toolbarButton-pageUp@2x.png0.39KB0.64KB0.00%
inc/pdfjs/web/images/toolbarButton-bookmark@2x.png0.25KB0.41KB0.00%