78% business-hours-indicator

Code Review | Business Hours Indicator

WordPress plugin Business Hours Indicator scored78%from 54 tests.

About plugin

  • Plugin page: business-hours-in...
  • Plugin version: 2.3.9
  • PHP compatiblity: 5.6+
  • PHP version: 7.4.16
  • WordPress compatibility: 3.7-6.2.2
  • WordPress version: 6.3.1
  • First release: Sep 4, 2016
  • Latest release: Jun 23, 2023
  • Number of updates: 104
  • Update frequency: every 23.9 days
  • Top authors: maartenbelmans (90.38%)studiowombat (10.58%)

Code review

54 tests

User reviews

59 reviews

Install metrics

9,000+ active /155,470 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | All plugins must install correctly, without throwing any errors, warnings, or notices
The plugin installed gracefully, with no errors

Server metrics [RAM: ▲0.14MB] [CPU: ▼8.47ms] Passed 4 tests

Server-side resources used by Business Hours Indicator
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /3.60 ▲0.1436.81 ▼1.73
Dashboard /wp-admin3.45 ▲0.1443.84 ▼2.42
Posts /wp-admin/edit.php3.56 ▲0.2050.26 ▲8.74
Add New Post /wp-admin/post-new.php6.03 ▲0.1480.34 ▼30.48
Media Library /wp-admin/upload.php3.37 ▲0.1436.55 ▲0.75
Business Hours Indicator /wp-admin/options-general.php?page=business-hours-indicator3.4332.10

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

Analyzing filesystem and database footprints of this plugin
This plugin was installed successfully
Filesystem: 87 new files
Database: no new tables, 10 new options
New WordPress options
widget_bhi_widget_displayopeninghours
can_compress_scripts
widget_bhi_widget_isopen
widget_bhi_widget_isclosed
widget_recent-posts
widget_bhi_widget_displaybusinesshoursindicator
widget_recent-comments
widget_theysaidso_widget
db_upgraded
theysaidso_admin_options

Browser metrics Passed 4 tests

A check of browser resources used by Business Hours Indicator
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,804 ▲5814.72 ▲0.271.78 ▲0.1940.80 ▼0.37
Dashboard /wp-admin2,207 ▲185.82 ▲0.89104.55 ▼3.7341.56 ▲0.71
Posts /wp-admin/edit.php2,093 ▲12.06 ▲0.0435.43 ▼4.9934.34 ▼2.83
Add New Post /wp-admin/post-new.php1,536 ▲521.15 ▲3.04726.06 ▲79.0261.79 ▲5.42
Media Library /wp-admin/upload.php1,392 ▲14.19 ▲0.0197.00 ▲0.4940.24 ▼5.67
Business Hours Indicator /wp-admin/options-general.php?page=business-hours-indicator3,2112.3850.2630.12

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: 10 options
    • widget_bhi_widget_isclosed
    • db_upgraded
    • widget_theysaidso_widget
    • widget_bhi_widget_isopen
    • can_compress_scripts
    • theysaidso_admin_options
    • widget_bhi_widget_displayopeninghours
    • widget_recent-posts
    • widget_bhi_widget_displaybusinesshoursindicator
    • widget_recent-comments

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no server-side errors were triggered
Everything seems fine, however this is by no means an exhaustive test

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 fix the following items
  • 2× PHP files perform the action of outputting non-empty strings when accessed directly:
    • > /wp-content/plugins/business-hours-indicator/core/templates/widget_form.php
    • > /wp-content/plugins/business-hours-indicator/templates/ifopenclosed.php
  • 32× PHP files trigger errors when accessed directly with GET requests (only 10 are shown):
    • > PHP Notice
      Undefined variable: model in wp-content/plugins/business-hours-indicator/templates/list.php on line 12
    • > PHP Notice
      Undefined variable: option_manager in wp-content/plugins/business-hours-indicator/core/templates/widget_form.php on line 7
    • > PHP Fatal error
      Uncaught TypeError: Argument 1 passed to render_normal_hours() must be of the type array, null given, called in wp-content/plugins/business-hours-indicator/templates/list.php on line 18 and defined in wp-content/plugins/business-hours-indicator/templates/_helpers.php:4
    • > PHP Notice
      Undefined variable: model in wp-content/plugins/business-hours-indicator/templates/ifopenclosed.php on line 8
    • > PHP Notice
      Undefined variable: model in wp-content/plugins/business-hours-indicator/templates/list.php on line 15
    • > PHP Notice
      Trying to get property 'has_current' of non-object in wp-content/plugins/business-hours-indicator/templates/list.php on line 17
    • > PHP Fatal error
      Uncaught Error: Class 'MABEL_BHI_LITE\\Core\\Config_Manager' not found in wp-content/plugins/business-hours-indicator/admin/views/sidebar-main.php:2
    • > PHP Fatal error
      Uncaught Error: Class 'MABEL_BHI_LITE\\Core\\Models\\Option' not found in wp-content/plugins/business-hours-indicator/core/models/class-custom-option.php:6
    • > PHP Notice
      Trying to get property 'show_location_error' of non-object in wp-content/plugins/business-hours-indicator/templates/ifopenclosed.php on line 3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function _e() in wp-content/plugins/business-hours-indicator/admin/views/sidebar-list.php:2

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
No browser errors were detected

Optimizations

Plugin configuration 96% from 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: opening times, open times, closed, open indication, business hours...

business-hours-indicator/mabel-business-hours-indicator.php 92% from 13 tests

"Business Hours Indicator" version 2.3.9's main PHP file describes plugin functionality and also serves as the entry point to any WordPress functionality
You should first fix the following items:
  • Main file name: It is recommended to name the main PHP file as the plugin slug ("business-hours-indicator.php" instead of "mabel-business-hours-indicator.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | Executable files are considered dangerous and should not be included with any WordPress plugin
There were no executable files found in this plugin2,813 lines of code in 54 files:
LanguageFilesBlank linesComment linesLines of code
PHP52731892,802
JavaScript10010
CSS1001

PHP code Passed 2 tests

A brief analysis of cyclomatic complexity and code structure for this plugin
There were no cyclomatic complexity issued detected
Cyclomatic complexity
Average complexity per logical line of code0.38
Average class complexity8.03
▷ Minimum class complexity1.00
▷ Maximum class complexity62.00
Average method complexity2.45
▷ Minimum method complexity1.00
▷ Maximum method complexity21.00
Code structure
Namespaces8
Interfaces0
Traits0
Classes36
▷ Abstract classes12.78%
▷ Concrete classes3597.22%
▷ Final classes00.00%
Methods147
▷ Static methods138.84%
▷ Public methods12484.35%
▷ Protected methods00.00%
▷ Private methods2315.65%
Functions25
▷ Named functions624.00%
▷ Anonymous functions1976.00%
Constants1
▷ Global constants1100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

It is recommended to compress PNG files in your plugin to minimize bandwidth usage
1 PNG file occupies 0.02MB with 0.01MB in potential savings
Potential savings
Compression of 1 random PNG file using pngquant
FileSize - originalSize - compressedSavings
admin/img/bhilogo.png15.75KB9.01KB▼ 42.79%