10% wp-businessdirectory

Code Review | WP-BusinessDirectory

WordPress plugin WP-BusinessDirectory scored 10% from 54 tests.

About plugin

  • Plugin page: wp-businessdirectory
  • Plugin version: 2.0.2
  • PHP compatiblity: 7.3.2+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.9-5.7.2
  • WordPress version: 5.9.2
  • First release: Nov 19, 2019
  • Latest release: Oct 28, 2021
  • Number of updates: 27
  • Update frequency: every 26.4 days
  • Top authors: cmsjunkie (100%)

Code review

54 tests

User reviews

6 reviews

Install metrics

40+ active / 1,356 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
The following installer errors require your attention
  • The plugin did not install without errors
    • > Warning in wp-content/plugins/wp-businessdirectory/site/helpers/utils.php+441
    Invalid argument supplied for foreach()

Server metrics [RAM: ▼2.21MB] [CPU: ▼340.57ms] Passed 4 tests

Analyzing server-side resources used by WP-BusinessDirectory
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /2.16 ▼1.367.04 ▼42.42
Dashboard /wp-admin2.18 ▼1.235.44 ▼28.69
Posts /wp-admin/edit.php2.18 ▼1.466.09 ▼32.77
Add New Post /wp-admin/post-new.php2.18 ▼4.795.89 ▼1,258.38
Media Library /wp-admin/upload.php2.18 ▼1.125.40 ▼25.73
Widgets /wp-admin/widgets.php2.185.49
Menus /wp-admin/nav-menus.php2.196.91

Server storage [IO: ▲48.83MB] [DB: ▲0.42MB] 67% from 3 tests

Analyzing filesystem and database footprints of this plugin
These are issues you should consider
  • Total filesystem usage should be limited to 25MB (currently using 48.83MB)
Filesystem: 3,357 new files
Database: 127 new tables, 13 new options
New tables
wp_jbusinessdirectory_shipping_methods
wp_jbusinessdirectory_language_translations
wp_jbusinessdirectory_attribute_category
wp_jbusinessdirectory_mobile_devices
wp_jbusinessdirectory_categories
wp_jbusinessdirectory_orders
wp_jbusinessdirectory_company_projects
wp_jbusinessdirectory_statistics_archive
wp_jbusinessdirectory_attribute_types
wp_jbusinessdirectory_company_editors
...
New WordPress options
wpbd_db_version
widget_wp_businessdirectory_search_events_widget
widget_wp_businessdirectory_users_widget
widget_wp_businessdirectory_categories_events_widget
widget_wp_businessdirectory_search_offers_widget
widget_wp_businessdirectory_categories_widget
businessdirectory_admin_notices
widget_wp_businessdirectory_listings_widget
widget_wp_businessdirectory_categories_offers_widget
widget_wp_businessdirectory_offers_widget
...

Browser metrics Passed 4 tests

An overview of browser requirements for WP-BusinessDirectory
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /4,034 ▲28017.26 ▲1.3520.49 ▲14.972.55 ▲0.15
Dashboard /wp-admin2,990 ▲1326.15 ▼0.19111.82 ▼20.60182.62 ▲25.04
Posts /wp-admin/edit.php2,788 ▲943.25 ▲0.0163.24 ▲0.64139.99 ▼1.49
Add New Post /wp-admin/post-new.php1,811 ▲5322.06 ▲0.06428.93 ▲14.63187.54 ▲32.88
Media Library /wp-admin/upload.php1,797 ▲995.54 ▲0.03121.80 ▼11.81199.44 ▲7.41
Widgets /wp-admin/widgets.php2,56224.05501.97167.04
Menus /wp-admin/nav-menus.php3,5463.3884.10141.60

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

