77% woo-document-preview

Code Review | Document Preview For WooCommerce

WordPress plugin Document Preview For WooCommerce scored77%from 54 tests.

About plugin

  • Plugin page: woo-document-preview
  • Plugin version: 1.4.3
  • PHP version: 7.4.16
  • WordPress compatibility: 3.0.1-6.3.0
  • WordPress version: 6.3.1
  • First release: Jan 10, 2017
  • Latest release: Jul 25, 2023
  • Number of updates: 13
  • Update frequency: every 183.4 days
  • Top authors: wbcomdesigns (100%)

Code review

54 tests

User reviews

3 reviews

Install metrics

100+ active /3,880 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

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

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

A check of server-side resources used by Document Preview For WooCommerce
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /3.46 ▲0.0040.86 ▼6.13
Dashboard /wp-admin3.31 ▲0.0050.76 ▼3.72
Posts /wp-admin/edit.php3.36 ▲0.0050.83 ▼2.49
Add New Post /wp-admin/post-new.php5.89 ▲0.0096.36 ▼0.62
Media Library /wp-admin/upload.php3.23 ▲0.0035.74 ▼0.03
Our Plugins /wp-admin/admin.php?page=wbcom-plugins-page3.0024.36
Support /wp-admin/admin.php?page=wbcom-support-page3.0024.33
Woo Document Preview /wp-admin/admin.php?page=woo-document-preview-settings3.0023.72
Our Themes /wp-admin/admin.php?page=wbcom-themes-page3.0025.51

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

Browser metrics Passed 4 tests

A check of browser resources used by Document Preview For WooCommerce
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,789 ▲2814.08 ▼0.291.78 ▼0.3841.11 ▼3.73
Dashboard /wp-admin2,192 ▲125.61 ▼0.0593.40 ▼9.4541.14 ▼3.50
Posts /wp-admin/edit.php2,097 ▼31.97 ▼0.0638.80 ▲2.5235.20 ▲0.51
Add New Post /wp-admin/post-new.php1,526 ▼023.52 ▲0.46641.45 ▼70.3558.60 ▲0.53
Media Library /wp-admin/upload.php1,400 ▼04.20 ▼0.0396.13 ▼9.3243.30 ▼1.42
Our Plugins /wp-admin/admin.php?page=wbcom-plugins-page280.420.084.49
Support /wp-admin/admin.php?page=wbcom-support-page280.420.065.00
Woo Document Preview /wp-admin/admin.php?page=woo-document-preview-settings280.420.094.28
Our Themes /wp-admin/admin.php?page=wbcom-themes-page280.420.073.57

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
It is recommended to fix the following
  • This plugin does not fully uninstall, leaving 6 options in the database
    • db_upgraded
    • can_compress_scripts
    • theysaidso_admin_options
    • widget_theysaidso_widget
    • widget_recent-comments
    • widget_recent-posts

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
Everything seems fine, however this is by no means an exhaustive test

SRP 50% from 2 tests

🔹 Tests weight: 20 | The single-responsibility principle applies for WordPress plugins as well - please make sure your PHP files perform no actions when accessed directly
Almost there! Just fix the following items
  • 5× GET requests to PHP files trigger server-side errors or Error 500 responses:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_url() in wp-content/plugins/woo-document-preview/admin/wbcom/templates/wbcom-plugins-page.php:5
    • > PHP Fatal error
      Uncaught Error: Call to undefined function __() in wp-content/plugins/woo-document-preview/admin/class-wc-document-preview-admin-feedback.php:311
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_url() in wp-content/plugins/woo-document-preview/admin/wbcom/templates/wbcom-support-page.php:5
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_html_e() in wp-content/plugins/woo-document-preview/admin/partials/woo-document-preview-general-pro.php:17
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_url() in wp-content/plugins/woo-document-preview/admin/wbcom/templates/wbcom-license-page.php:5

User-side errors 0% from 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
Please fix the following browser errors
    • > GET request to /wp-admin/admin.php?page=wbcom-plugins-page
    • > Network (severe)
    wp-admin/admin.php?page=wbcom-plugins-page - Failed to load resource: the server responded with a status of 403 (Forbidden)
    • > GET request to /wp-admin/admin.php?page=wbcom-support-page
    • > Network (severe)
    wp-admin/admin.php?page=wbcom-support-page - Failed to load resource: the server responded with a status of 403 (Forbidden)
    • > GET request to /wp-admin/admin.php?page=woo-document-preview-settings
    • > Network (severe)
    wp-admin/admin.php?page=woo-document-preview-settings - Failed to load resource: the server responded with a status of 403 (Forbidden)
    • > GET request to /wp-admin/admin.php?page=wbcom-themes-page
    • > Network (severe)
    wp-admin/admin.php?page=wbcom-themes-page - Failed to load resource: the server responded with a status of 403 (Forbidden)

Optimizations

Plugin configuration 86% from 29 tests

readme.txt 94% from 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
These attributes need to be fixed:
  • Screenshots: Add images for these screenshots: #1 (The screenshot shows the doc preview of sample pdf file and corresponds to screenshot-1.(png|jpg|jpeg|gif).), #2 (The screenshot shows the button on the single product page to preview the doc and corresponds to screenshot-2.(png|jpg|jpeg|gif).), #3 (The screenshot shows the metabox on product edit page to manage the docs to preview and corresponds to screenshot-3.(png|jpg|jpeg|gif).)
You can look at the official readme.txt

woo-document-preview/woo-product-document-preview.php 77% from 13 tests

"Document Preview For WooCommerce" version 1.4.3's primary PHP file adds more information about the plugin and serves as the entry point for WordPress
It is important to fix the following:
  • Description: Keep the plugin description shorter than 140 characters (currently 157 characters long)
  • Text Domain: You no longer need to specify the text domain since WordPress 4.6; it must be the same as the plugin slug
  • Main file name: Even though not officially enforced, the main plugin file should be the same as the plugin slug ("woo-document-preview.php" instead of "woo-product-document-preview.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | An overview of files in this plugin; executable files are not allowed
There were no executable files found in this plugin9,931 lines of code in 27 files:
LanguageFilesBlank linesComment linesLines of code
JSON2006,159
CSS3320641,783
PHP182218551,754
JavaScript41283235

PHP code Passed 2 tests

Analyzing logical lines of code, cyclomatic complexity, and other code metrics
Everything seems fine, there were no complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.21
Average class complexity13.33
▷ Minimum class complexity1.00
▷ Maximum class complexity52.00
Average method complexity2.85
▷ Minimum method complexity1.00
▷ Maximum method complexity29.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes9
▷ Abstract classes00.00%
▷ Concrete classes9100.00%
▷ Final classes00.00%
Methods60
▷ Static methods23.33%
▷ Public methods5490.00%
▷ Protected methods00.00%
▷ Private methods610.00%
Functions7
▷ Named functions7100.00%
▷ Anonymous functions00.00%
Constants6
▷ Global constants6100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

It is recommended to compress PNG files in your plugin to minimize bandwidth usage
6 PNG files occupy 0.30MB with 0.17MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
admin/wbcom/assets/imgs/logowbcom.png10.12KB3.87KB▼ 61.72%
admin/wbcom/assets/imgs/wbcom-offer-notice.png67.64KB32.40KB▼ 52.11%
screenshot-2.png22.84KB9.94KB▼ 56.49%
screenshot-3.png9.19KB4.51KB▼ 50.95%
screenshot-1.png186.64KB76.52KB▼ 59.00%