74% wc-ajax-product-filter

Code Review | WCAPF - WooCommerce Ajax Product Filter

WordPress plugin WCAPF - WooCommerce Ajax Product Filter scored74%from 54 tests.

About plugin

  • Plugin page: wc-ajax-product-f...
  • Plugin version: 4.2.0
  • PHP compatiblity: 7.2+
  • PHP version: 7.4.16
  • WordPress compatibility: 6.0-6.3
  • WordPress version: 6.3.1
  • First release: Nov 12, 2015
  • Latest release: Aug 27, 2023
  • Number of updates: 39
  • Update frequency: every 73.0 days
  • Top authors: shamimmoeen (100%)

Code review

54 tests

User reviews

30 reviews

Install metrics

10,000+ active /123,941 total downloads

Benchmarks

Plugin footprint 65% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
Installer ran successfully

Server metrics [RAM: ▼0.01MB] [CPU: ▼6.36ms] Passed 4 tests

Server-side resources used by WCAPF - WooCommerce Ajax Product Filter
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /3.47 ▲0.0037.07 ▼5.00
Dashboard /wp-admin3.31 ▼0.0444.47 ▼11.49
Posts /wp-admin/edit.php3.36 ▲0.0048.30 ▲1.14
Add New Post /wp-admin/post-new.php5.89 ▲0.0090.05 ▼10.06
Media Library /wp-admin/upload.php3.23 ▲0.0033.39 ▲1.10

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

Filesystem and database footprint
There were no storage issued detected upon installing this plugin
Filesystem: 90 new files
Database: no new tables, 6 new options
New WordPress options
widget_recent-comments
widget_theysaidso_widget
widget_recent-posts
theysaidso_admin_options
can_compress_scripts
db_upgraded

Browser metrics Passed 4 tests

This is an overview of browser requirements for WCAPF - WooCommerce Ajax Product Filter
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,825 ▲7913.38 ▼1.004.56 ▲2.9543.86 ▲0.84
Dashboard /wp-admin2,209 ▲214.87 ▼1.01101.41 ▼2.5539.93 ▼3.27
Posts /wp-admin/edit.php2,089 ▲32.00 ▲0.0239.30 ▲1.9734.85 ▲0.00
Add New Post /wp-admin/post-new.php1,546 ▲1818.28 ▼0.01632.16 ▼19.9371.01 ▲8.84
Media Library /wp-admin/upload.php1,388 ▲34.21 ▼0.0195.15 ▼5.1343.85 ▲0.28

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

🔸 Tests weight: 35 | The uninstall procedure must remove all plugin files and extra database tables
Please fix the following items
  • This plugin did not uninstall without warnings or errors
    • > Notice in wp-content/plugins/wc-ajax-product-filter/wc-ajax-product-filter.php+323
    Trying to access array offset on value of type bool
  • The uninstall procedure has failed, leaving 6 options in the database
    • widget_recent-posts
    • theysaidso_admin_options
    • can_compress_scripts
    • db_upgraded
    • widget_recent-comments
    • widget_theysaidso_widget

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
Good news, no errors were detected

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
  • 48× GET requests to PHP files trigger server-side errors or Error 500 responses (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_attr() in wp-content/plugins/wc-ajax-product-filter/templates/search-box.php:29
    • > PHP Fatal error
      Uncaught Error: Class 'WCAPF_Helper' not found in wp-content/plugins/wc-ajax-product-filter/templates/active-filters.php:21
    • > PHP Fatal error
      Uncaught Error: Class 'WCAPF_Filter_Type' not found in wp-content/plugins/wc-ajax-product-filter/includes/filter-types/class-wcapf-filter-type-post-meta.php:16
    • > PHP Warning
      Use of undefined constant WCAPF_PLUGIN_DIR - assumed 'WCAPF_PLUGIN_DIR' (this will throw an Error in a future version of PHP) in wp-content/plugins/wc-ajax-product-filter/includes/wcapf-dependencies.php on line 8
    • > PHP Notice
      Undefined variable: display_values_as in wp-content/plugins/wc-ajax-product-filter/templates/range.php on line 69
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/wc-ajax-product-filter/includes/hooks/class-wcapf-hooks.php:405
    • > PHP Notice
      Undefined variable: min_value in wp-content/plugins/wc-ajax-product-filter/templates/range.php on line 62
    • > PHP Fatal error
      Uncaught Error: Class 'WCAPF_Filter_Type' not found in wp-content/plugins/wc-ajax-product-filter/includes/filter-types/class-wcapf-filter-type-taxonomy.php:16
    • > PHP Fatal error
      Uncaught Error: Class 'WP_Widget' not found in wp-content/plugins/wc-ajax-product-filter/includes/widgets/class-wcapf-filter-widget.php:16
    • > PHP Notice
      Undefined variable: range_max_value in wp-content/plugins/wc-ajax-product-filter/templates/range.php on line 61

User-side errors Passed 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
Everything seems fine, but this is not an exhaustive test

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
Please fix the following attributes:
  • Tags: Too many tags (22 tag instead of maximum 10); only the first 5 tags are used in your directory listing
The official readme.txt is a good inspiration

wc-ajax-product-filter/wc-ajax-product-filter.php Passed 13 tests

"WCAPF - WooCommerce Ajax Product Filter" version 4.2.0's main PHP file describes plugin functionality and also serves as the entry point to any WordPress functionality
58 characters long description:
A plugin to filter WooCommerce products with AJAX request.

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
Good job! No executable or dangerous file extensions detected14,469 lines of code in 83 files:
LanguageFilesBlank linesComment linesLines of code
PHP472,2813,0347,473
JavaScript143035914,549
CSS11343692,191
SVG900175
HTML116076
JSON1005

PHP code Passed 2 tests

A brief analysis of cyclomatic complexity and code structure for this plugin
Although this was not an exhaustive test, there were no cyclomatic complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.35
Average class complexity31.18
▷ Minimum class complexity1.00
▷ Maximum class complexity138.00
Average method complexity3.64
▷ Minimum method complexity1.00
▷ Maximum method complexity52.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes33
▷ Abstract classes13.03%
▷ Concrete classes3296.97%
▷ Final classes00.00%
Methods371
▷ Static methods10728.84%
▷ Public methods21557.95%
▷ Protected methods4411.86%
▷ Private methods11230.19%
Functions8
▷ Named functions450.00%
▷ Anonymous functions450.00%
Constants5
▷ Global constants5100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Using a strong compression for your PNG files is a great way to speed-up your plugin
PNG images were not found in this plugin