🔸 Tests weight: 35 | The uninstall procedure must remove all plugin files and extra database tables
You still need to fix the following
  • This plugin cannot be uninstalled
    • > Warning in wp-content/plugins/wp-businessdirectory/site/helpers/utils.php+441
    Invalid argument supplied for foreach()
  • This plugin does not fully uninstall, leaving 12 options in the database
    • widget_wp_businessdirectory_users_widget
    • widget_wp_businessdirectory_offers_widget
    • wpbd_plugin_version
    • widget_wp_businessdirectory_search_offers_widget
    • widget_wp_businessdirectory_categories_events_widget
    • widget_wp_businessdirectory_categories_offers_widget
    • widget_wp_businessdirectory_listings_widget
    • widget_wp_businessdirectory_search_events_widget
    • widget_wp_businessdirectory_categories_widget
    • businessdirectory_admin_notices
    • ...

Smoke tests 25% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | A shallow check that no server-side errors were triggered
Please fix the following server-side errors
  • 16 occurences, only the last one shown
    • > GET request to /wp-admin/nav-menus.php
    • > Warning in wp-content/plugins/wp-businessdirectory/site/helpers/utils.php+441
    Invalid argument supplied for foreach()

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
The following issues need your attention
  • 693× PHP files output non-empty strings when accessed directly via GET requests (only 10 are shown):
    • > /wp-content/plugins/wp-businessdirectory/admin/models/reviewresponses.php
    • > /wp-content/plugins/wp-businessdirectory/admin/controllers/offertypes.php
    • > /wp-content/plugins/wp-businessdirectory/admin/tables/companytypes.php
    • > /wp-content/plugins/wp-businessdirectory/admin/tables/eventtype.php
    • > /wp-content/plugins/wp-businessdirectory/admin/tables/shippingmethod.php
    • > /wp-content/plugins/wp-businessdirectory/admin/tables/registeredcompany.php
    • > /wp-content/plugins/wp-businessdirectory/admin/views/cities/tmpl/default.php
    • > /wp-content/plugins/wp-businessdirectory/admin/tables/company.php
    • > /wp-content/plugins/wp-businessdirectory/admin/controllers/applicationsettings.php
    • > /wp-content/plugins/wp-businessdirectory/includes/widgets/wp-businessdirectory-categories-offers/tmpl/default_boxes.php
  • 159× PHP files trigger server errors when accessed directly (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'MVC\\Application\\Cli\\Output\\Processor\\ColorProcessor' not found in wp-content/plugins/wp-businessdirectory/includes/mvc/vendor/joomla/application/src/Cli/ColorProcessor.php:19
    • > PHP Fatal error
      Uncaught Error: Interface 'Psr\\Http\\Message\\MessageInterface' not found in wp-content/plugins/wp-businessdirectory/site/libraries/vendor/psr/http-message/src/ResponseInterface.php:20
    • > PHP Fatal error
      Uncaught Error: Interface 'GuzzleHttp\\ClientInterface' not found in wp-content/plugins/wp-businessdirectory/site/libraries/vendor/guzzlehttp/guzzle/src/Client.php:25
    • > PHP Fatal error
      Uncaught Error: Class 'GuzzleHttp\\Exception\\TransferException' not found in wp-content/plugins/wp-businessdirectory/site/libraries/vendor/guzzlehttp/guzzle/src/Exception/RequestException.php:12
    • > PHP Warning
      require(wp-content/plugins/wp-businessdirectory/site/libraries/vendor/league/oauth2-google/examples/../vendor/autoload.php): failed to open stream: No such file or directory in wp-content/plugins/wp-businessdirectory/site/libraries/vendor/league/oauth2-google/examples/provider.php on line 3
    • > PHP Warning
      require_once(lib/byte_safe_strings.php): failed to open stream: No such file or directory in wp-content/plugins/wp-businessdirectory/site/libraries/vendor/paragonie/random_compat/psalm-autoload.php on line 3
    • > PHP Fatal error
      require_once(): Failed opening required 'BD_HELPERS_PATH/defines.php' (include_path='.:/usr/share/php') in wp-content/plugins/wp-businessdirectory/includes/widgets/wp-businessdirectory-events/wp-businessdirectory-events.php on line 12
    • > PHP Fatal error
      require_once(): Failed opening required 'BD_HELPERS_PATH/defines.php' (include_path='.:/usr/share/php') in wp-content/plugins/wp-businessdirectory/includes/widgets/wp-businessdirectory-categories/wp-businessdirectory-categories.php on line 12
    • > PHP Fatal error
      Uncaught Error: Interface 'Psr\\Http\\Message\\StreamInterface' not found in wp-content/plugins/wp-businessdirectory/site/libraries/vendor/guzzlehttp/psr7/src/DroppingStream.php:10
    • > PHP Fatal error
      require_once(): Failed opening required 'BD_HELPERS_PATH/defines.php' (include_path='.:/usr/share/php') in wp-content/plugins/wp-businessdirectory/includes/widgets/wp-businessdirectory-categories-offers/wp-businessdirectory-categories-offers.php on line 12

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)
Everything seems fine, but this is not an exhaustive test

