10% wp-businessdirectory

Code Review | WP-BusinessDirectory - Business directory plugin for Wordpress

WordPress plugin WP-BusinessDirectory - Business directory plugin for Wordpress scored10%from 54 tests.

About plugin

  • Plugin page: wp-businessdirectory
  • Plugin version: 3.1.0
  • PHP compatiblity: 7.3.2+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.9-6.3.1
  • WordPress version: 6.3.1
  • First release: Nov 19, 2019
  • Latest release: Oct 6, 2023
  • Number of updates: 45
  • Update frequency: every 31.6 days
  • Top authors: cmsjunkie (100%)

Code review

54 tests

User reviews

10 reviews

Install metrics

50+ active /2,055 total downloads

Benchmarks

Plugin footprint 39% 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
It is recommended to fix the following installer errors
  • The plugin did not install without errors
    • > Notice in wp-content/plugins/wp-businessdirectory/includes/install.php+3871
    Undefined variable: b

Server metrics [RAM: ▲6.45MB] [CPU: ▲37.83ms] 75% from 4 tests

A check of server-side resources used by WP-BusinessDirectory - Business directory plugin for Wordpress
Please fix the following
  • Extra RAM: Extra memory usage must be kept under 5MB (currently 6.45MB on /wp-admin/upload.php)
Page Memory (MB) CPU Time (ms)
Home / 8.85 ▲5.39 85.76 ▲41.42
Dashboard /wp-admin 10.18 ▲6.88 86.64 ▲34.47
Posts /wp-admin/edit.php 10.19 ▲6.83 84.83 ▲35.56
Add New Post /wp-admin/post-new.php 12.60 ▲6.71 145.76 ▲39.85
Media Library /wp-admin/upload.php 10.18 ▲6.96 79.88 ▲42.71

Server storage [IO: ▲99.73MB] [DB: ▲0.53MB] 67% from 3 tests

A short overview of filesystem and database impact
Just a few items left to fix
  • Total filesystem usage must be limited to 25MB (currently using 99.73MB)
Filesystem: 4,810 new files
Database: 146 new tables, 19 new options
New tables
wp_jbusinessdirectory_offer_shipping_methods
wp_jbusinessdirectory_company_reviews
wp_jbusinessdirectory_countries
wp_jbusinessdirectory_company_event_pictures
wp_jbusinessdirectory_attributes
wp_jbusinessdirectory_offer_videos
wp_jbusinessdirectory_conference_session_speakers
wp_jbusinessdirectory_company_review_abuses
wp_jbusinessdirectory_review_pictures
wp_jbusinessdirectory_company_offer_category
...
New WordPress options
widget_wp_businessdirectory_listings_widget
widget_wp_businessdirectory_categories_events_widget
widget_wp_businessdirectory_categories_widget
widget_wp_businessdirectory_events_widget
widget_wp_businessdirectory_categories_offers_widget
widget_wp_businessdirectory_search_offers_widget
widget_theysaidso_widget
widget_recent-posts
widget_wp_businessdirectory_search_events_widget
widget_wp_businessdirectory_search_listings_widget
...

Browser metrics Passed 4 tests

A check of browser resources used by WP-BusinessDirectory - Business directory plugin for Wordpress
There were no issues detected in relation to browser resource usage
Page Nodes Memory (MB) Script (ms) Layout (ms)
Home / 2,997 ▲251 14.43 ▼0.09 41.44 ▲39.84 35.51 ▼7.75
Dashboard /wp-admin 2,260 ▲83 5.56 ▼0.12 81.65 ▼15.29 77.63 ▲35.40
Posts /wp-admin/edit.php 2,177 ▲74 2.00 ▲0.05 37.27 ▼4.08 34.94 ▼1.21
Add New Post /wp-admin/post-new.php 1,601 ▲73 22.94 ▼0.11 685.68 ▼13.96 49.23 ▼4.93
Media Library /wp-admin/upload.php 1,474 ▲74 4.32 ▲0.12 101.12 ▼7.93 70.50 ▲25.61

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

