10% woocommerce-catalog-enquiry

Code Review | WC Catalog Enquiry

WordPress plugin WC Catalog Enquiry scored 10% from 54 tests.

About plugin

  • Plugin page: woocommerce-catal...
  • Plugin version: 4.0.7
  • PHP compatiblity: 5.6+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.2-5.9.2
  • WordPress version: 5.9.2
  • First release: May 22, 2015
  • Latest release: Mar 24, 2022
  • Number of updates: 86
  • Update frequency: every 29.1 days
  • Top authors: Dualcube (88.37%)wcmp (6.98%)purnendu (6.98%)

Code review

54 tests

User reviews

52 reviews

Install metrics

10,000+ active / 227,785 total downloads

Benchmarks

Plugin footprint 40% from 16 tests

Installer 0% from 1 test

🔺 Critical test (weight: 50) | It is important to correctly install your plugin, without throwing errors or notices
These installer errors require your attention
  • Install procedure validation failed for this plugin
    • > Warning in wp-content/plugins/woocommerce-catalog-enquiry/includes/woocommerce-catalog-enquiry-core-functions.php+40
    Invalid argument supplied for foreach()

Server metrics [RAM: ▼0.93MB] [CPU: ▼319.34ms] Passed 4 tests

A check of server-side resources used by WC Catalog Enquiry
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /3.90 ▲0.3853.95 ▲5.73
Dashboard /wp-admin3.40 ▼0.0121.67 ▼11.47
Posts /wp-admin/edit.php3.40 ▼0.2421.66 ▼15.92
Add New Post /wp-admin/post-new.php3.40 ▼3.5721.17 ▼1,248.49
Media Library /wp-admin/upload.php3.40 ▲0.1022.75 ▼1.48
Settings /wp-admin/admin.php?page=woo-catalog3.4021.15
Upgrade to Pro /wp-admin/admin.php?page=3.4021.14

Server storage [IO: ▲0.84MB] [DB: ▲0.00MB] Passed 3 tests

A short overview of filesystem and database impact
This plugin installed successfully
Filesystem: 100 new files
Database: no new tables, 5 new options
New WordPress options
woocommerce_catalog_enquiry_from_settings
woocommerce_catalog_enquiry_general_settings
woocommerce_catalog_migration_completed
woocommerce_catalog_enquiry_button_appearence_settings
woocommerce_catalog_enquiry_exclusion_settings

Browser metrics Passed 4 tests

Checking browser requirements for WC Catalog Enquiry
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,816 ▲6215.63 ▼0.345.93 ▲0.231.98 ▼0.31
Dashboard /wp-admin2,945 ▲846.14 ▼0.03115.50 ▼14.89158.00 ▲1.31
Posts /wp-admin/edit.php2,744 ▲503.25 ▲0.0162.15 ▼4.92138.73 ▼9.28
Add New Post /wp-admin/post-new.php1,694 ▲3316.07 ▲0.32397.13 ▼24.62158.59 ▼1.95
Media Library /wp-admin/upload.php1,750 ▲525.52 ▲0.04141.42 ▼138.73190.29 ▼1.55
Settings /wp-admin/admin.php?page=woo-catalog1,7745.12101.54131.71
Upgrade to Pro /wp-admin/admin.php?page=8502.1036.9169.54

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
These items require your attention
  • Uninstall procedure had uncaught errors
    • > Notice in wp-content/plugins/woocommerce-catalog-enquiry/includes/woocommerce-catalog-enquiry-core-functions.php+183
    Trying to get property 'term_id' of non-object
  • The uninstall procedure has failed, leaving 5 options in the database
    • woocommerce_catalog_enquiry_from_settings
    • woocommerce_catalog_enquiry_exclusion_settings
    • woocommerce_catalog_enquiry_button_appearence_settings
    • woocommerce_catalog_migration_completed
    • woocommerce_catalog_enquiry_general_settings

