78% pdf-light-viewer

Code Review | Wordpress PDF Light Viewer Plugin

WordPress plugin Wordpress PDF Light Viewer Plugin scored 78% from 54 tests.

About plugin

  • Plugin page: pdf-light-viewer
  • Plugin version: 1.4.12
  • PHP version: 7.4.16
  • WordPress compatibility: 3.5-5.8
  • WordPress version: 5.8.1
  • First release: Oct 26, 2014
  • Latest release: Sep 13, 2021
  • Number of updates: 73
  • Update frequency: every 35.2 days
  • Top authors: antongorodezkiy (100%)

Code review

54 tests

User reviews

49 reviews

Install metrics

7,000+ active / 259,063 total downloads

Benchmarks

Plugin footprint 82% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
Installer ran successfully

Server metrics [RAM: ▲0.87MB] [CPU: ▼104.84ms] Passed 4 tests

Server-side resources used by Wordpress PDF Light Viewer Plugin
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /3.43 ▲0.7142.17 ▲15.77
Dashboard /wp-admin4.06 ▲1.0093.48 ▲47.20
Posts /wp-admin/edit.php4.09 ▲0.9898.79 ▲60.88
Add New Post /wp-admin/post-new.php6.30 ▲0.86145.56 ▼536.60
Media Library /wp-admin/upload.php3.94 ▲0.9491.35 ▲54.26
Tags /wp-admin/edit-tags.php?taxonomy=pdf_lv_tag&post_type=pdf_lv3.9578.45
Categories /wp-admin/edit-tags.php?taxonomy=pdf_lv_category&post_type=pdf_lv3.9582.15
PDFs /wp-admin/edit.php?post_type=pdf_lv4.0082.79
PDF Light Viewer /wp-admin/options-general.php?page=pdf-light-viewer3.99108.49
Import PDF /wp-admin/post-new.php?post_type=pdf_lv4.44109.42

Server storage [IO: ▲15.86MB] [DB: ▲0.00MB] 67% from 3 tests

How much does this plugin use your filesystem and database?
Please fix the following
  • There were 1 file (0.00KB) illegally modified outside of "wp-content/plugins/pdf-light-viewer/" and "wp-content/uploads/"
    • (new file) wp-content/pdf-light-viewer-logs/.empty
Filesystem: 956 new files
Database: no new tables, 2 new options
New WordPress options
pdf-light-viewer-pointers-viewed
pdf-light-viewer-show-post-type

Browser metrics Passed 4 tests

Wordpress PDF Light Viewer Plugin: an overview of browser usage
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,834 ▲23816.18 ▲0.4610.58 ▲0.0252.58 ▼7.13
Dashboard /wp-admin3,084 ▲1536.36 ▲0.39153.29 ▼15.32138.22 ▲11.85
Posts /wp-admin/edit.php2,848 ▲1092.79 ▲0.0775.97 ▲1.2395.24 ▼2.76
Add New Post /wp-admin/post-new.php1,712 ▲2913.81 ▼4.94304.44 ▼89.87140.29 ▲12.06
Media Library /wp-admin/upload.php1,874 ▲675.44 ▲0.42155.28 ▲1.74164.73 ▲44.73
Tags /wp-admin/edit-tags.php?taxonomy=pdf_lv_tag&post_type=pdf_lv1,8522.6964.9187.13
Categories /wp-admin/edit-tags.php?taxonomy=pdf_lv_category&post_type=pdf_lv1,8832.7967.3985.81
PDFs /wp-admin/edit.php?post_type=pdf_lv1,8532.9377.28110.81
PDF Light Viewer /wp-admin/options-general.php?page=pdf-light-viewer6,0043.5689.61206.71
Import PDF /wp-admin/post-new.php?post_type=pdf_lv2,8335.40124.14138.80

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
These items require your attention
  • This plugin did not uninstall successfully, leaving 2 options in the database
    • pdf-light-viewer-pointers-viewed
    • pdf-light-viewer-show-post-type

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)
Everything seems fine, however this is by no means an exhaustive test

