72% pdf-viewer-by-themencode

Code Review | TNC PDF viewer

WordPress plugin TNC PDF viewer scored72%from 54 tests.

About plugin

  • Plugin page: pdf-viewer-by-the...
  • Plugin version: 2.7.0
  • PHP compatiblity: 5.6+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.0-6.4.1
  • WordPress version: 6.3.1
  • First release: May 17, 2021
  • Latest release: Nov 20, 2023
  • Number of updates: 62
  • Update frequency: every 14.8 days
  • Top authors: abdulawal39 (100%)

Code review

54 tests

User reviews

5 reviews

Install metrics

1,000+ active /13,394 total downloads

Benchmarks

Plugin footprint 82% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | All plugins must install correctly, without throwing any errors, warnings, or notices
Installer ran successfully

Server metrics [RAM: ▲1.80MB] [CPU: ▲10.57ms] 75% from 4 tests

An overview of server-side resources used by TNC PDF viewer
Please fix the following
  • CPU: Total CPU usage should be kept under 500.00ms (currently 621.47ms on /wp-admin/post-new.php?post_type=pdfviewer)
PageMemory (MB)CPU Time (ms)
Home /5.32 ▲1.8556.32 ▲14.88
Dashboard /wp-admin5.14 ▲1.8059.49 ▼0.77
Posts /wp-admin/edit.php5.20 ▲1.8463.93 ▲17.59
Add New Post /wp-admin/post-new.php7.66 ▲1.77110.06 ▲10.57
Media Library /wp-admin/upload.php5.00 ▲1.7755.04 ▲24.70
Add New /wp-admin/post-new.php?post_type=pdfviewer5.19621.47
Addons & Integrations /wp-admin/edit.php?post_type=pdfviewer&page=pdf-addon-integration-page5.0152.09
Generate Shortcode /wp-admin/edit.php?post_type=pdfviewer&page=generate-shortcode-page5.0850.54
All PDF viewers /wp-admin/edit.php?post_type=pdfviewer5.1556.40
Global Settings /wp-admin/edit.php?post_type=pdfviewer&page=pdf-viewer-options5.0852.60
Shortcodes /wp-admin/edit.php?post_type=pdfviewer&page=tnc-pdf-shortcode-page5.0161.45
Import PDF File /wp-admin/edit.php?post_type=pdfviewer&page=themencode-pdf-viewer-import-file5.0247.88

Server storage [IO: ▲8.27MB] [DB: ▲0.01MB] Passed 3 tests

Filesystem and database footprint
No storage issues were detected
Filesystem: 828 new files
Database: no new tables, 8 new options
New WordPress options
widget_theysaidso_widget
theysaidso_admin_options
can_compress_scripts
db_upgraded
widget_recent-posts
pvfw_csf_options
tnc_pvfw_permalink_flushed
widget_recent-comments

Browser metrics Passed 4 tests

A check of browser resources used by TNC PDF viewer
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,918 ▲17114.37 ▼0.341.55 ▼0.0939.11 ▼7.21
Dashboard /wp-admin2,321 ▲1445.88 ▲0.2999.31 ▼4.2180.65 ▲37.36
Posts /wp-admin/edit.php2,232 ▲1352.43 ▲0.4939.48 ▲3.1540.98 ▲2.22
Add New Post /wp-admin/post-new.php6,410 ▲4,88119.46 ▼3.77990.68 ▲279.5641.88 ▼24.13
Media Library /wp-admin/upload.php1,529 ▲1354.31 ▲0.08106.31 ▲4.7184.39 ▲42.48
Add New /wp-admin/post-new.php?post_type=pdfviewer3,2505.25103.85141.80
Addons & Integrations /wp-admin/edit.php?post_type=pdfviewer&page=pdf-addon-integration-page1,3813.8449.94106.52
Generate Shortcode /wp-admin/edit.php?post_type=pdfviewer&page=generate-shortcode-page1,3943.8052.6277.40
All PDF viewers /wp-admin/edit.php?post_type=pdfviewer1,4654.1756.5697.26
Global Settings /wp-admin/edit.php?post_type=pdfviewer&page=pdf-viewer-options4,12417.33540.52120.82
Shortcodes /wp-admin/edit.php?post_type=pdfviewer&page=tnc-pdf-shortcode-page1,3033.7456.97114.52
Import PDF File /wp-admin/edit.php?post_type=pdfviewer&page=themencode-pdf-viewer-import-file1,2133.7549.8288.39

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
You still need to fix the following
  • Zombie WordPress options detected upon uninstall: 8 options
    • theysaidso_admin_options
    • widget_recent-posts
    • widget_theysaidso_widget
    • tnc_pvfw_permalink_flushed
    • widget_recent-comments
    • pvfw_csf_options
    • db_upgraded
    • can_compress_scripts

