77% pdf-catalog-for-woocommerce

Code Review | PDF Catalog for WooCommerce

WordPress plugin PDF Catalog for WooCommercescored77%from 54 tests.

About plugin

  • Plugin page: pdf-catalog-for-w...
  • Plugin version: 1.1.18
  • PHP version: 7.4.16
  • WordPress compatibility: 3.1-3.3
  • WordPress version: 6.3.1
  • First release: Apr 23, 2015
  • Latest release: Feb 8, 2018
  • Number of updates: 9
  • Update frequency: every 113.6 days
  • Top authors: ovologics (100%)

Code review

54 tests

User reviews

9 reviews

Install metrics

100+ active /8,176 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
This plugin's installer ran successfully

Server metrics [RAM: ▲0.03MB] [CPU: ▼6.59ms] Passed 4 tests

Analyzing server-side resources used by PDF Catalog for WooCommerce
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /3.47 ▲0.0139.27 ▼6.07
Dashboard /wp-admin3.35 ▲0.0450.28 ▼8.44
Posts /wp-admin/edit.php3.40 ▲0.0451.72 ▼1.45
Add New Post /wp-admin/post-new.php5.93 ▲0.0495.52 ▼10.40
Media Library /wp-admin/upload.php3.27 ▲0.0440.11 ▲0.31

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

A short overview of filesystem and database impact
It is recommended to fix the following issues
  • Try to limit filesystem usage to 25MB (currently using 27.53MB)
Filesystem: 863 new files
Database: no new tables, 6 new options
New WordPress options
widget_recent-posts
db_upgraded
can_compress_scripts
theysaidso_admin_options
widget_recent-comments
widget_theysaidso_widget

Browser metrics Passed 4 tests