🔸 Tests weight: 35 | The uninstall procedure must remove all plugin files and extra database tables
It is recommended to fix the following
  • The uninstall procedure failed, leaving 4 tables in the database
    • wp_jbusinessdirectory_scheduled_notifications
    • wp_jbusinessdirectory_user_notifications
    • wp_jbusinessdirectory_mobile_app_notifications
    • wp_jbusinessdirectory_mobile_app_menus
  • Zombie WordPress options were found after uninstall: 18 options
    • widget_recent-posts
    • widget_wp_businessdirectory_search_listings_widget
    • widget_wp_businessdirectory_users_widget
    • can_compress_scripts
    • widget_wp_businessdirectory_categories_widget
    • widget_wp_businessdirectory_categories_events_widget
    • widget_theysaidso_widget
    • businessdirectory_admin_notices
    • widget_recent-comments
    • widget_wp_businessdirectory_events_widget
    • ...

Smoke tests 50% 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 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
  • 785× PHP files perform the action of outputting non-empty strings when accessed directly (only 10 are shown):
    • > /wp-content/plugins/wp-businessdirectory/site/controllers/customers.php
    • > /wp-content/plugins/wp-businessdirectory/admin/tables/productmerchants.php
    • > /wp-content/plugins/wp-businessdirectory/admin/views/region/tmpl/edit.php
    • > /wp-content/plugins/wp-businessdirectory/site/views/managestatistics/view.html.php
    • > /wp-content/plugins/wp-businessdirectory/admin/tables/company.php
    • > /wp-content/plugins/wp-businessdirectory/site/views/managelistingregistrations/tmpl/default.php
    • > /wp-content/plugins/wp-businessdirectory/site/classes/payment/paymentcontroller.php
    • > /wp-content/plugins/wp-businessdirectory/admin/views/schedulednotifications/tmpl/default.php
    • > /wp-content/plugins/wp-businessdirectory/admin/controllers/companies.php
    • > /wp-content/plugins/wp-businessdirectory/site/models/suggestions.php
  • 188× GET requests to PHP files have triggered server-side errors or warnings (only 10 are shown):
    • > PHP Fatal error
      require_once(): Failed opening required 'lib/byte_safe_strings.php' (include_path='.:/usr/share/php') in wp-content/plugins/wp-businessdirectory/site/libraries/vendor/paragonie/random_compat/psalm-autoload.php on line 3
    • > PHP Warning
      require_once(BD_HELPERS_PATH/defines.php): failed to open stream: No such file or directory in wp-content/plugins/wp-businessdirectory/includes/widgets/wp-businessdirectory-search-events/wp-businessdirectory-search-events.php on line 11
    • > PHP Fatal error
      require(): Failed opening required 'wp-content/plugins/wp-businessdirectory/site/libraries/vendor/league/oauth2-google/examples/../vendor/autoload.php' (include_path='.:/usr/share/php') in wp-content/plugins/wp-businessdirectory/site/libraries/vendor/league/oauth2-google/examples/provider.php on line 3
    • > PHP Fatal error
      Uncaught Error: Class 'League\\OAuth2\\Client\\Grant\\AbstractGrant' not found in wp-content/plugins/wp-businessdirectory/site/libraries/vendor/league/oauth2-client/src/Grant/RefreshToken.php:22
    • > PHP Notice
      Trying to get property 'ID' of non-object in wp-content/plugins/wp-businessdirectory/site/include/bookmark_utils.php on line 41
    • > PHP Warning
      require_once(WP_BUSINESSDIRECTORY_PATHincludes/mvc/document/Renderer/Html/MessageRenderer.php): failed to open stream: No such file or directory in wp-content/plugins/wp-businessdirectory/includes/mvc/view/WPHtmlView.php on line 12
    • > PHP Warning
      Use of undefined constant BD_HELPERS_PATH - assumed 'BD_HELPERS_PATH' (this will throw an Error in a future version of PHP) in wp-content/plugins/wp-businessdirectory/includes/widgets/wp-businessdirectory-users/wp-businessdirectory-users.php on line 11
    • > PHP Warning
      Use of undefined constant BD_HELPERS_PATH - assumed 'BD_HELPERS_PATH' (this will throw an Error in a future version of PHP) in wp-content/plugins/wp-businessdirectory/includes/widgets/wp-businessdirectory-search-offers/wp-businessdirectory-search-offers.php on line 11
    • > PHP Fatal error
      Uncaught Error: Interface 'Psr\\Http\\Message\\StreamInterface' not found in wp-content/plugins/wp-businessdirectory/site/libraries/vendor/guzzlehttp/psr7/src/FnStream.php:16
    • > PHP Fatal error
      Uncaught Error: Interface 'GuzzleHttp\\MessageFormatterInterface' not found in wp-content/plugins/wp-businessdirectory/site/libraries/vendor/guzzlehttp/guzzle/src/MessageFormatter.php:38

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
No browser issues were found