Optimizations

Plugin configuration Passed 29 tests

readme.txt Passed 16 tests

It's important to format your readme.txt file correctly as it is parsed for the public listing of your plugin
2 plugin tags: directory, business directory

wp-businessdirectory/wp-businessdirectory.php Passed 13 tests

"WP-BusinessDirectory" version 2.0.2's primary PHP file adds more information about the plugin and serves as the entry point for WordPress
31 characters long description:
Professional Business Directory

Code Analysis 3% from 3 tests

File types 0% from 1 test

🔸 Test weight: 35 | A short review of files and their extensions; it is not recommended to include executable files
It is important to fix the following items
  • You should never include executable (binary) or otherwise dangerous files in your plugin
    • .bat - Batch File in Windows
      • wp-content/plugins/wp-businessdirectory/site/libraries/phpqrcode/tools/merge.bat
434,212 lines of code in 1,901 files:
LanguageFilesBlank linesComment linesLines of code
PHP1,47535,25771,158172,910
JavaScript14220,98821,929113,241
INI4915,52310690,035
CSS711,91359730,991
Sass352,605513,377
XML81499115,109
Markdown181,38103,923
SVG2132,626
JSX71301935
JSON1110930
HTML554117
make1409
Bourne Shell3307
DOS Batch1002

PHP code 50% from 2 tests

A brief analysis of cyclomatic complexity and code structure for this plugin
It is recommended to fix the following
  • Method cyclomatic complexity has to be reduced to less than 100 (currently 239)
Cyclomatic complexity
Average complexity per logical line of code0.44
Average class complexity21.28
▷ Minimum class complexity1.00
▷ Maximum class complexity996.00
Average method complexity3.74
▷ Minimum method complexity1.00
▷ Maximum method complexity239.00
Code structure
Namespaces71
Interfaces22
Traits16
Classes881
▷ Abstract classes768.63%
▷ Concrete classes80591.37%
▷ Final classes121.49%
Methods6,876
▷ Static methods1,36019.78%
▷ Public methods5,81784.60%
▷ Protected methods84312.26%
▷ Private methods2163.14%
Functions286
▷ Named functions17159.79%
▷ Anonymous functions11540.21%
Constants819
▷ Global constants65579.98%
▷ Class constants16420.02%
▷ Public constants164100.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
505 PNG files occupy 3.64MB with 0.96MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/libraries/leaflet/fullscreen@2x.png0.41KB0.15KB▼ 63.10%
uploads/pictures/flags/myanmar.png0.71KB0.83KB0.00%
uploads/pictures/flags/canada.png0.56KB0.62KB0.00%
assets/images/map_gdpr.png40.32KB14.59KB▼ 63.82%
site/libraries/phpqrcode/cache/frame_14.png0.21KB0.20KB▼ 4.69%