SRP 0% 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 items
  • 2× PHP files output non-empty strings when accessed directly via GET requests:
    • > /wp-content/plugins/pdf-light-viewer/resources/views/requirements.php
    • > /wp-content/plugins/pdf-light-viewer/resources/views/server-libs-requirements-doc.php
  • 17× PHP files trigger server-side errors or warnings when accessed directly (only 10 are shown):
    • > PHP Notice
      Trying to access array offset on value of type null in wp-content/plugins/pdf-light-viewer/resources/templates/shortcode-pdf-light-viewer.php on line 4
    • > PHP Fatal error
      Uncaught Error: Class 'PdfLightViewer_PdfController' not found in wp-content/plugins/pdf-light-viewer/resources/templates/shortcode-pdf-light-viewer-nav-top.php:8
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_html__() in wp-content/plugins/pdf-light-viewer/resources/views/pro-placeholder.php:6
    • > PHP Fatal error
      Uncaught Error: Class 'PdfLightViewer_PdfController' not found in wp-content/plugins/pdf-light-viewer/resources/templates/shortcode-pdf-light-viewer.php:8
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_html__() in wp-content/plugins/pdf-light-viewer/resources/views/shortcode-top-panel.php:54
    • > PHP Notice
      Trying to access array offset on value of type null in wp-content/plugins/pdf-light-viewer/resources/templates/shortcode-pdf-light-viewer-nav-top.php on line 4
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_html__() in wp-content/plugins/pdf-light-viewer/resources/views/serverless-placeholder.php:6
    • > PHP Notice
      Trying to access array offset on value of type null in wp-content/plugins/pdf-light-viewer/resources/views/shortcode-top-panel.php on line 52
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/pdf-light-viewer/vendor/webdevstudios/cmb2/example-functions.php:68
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_html__() in wp-content/plugins/pdf-light-viewer/resources/views/metabox/usage.php:12

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
There were no browser issues found

Optimizations

Plugin configuration 97% from 29 tests

readme.txt 94% from 16 tests

Perhaps the most important file in your plugin readme.txt gets parsed in order to generate the public listing of your plugin
These attributes need your attention:
  • Donate link: Invalid url: ""
You can look at the official readme.txt

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

Analyzing the main PHP file in "Wordpress PDF Light Viewer Plugin" version 1.4.12
130 characters long description:
Wordpress plugin to embed normal, large and very large pdf documents to the wordpress site as flipbooks with thumbnail navigation.

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | There should be no dangerous file extensions present in any WordPress plugin
No dangerous file extensions were detected123,188 lines of code in 619 files:
LanguageFilesBlank linesComment linesLines of code
JavaScript25011,07311,46944,670
PO File12213,17017,22629,630
CSS653,9853,58919,141
JSON43508,845
PHP521,6992,6467,302
Markdown311,56604,242
Sass17679324,090
LESS4413411,791
Handlebars28458301,577
HTML428381,486
SVG200411
YAML1003

PHP code Passed 2 tests

This plugin's cyclomatic complexity and code structure detailed below
Great job! No cyclomatic complexity issues were detected in this plugin
Cyclomatic complexity
Average complexity per logical line of code0.51
Average class complexity30.85
▷ Minimum class complexity1.00
▷ Maximum class complexity155.00
Average method complexity3.92
▷ Minimum method complexity1.00
▷ Maximum method complexity33.00
Code structure
Namespaces1
Interfaces0
Traits0
Classes34
▷ Abstract classes00.00%
▷ Concrete classes34100.00%
▷ Final classes00.00%
Methods349
▷ Static methods12936.96%
▷ Public methods33194.84%
▷ Protected methods144.01%
▷ Private methods41.15%
Functions30
▷ Named functions2996.67%
▷ Anonymous functions13.33%
Constants16
▷ Global constants637.50%
▷ Class constants1062.50%
▷ Public constants10100.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

PNG files should be compressed to save space and minimize bandwidth usage
41 PNG files occupy 0.84MB with 0.15MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
documentation/img/fabric_of_squares_gray.png55.15KB57.35KB0.00%
vendor/webdevstudios/cmb2/images/ui-icons_cd0a0a_256x240.png4.27KB4.11KB▼ 3.78%
resources/assets/img/logo100.png2.80KB2.00KB▼ 28.67%
documentation/img/logo100.png2.80KB2.00KB▼ 28.67%
resources/assets/img/zoom.png0.74KB0.51KB▼ 31.23%