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)
PageMemory (MB)CPU Time (ms)
Home /8.85 ▲5.3985.76 ▲41.42
Dashboard /wp-admin10.18 ▲6.8886.64 ▲34.47
Posts /wp-admin/edit.php10.19 ▲6.8384.83 ▲35.56
Add New Post /wp-admin/post-new.php12.60 ▲6.71145.76 ▲39.85
Media Library /wp-admin/upload.php10.18 ▲6.9679.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
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,997 ▲25114.43 ▼0.0941.44 ▲39.8435.51 ▼7.75
Dashboard /wp-admin2,260 ▲835.56 ▼0.1281.65 ▼15.2977.63 ▲35.40
Posts /wp-admin/edit.php2,177 ▲742.00 ▲0.0537.27 ▼4.0834.94 ▼1.21
Add New Post /wp-admin/post-new.php1,601 ▲7322.94 ▼0.11685.68 ▼13.9649.23 ▼4.93
Media Library /wp-admin/upload.php1,474 ▲744.32 ▲0.12101.12 ▼7.9370.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:
LanguageFilesBlank linesComment linesLines of code
PHP1,61040,09876,492200,875
INI14034,792136198,497
JavaScript18935,89538,951196,561
CSS1003,2291,09261,810
Sass675,5911527,684
XML87518155,452
Markdown261,80204,598
SVG1801113,464
JSX17372862,590
JSON17101,916
HTML554118
YAML34088
make1409
Bourne Shell3307
DOS Batch1002

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 code0.45
Average class complexity22.02
▷ Minimum class complexity1.00
▷ Maximum class complexity1,368.00
Average method complexity3.82
▷ Minimum method complexity1.00
▷ Maximum method complexity276.00
Code structure
Namespaces76
Interfaces34
Traits18
Classes956
▷ Abstract classes767.95%
▷ Concrete classes88092.05%
▷ Final classes384.32%
Methods7,566
▷ Static methods1,56720.71%
▷ Public methods6,43084.99%
▷ Protected methods91712.12%
▷ Private methods2192.89%
Functions332
▷ Named functions18856.63%
▷ Anonymous functions14443.37%
Constants936
▷ Global constants75580.66%
▷ Class constants18119.34%
▷ Public constants16591.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
FileSize - originalSize - compressedSavings
site/assets/images/directoryApps/jbd_finder_listings.png2.08KB1.16KB▼ 44.40%
site/libraries/phpqrcode/cache/frame_11.png0.20KB0.19KB▼ 6.83%
uploads/pictures/flags/turkey.png0.89KB0.97KB0.00%
uploads/pictures/flags/dominica.png0.59KB0.60KB0.00%
assets/libraries/jquery/images/ui-bg_highlight-soft_100_f6f6f6_1x100.png0.27KB0.11KB▼ 57.76%