Optimizations

Plugin configuration Passed 29 tests

readme.txt Passed 16 tests

The readme.txt file is undoubtedly the most important file in your plugin, preparing it for public listing on WordPress.org
10 plugin tags: membership, classifieds, directory mobile app, quote requests, events...

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

The principal PHP file in "WP-BusinessDirectory - Business directory plugin for Wordpress" v. 3.1.0 is loaded by WordPress automatically on each request
31 characters long description:
Professional Business Directory

Code Analysis 0% from 3 tests

File types 0% from 1 test

🔸 Test weight: 35 | An overview of files in this plugin; executable files are not allowed
Almost there! Just fix the following issues
  • 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
703,671 lines of code in 2,446 files:
Language Files Blank lines Comment lines Lines of code
PHP 1,610 40,098 76,492 200,875
INI 140 34,792 136 198,497
JavaScript 189 35,895 38,951 196,561
CSS 100 3,229 1,092 61,810
Sass 67 5,591 15 27,684
XML 87 518 15 5,452
Markdown 26 1,802 0 4,598
SVG 180 1 11 3,464
JSX 17 372 86 2,590
JSON 17 1 0 1,916
HTML 5 5 4 118
YAML 3 4 0 88
make 1 4 0 9
Bourne Shell 3 3 0 7
DOS Batch 1 0 0 2

PHP code 0% from 2 tests

A brief analysis of cyclomatic complexity and code structure for this plugin
These items need your attention
  • Cyclomatic complexity of classes has to be reduced to less than 1000 (currently 1,368)
  • Cyclomatic complexity of methods should be reduced to less than 100 (currently 276)
Cyclomatic complexity
Average complexity per logical line of code 0.45
Average class complexity 22.02
▷ Minimum class complexity 1.00
▷ Maximum class complexity 1,368.00
Average method complexity 3.82
▷ Minimum method complexity 1.00
▷ Maximum method complexity 276.00
Code structure
Namespaces 76
Interfaces 34
Traits 18
Classes 956
▷ Abstract classes 76 7.95%
▷ Concrete classes 880 92.05%
▷ Final classes 38 4.32%
Methods 7,566
▷ Static methods 1,567 20.71%
▷ Public methods 6,430 84.99%
▷ Protected methods 917 12.12%
▷ Private methods 219 2.89%
Functions 332
▷ Named functions 188 56.63%
▷ Anonymous functions 144 43.37%
Constants 936
▷ Global constants 755 80.66%
▷ Class constants 181 19.34%
▷ Public constants 165 91.16%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

Using a strong compression for your PNG files is a great way to speed-up your plugin
693 PNG files occupy 4.56MB with 0.99MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
File Size - original Size - compressed Savings
site/assets/images/directoryApps/jbd_finder_listings.png 2.08KB 1.16KB ▼ 44.40%
site/libraries/phpqrcode/cache/frame_11.png 0.20KB 0.19KB ▼ 6.83%
uploads/pictures/flags/turkey.png 0.89KB 0.97KB 0.00%
uploads/pictures/flags/dominica.png 0.59KB 0.60KB 0.00%
assets/libraries/jquery/images/ui-bg_highlight-soft_100_f6f6f6_1x100.png 0.27KB 0.11KB ▼ 57.76%