Smoke tests 0% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the server (in the Apache logs)
Please fix the following server-side errors
  • 36 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=
    • > Notice in wp-content/plugins/woocommerce-catalog-enquiry/includes/woocommerce-catalog-enquiry-core-functions.php+183
    Trying to get property 'term_id' of non-object
  • 36 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=
    • > Notice in wp-content/plugins/woocommerce-catalog-enquiry/includes/woocommerce-catalog-enquiry-core-functions.php+183
    Trying to get property 'name' of non-object
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=
    • > Warning in wp-includes/pluggable.php+1358
    Cannot modify header information - headers already sent by (output started at wp-admin/includes/misc.php:1013)

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
The following issues need your attention
  • 3× PHP files output non-empty strings when accessed directly via GET requests:
    • > /wp-content/plugins/woocommerce-catalog-enquiry/framework/field-types/multiselect.php
    • > /wp-content/plugins/woocommerce-catalog-enquiry/framework/field-types/select.php
    • > /wp-content/plugins/woocommerce-catalog-enquiry/framework/field-types/textarea.php
  • 79× GET requests to PHP files have triggered server-side errors or warnings (only 10 are shown):
    • > PHP Notice
      Undefined variable: id in wp-content/plugins/woocommerce-catalog-enquiry/framework/field-types/textarea.php on line 9
    • > PHP Notice
      Undefined variable: id in wp-content/plugins/woocommerce-catalog-enquiry/framework/field-types/wpeditor.php on line 10
    • > PHP Notice
      Undefined variable: setting_id in wp-content/plugins/woocommerce-catalog-enquiry/framework/field-types/color.php on line 11
    • > PHP Notice
      Undefined variable: name in wp-content/plugins/woocommerce-catalog-enquiry/framework/field-types/multiselect.php on line 8
    • > PHP Notice
      Undefined variable: id in wp-content/plugins/woocommerce-catalog-enquiry/framework/field-types/textbox.php on line 9
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_attr() in wp-content/plugins/woocommerce-catalog-enquiry/framework/field-types/password.php:9
    • > PHP Notice
      Undefined variable: id in wp-content/plugins/woocommerce-catalog-enquiry/framework/field-types/upload.php on line 11
    • > PHP Notice
      Undefined variable: id in wp-content/plugins/woocommerce-catalog-enquiry/framework/field-types/upload.php on line 8
    • > PHP Fatal error
      Uncaught Error: Using $this when not in object context in wp-content/plugins/woocommerce-catalog-enquiry/framework/field-types/export.php:8
    • > PHP Notice
      Undefined variable: name in wp-content/plugins/woocommerce-catalog-enquiry/framework/field-types/textarea.php on line 9

User-side errors 0% from 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
Please take a look at the following user-side issues
    • > GET request to /wp-admin/admin.php?page=woo-catalog
    • > Console-api (warning) in unknown
    /wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils,moxiejs,plupload&ver=5.9.2 1:31592 "jQuery.Deferred exception: Cannot read properties of undefined (reading 'nodeType')" "TypeError: Cannot read properties of undefined (reading 'nodeType')\n at s.fn.init.x.fn.position (/wp-includes/js/jquery/ui/core.min.js?ver=1.13.1:80:1386)\n at reCenterButton (/wp-content/plugins/woocommerce-catalog-enquiry/assets/admin/js/button_gen.js?ver=4.0.7:131:46)\n at HTMLDocument.\u003Canonymous> (/wp-content/plugins/woocommerce-catalog-enquiry/assets/admin/js/button_gen.js?ver=4.0.7:144:9)\n at e (/wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils,moxiejs,plupload&ver=5.9.2:2:30038)\n at t (/wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils,moxiejs,plupload&ver=5.9.2:2:30340)" undefined
    • > GET request to /wp-admin/admin.php?page=woo-catalog
    • > Javascript (severe) in unknown
    /wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils,moxiejs,plupload&ver=5.9.2 1:31702 Uncaught TypeError: Cannot read properties of undefined (reading 'nodeType')

Optimizations

Plugin configuration 90% from 29 tests

readme.txt 94% 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 to be fixed:
  • Tags: Too many tags (11 tag instead of maximum 10); only the first 5 tags are used in your directory listing
The official readme.txt might help

woocommerce-catalog-enquiry/Woocommerce_Catalog_Enquiry.php 85% from 13 tests

"WC Catalog Enquiry" version 4.0.7's primary PHP file adds more information about the plugin and serves as the entry point for WordPress
Please make the necessary changes and fix the following:
  • Main file name: The principal plugin file should be the same as the plugin slug ("woocommerce-catalog-enquiry.php" instead of "Woocommerce_Catalog_Enquiry.php")
  • Requires at least: Required version must be the same as the one declared in readme.txt ("4.4" instead of "4.2")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short review of files and their extensions; it is not recommended to include executable files
There were no executable files found in this plugin12,828 lines of code in 57 files:
LanguageFilesBlank linesComment linesLines of code
JavaScript121,5113726,825
CSS104032373,120
PHP354353792,883

PHP code Passed 2 tests

This is a short overview of cyclomatic complexity and code structure for this plugin
There were no cyclomatic complexity issued detected
Cyclomatic complexity
Average complexity per logical line of code0.59
Average class complexity57.62
▷ Minimum class complexity3.00
▷ Maximum class complexity324.00
Average method complexity7.47
▷ Minimum method complexity1.00
▷ Maximum method complexity68.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes8
▷ Abstract classes00.00%
▷ Concrete classes8100.00%
▷ Final classes00.00%
Methods70
▷ Static methods34.29%
▷ Public methods70100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions9
▷ Named functions9100.00%
▷ Anonymous functions00.00%
Constants4
▷ Global constants4100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
33 PNG files occupy 0.15MB with 0.08MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/admin/images/colorpicker_rgb_b.png0.95KB0.76KB▼ 19.48%
(invalid) lib/jquery/upload/images/Placeholderdoc.png14.84KB0.00KB▼ 100.00%
lib/jquery/upload/images/Placeholderppt.png8.91KB3.19KB▼ 64.24%
assets/admin/images/colorpicker_hsb_s.png1.14KB0.80KB▼ 29.97%
lib/jquery/upload/images/Placeholderpdf.png14.58KB5.45KB▼ 62.63%