Smoke tests 25% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
Even though no errors were found, this is by no means an exhaustive test

SRP 0% 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 take a closer look at the following
  • 1× PHP files perform the action of outputting non-empty strings when accessed directly:
    • > /wp-content/plugins/pdf-viewer-by-themencode/admin/index.php
  • 9× PHP files trigger errors when accessed directly with GET requests:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_option() in wp-content/plugins/pdf-viewer-by-themencode/web/pdf-viewer-single.php:16
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_html_e() in wp-content/plugins/pdf-viewer-by-themencode/admin/import-pdf-file.php:49
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/pdf-viewer-by-themencode/includes/cpt.php:70
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/pdf-viewer-by-themencode/includes/scripts.php:74
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_shortcode() in wp-content/plugins/pdf-viewer-by-themencode/includes/pvfw-new-shortcodes.php:69
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/pdf-viewer-by-themencode/admin/generate-shortcode.php:17
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_option() in wp-content/plugins/pdf-viewer-by-themencode/web/pdf-viewer-single.php:16
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/pdf-viewer-by-themencode/admin/tnc-pdf-viewer-options.php:12
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/pdf-viewer-by-themencode/includes/helper-functions.php:11

User-side errors 0% from 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
There are user-side issues you should fix
  • 6 occurences, only the last one shown
    • > GET request to /wp-admin/edit.php?post_type=pdfviewer&page=themencode-pdf-viewer-import-file
    • > Javascript (severe) in unknown
    /wp-content/plugins/pdf-viewer-by-themencode/tnc-resources/admin-js.js?ver=2.7.0 38:48 Uncaught TypeError: Cannot read properties of null (reading 'addEventListener')
    • > GET request to /wp-admin/edit.php?post_type=pdfviewer&page=pdf-viewer-options
    • > Other (warning) in unknown
    /wp-admin/edit.php?post_type=pdfviewer&page=pdf-viewer-options 334 Unrecognized feature: 'web-share'.

Optimizations

Plugin configuration 96% from 29 tests

readme.txt Passed 16 tests

You should put a lot of thought into formatting readme.txt as it is used by WordPress.org to prepare the public listing of your plugin
5 plugin tags: pdf, pdf embed, pdf flipbook, pdf reader, pdf viewer

pdf-viewer-by-themencode/pdf-viewer-by-themencode.php 92% from 13 tests

This is the main PHP file of "TNC PDF viewer" version 2.7.0, providing information about the plugin in the header fields and serving as the principal entry point to the plugin's functions
Please take the time to fix the following:
  • Description: Please don't use more than 140 characters for the plugin description (currently 163 characters long)

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is an overview of file extensions present in this plugin and a short test that no dangerous files are bundled with this plugin
There were no executable files found in this plugin115,597 lines of code in 277 files:
LanguageFilesBlank linesComment linesLines of code
JavaScript1914,75397879,963
CSS1085860012,455
PHP822,7871,13810,461
PO File203,1983,5916,500
Sass1697035,674
SVG130054544

PHP code Passed 2 tests

An overview of cyclomatic complexity and code structure
There were no cyclomatic complexity issued detected
Cyclomatic complexity
Average complexity per logical line of code0.57
Average class complexity24.84
▷ Minimum class complexity1.00
▷ Maximum class complexity151.00
Average method complexity7.06
▷ Minimum method complexity1.00
▷ Maximum method complexity57.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes62
▷ Abstract classes23.23%
▷ Concrete classes6096.77%
▷ Final classes00.00%
Methods244
▷ Static methods3915.98%
▷ Public methods244100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions61
▷ Named functions61100.00%
▷ Anonymous functions00.00%
Constants7
▷ Global constants7100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

Using a strong compression for your PNG files is a great way to speed-up your plugin
185 PNG files occupy 0.63MB with 0.28MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
images/vc_addon_preview.png35.94KB12.69KB▼ 64.70%
web/images/secondaryToolbarButton-documentProperties@3x.png1.61KB0.83KB▼ 48.18%
web/schemes/dark-icons/toolbarButton-menuArrows.png1.04KB0.22KB▼ 79.14%
web/images/Artboard 1 copy 2@2x.png0.45KB0.31KB▼ 29.69%
web/images/treeitem-collapsed-rtl@2x.png0.16KB0.21KB0.00%