This is an overview of browser requirements for PDF Catalog for WooCommerce
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,805 ▲4414.28 ▼0.451.68 ▼0.0938.86 ▼6.74
Dashboard /wp-admin2,211 ▲375.55 ▲0.0187.19 ▼16.8437.08 ▼6.89
Posts /wp-admin/edit.php2,116 ▲162.03 ▲0.0439.57 ▲0.6736.05 ▼1.66
Add New Post /wp-admin/post-new.php1,541 ▲1523.04 ▲0.03638.76 ▼46.2250.73 ▼1.50
Media Library /wp-admin/upload.php1,416 ▲134.17 ▼0.06101.22 ▼8.8145.40 ▼3.61

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
The following items require your attention
  • Zombie WordPress options were found after uninstall: 6 options
    • widget_recent-comments
    • can_compress_scripts
    • theysaidso_admin_options
    • widget_recent-posts
    • widget_theysaidso_widget
    • db_upgraded

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a short smoke test looking for server-side errors
Everything seems fine, however this is by no means an exhaustive test

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 take a closer look at the following
  • 11× PHP files perform the action of outputting non-empty strings when accessed directly (only 10 are shown):
    • > /wp-content/plugins/pdf-catalog-for-woocommerce/pdf_data/mpdf_lib/utils/index.php
    • > /wp-content/plugins/pdf-catalog-for-woocommerce/pdf_data/mpdf_lib/utils/font_names.php
    • > /wp-content/plugins/pdf-catalog-for-woocommerce/pdf_data/mpdf_lib/utils/font_collections.php
    • > /wp-content/plugins/pdf-catalog-for-woocommerce/pdf_data/mpdf_lib/compress.php
    • > /wp-content/plugins/pdf-catalog-for-woocommerce/view/template/getpdf.php
    • > /wp-content/plugins/pdf-catalog-for-woocommerce/pdf_data/utils/TemplateUtils.php
    • > /wp-content/plugins/pdf-catalog-for-woocommerce/pdf_data/mpdf_lib/utils/font_dump.php
    • > /wp-content/plugins/pdf-catalog-for-woocommerce/pdf_data/mpdf_lib/qrcode/index.php
    • > /wp-content/plugins/pdf-catalog-for-woocommerce/pdf_data/mpdf_lib/utils/font_coverage.php
    • > /wp-content/plugins/pdf-catalog-for-woocommerce/pdf_data/mpdf_lib/qrcode/image.php
  • 462× PHP files trigger errors when accessed directly with GET requests (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'mPDF' not found in wp-content/plugins/pdf-catalog-for-woocommerce/mergePDF.php:16
    • > PHP Warning
      Illegal string offset 'ID' in wp-content/plugins/pdf-catalog-for-woocommerce/pdf_data/mpdf_lib/classes/cssmgr.php on line 1355
    • > PHP Warning
      Illegal string offset 'ID' in wp-content/plugins/pdf-catalog-for-woocommerce/pdf_data/mpdf_lib/classes/cssmgr.php on line 1302
    • > PHP Fatal error
      Uncaught Error: Class 'UCDN' not found in wp-content/plugins/pdf-catalog-for-woocommerce/pdf_data/mpdf_lib/config_script2lang.php:5
    • > PHP Warning
      Illegal string offset 'LANG' in wp-content/plugins/pdf-catalog-for-woocommerce/pdf_data/mpdf_lib/classes/cssmgr.php on line 1307
    • > PHP Warning
      Illegal string offset 'LANG' in wp-content/plugins/pdf-catalog-for-woocommerce/pdf_data/mpdf_lib/classes/cssmgr.php on line 1355
    • > PHP Fatal error
      Uncaught Error: Class 'FPDF' not found in wp-content/plugins/pdf-catalog-for-woocommerce/pdf_data/mpdf_lib/vendor/setasign/fpdi/fpdi_bridge.php:23
    • > PHP Warning
      Cannot assign an empty string to a string offset in wp-content/plugins/pdf-catalog-for-woocommerce/pdf_data/mpdf_lib/classes/cssmgr.php on line 1302
    • > PHP Warning
      Illegal string offset 'LANG' in wp-content/plugins/pdf-catalog-for-woocommerce/pdf_data/mpdf_lib/classes/cssmgr.php on line 1307
    • > PHP Warning
      Illegal string offset 'ID' in wp-content/plugins/pdf-catalog-for-woocommerce/pdf_data/mpdf_lib/classes/cssmgr.php on line 1302

User-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
Everything seems fine, but this is not an exhaustive test

Optimizations

Plugin configuration 90% from 29 tests

readme.txt 88% from 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
These attributes need your attention:
  • Plugin Name: Write the name of your plugin instead of "Plugin Name" on the first line ( === PDF Catalog for WooCommerce=== )
  • Requires at least: The plugin version is formatted incorrectly
You can take inspiration from this readme.txt

pdf-catalog-for-woocommerce/pdfcatalog.php 92% from 13 tests

The main PHP file in "PDF Catalog for WooCommerce" ver. 1.1.18 adds more information about the plugin and also serves as the entry point for this plugin
Please take the time to fix the following:
  • Main file name: Name the main plugin file the same as the plugin slug ("pdf-catalog-for-woocommerce.php" instead of "pdfcatalog.php")

Code Analysis 95% from 3 tests

File types Passed 1 test

🔸 Test weight: 35 | Executable files are considered dangerous and should not be included with any WordPress plugin
There were no executable files found in this plugin102,121 lines of code in 321 files:
LanguageFilesBlank linesComment linesLines of code
PHP1767,3799,07793,762
JavaScript1066231,6815,736
CSS282283942,362
JSON3120123
Markdown243096
XML53032
SQL10010

PHP code 0% from 2 tests

This is a short overview of cyclomatic complexity and code structure for this plugin
Please tend to the following items
  • Cyclomatic complexity of classes has to be reduced to less than 1000 (currently 8,314)
  • Please reduce cyclomatic complexity of methods to less than 100 (currently 1,542)
Cyclomatic complexity
Average complexity per logical line of code0.52
Average class complexity400.52
▷ Minimum class complexity1.00
▷ Maximum class complexity8,314.00
Average method complexity20.92
▷ Minimum method complexity1.00
▷ Maximum method complexity1,542.00
Code structure
Namespaces1
Interfaces0
Traits0
Classes44
▷ Abstract classes00.00%
▷ Concrete classes44100.00%
▷ Final classes00.00%
Methods882
▷ Static methods707.94%
▷ Public methods82493.42%
▷ Protected methods465.22%
▷ Private methods121.36%
Functions54
▷ Named functions54100.00%
▷ Anonymous functions00.00%
Constants385
▷ Global constants6115.84%
▷ Class constants32484.16%
▷ Public constants324100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
42 compressed PNG files occupy 0.51MB
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
view/stylesheet/ui/themes/base/images/ui-icons_2e83ff_256x240.png4.27KB4.11KB▼ 3.78%
view/stylesheet/ui/themes/ui-lightness/images/ui-icons_228ef1_256x240.png4.27KB4.11KB▼ 3.78%
view/stylesheet/ui/themes/base/images/ui-bg_highlight-soft_75_cccccc_1x100.png0.10KB0.17KB0.00%
view/stylesheet/ui/themes/base/images/ui-bg_glass_65_ffffff_1x400.png0.10KB0.10KB▼ 5.71%
view/stylesheet/ui/themes/ui-lightness/images/ui-bg_glass_100_fdf5ce_1x400.png0.12KB0.16KB0.00%