77% woocommerce-ajax-filters

Code Review | Advanced AJAX Product Filters

WordPress plugin Advanced AJAX Product Filters scored77%from 54 tests.

About plugin

  • Plugin page: woocommerce-ajax-...
  • Plugin version: 1.6.4.5
  • PHP version: 7.4.16
  • WordPress compatibility: 5.0-6.3.1
  • WordPress version: 6.3.1
  • First release: Dec 10, 2014
  • Latest release: Sep 21, 2023
  • Number of updates: 265
  • Update frequency: every 12.1 days
  • Top authors: RazyRx (50.19%)dholovnia (50.19%)

Code review

54 tests

User reviews

342 reviews

Install metrics

60,000+ active /1,336,391 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Verifying that this plugin installs correctly without errors
The plugin installed successfully, without throwing any errors or notices

Server metrics [RAM: ▲0.44MB] [CPU: ▼7.07ms] Passed 4 tests

Server-side resources used by Advanced AJAX Product Filters
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /3.91 ▲0.4438.65 ▼4.24
Dashboard /wp-admin3.79 ▲0.4449.90 ▼11.15
Posts /wp-admin/edit.php3.84 ▲0.4848.26 ▼2.24
Add New Post /wp-admin/post-new.php6.32 ▲0.4490.27 ▼10.63
Media Library /wp-admin/upload.php3.65 ▲0.4240.03 ▲5.69

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

Input-output and database impact of this plugin
This plugin was installed successfully
Filesystem: 302 new files
Database: no new tables, 8 new options
New WordPress options
widget_theysaidso_widget
can_compress_scripts
berocket_admin_notices_rate_stars
theysaidso_admin_options
db_upgraded
widget_recent-comments
widget_recent-posts
br_filters_options

Browser metrics Passed 4 tests

This is an overview of browser requirements for Advanced AJAX Product Filters
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,867 ▲12113.27 ▼1.081.82 ▼0.1443.69 ▼2.60
Dashboard /wp-admin2,236 ▲486.02 ▲0.20102.73 ▼1.6170.27 ▲28.25
Posts /wp-admin/edit.php2,130 ▲412.05 ▲0.0636.90 ▼2.1535.08 ▲1.28
Add New Post /wp-admin/post-new.php1,555 ▲4123.30 ▲5.57790.95 ▲101.0355.44 ▼0.31
Media Library /wp-admin/upload.php1,424 ▲394.28 ▲0.07107.61 ▼7.3379.99 ▲30.95

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
  • Zombie WordPress options detected upon uninstall: 9 options
    • db_upgraded
    • widget_recent-comments
    • br_filters_options
    • widget_recent-posts
    • can_compress_scripts
    • widget_theysaidso_widget
    • berocket_admin_notices_rate_stars
    • berocket_key_activated_plugins
    • theysaidso_admin_options

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the server (in the Apache logs)
Even though everything seems fine, this is not 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/woocommerce-ajax-filters/templates/free/features.php
  • 135× GET requests to PHP files have triggered server-side errors or warnings (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'BeRocket_framework_addon_lib' not found in wp-content/plugins/woocommerce-ajax-filters/addons/custom_search/custom_search.php:2
    • > PHP Fatal error
      Uncaught Error: Class 'BeRocket_AAPF_Template_Style' not found in wp-content/plugins/woocommerce-ajax-filters/template_styles/new-slider.php:3
    • > PHP Fatal error
      Uncaught Error: Class 'BeRocket_AAPF_Template_Style' not found in wp-content/plugins/woocommerce-ajax-filters/template_styles/buttons.php:3
    • > PHP Fatal error
      Uncaught Error: Class 'BeRocket_framework_addon_lib' not found in wp-content/plugins/woocommerce-ajax-filters/addons/separate_link/separate_link.php:2
    • > PHP Fatal error
      Uncaught Error: Class 'BeRocket_conditions' not found in wp-content/plugins/woocommerce-ajax-filters/includes/custom_post.php:2
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/woocommerce-ajax-filters/includes/url-parse.php:12
    • > PHP Warning
      include_once(): Failed opening 'ABSPATHwp-admin/includes/plugin.php' for inclusion (include_path='.:/usr/share/php') in wp-content/plugins/woocommerce-ajax-filters/includes/widget_functions.php on line 3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_filter() in wp-content/plugins/woocommerce-ajax-filters/includes/template_builder.php:6
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_filter() in wp-content/plugins/woocommerce-ajax-filters/includes/compatibility/woo-multi-currency.php:6
    • > PHP Fatal error
      Uncaught Error: Call to undefined function __() in wp-content/plugins/woocommerce-ajax-filters/templates/groups_information.php:2

User-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the browser (console and network errors and warnings)
No browser issues were found

Optimizations

Plugin configuration 87% from 29 tests

readme.txt 88% from 16 tests

The readme.txt file is undoubtedly the most important file in your plugin, preparing it for public listing on WordPress.org
These attributes need to be fixed:
  • Tags: You are using too many tags: 52 tag instead of maximum 10
  • Screenshots: These screenshots have no corresponding images in /assets: #1 (General settings), #2 (JavaScript settings), #3 (Widget)
You can look at the official readme.txt

woocommerce-ajax-filters/woocommerce-filters.php 85% from 13 tests

The main PHP file in "Advanced AJAX Product Filters" ver. 1.6.4.5 adds more information about the plugin and also serves as the entry point for this plugin
It is important to fix the following:
  • Text Domain: The text domain follows the same naming rules as the plugin slug: lowercase characters and dashes
  • Main file name: The principal plugin file should be the same as the plugin slug ("woocommerce-ajax-filters.php" instead of "woocommerce-filters.php")

Code Analysis 97% from 3 tests

File types Passed 1 test

🔸 Test weight: 35 | Executable files are not allowed as they can serve as attack vectors
Success! There were no dangerous files found in this plugin51,499 lines of code in 204 files:
LanguageFilesBlank linesComment linesLines of code
PHP1407433,32325,333
CSS312,77314614,805
JavaScript235703836,790
PO File41,7562,3664,284
JSX4183223
XML20064

PHP code 50% from 2 tests

Analyzing cyclomatic complexity and code structure
Please fix the following
  • Please reduce cyclomatic complexity of methods to less than 100 (currently 168)
Cyclomatic complexity
Average complexity per logical line of code0.51
Average class complexity32.57
▷ Minimum class complexity1.00
▷ Maximum class complexity420.00
Average method complexity4.61
▷ Minimum method complexity1.00
▷ Maximum method complexity168.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes128
▷ Abstract classes00.00%
▷ Concrete classes128100.00%
▷ Final classes00.00%
Methods1,120
▷ Static methods28125.09%
▷ Public methods1,10698.75%
▷ Protected methods00.00%
▷ Private methods141.25%
Functions85
▷ Named functions85100.00%
▷ Anonymous functions00.00%
Constants10
▷ Global constants10100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
71 compressed PNG files occupy 0.21MB
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
template_styles/images/slider.png1.75KB1.81KB0.00%
template_styles/images/selected_filters_area-inline.png1.55KB1.64KB0.00%
template_styles/images/image_woborder.png2.02KB2.04KB0.00%
images/themes/sidebar-shadow/b2.png22.09KB23.03KB0.00%
images/themes/sidebar-shadow/default.png1.62KB1.68KB0.00%