62% business-hours-plugin

Code Review | Business Hours Plugin

WordPress plugin Business Hours Plugin scored62%from 54 tests.

About plugin

  • Plugin page: business-hours-pl...
  • Plugin version: 2.0
  • PHP version: 7.4.16
  • WordPress compatibility: 3.1-3.5
  • WordPress version: 6.3.1
  • First release: Nov 24, 2011
  • Latest release: Dec 21, 2012
  • Number of updates: 34
  • Update frequency: every 11.6 days
  • Top authors: MZAWeb (100%)

Code review

54 tests

User reviews

5 reviews

Install metrics

700+ active /18,909 total downloads

Benchmarks

Plugin footprint 65% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
Installer ran successfully

Server metrics [RAM: ▼1.73MB] [CPU: ▼45.86ms] Passed 4 tests

This is a short check of server-side resources used by Business Hours Plugin
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /2.23 ▼1.237.83 ▼30.60
Dashboard /wp-admin2.29 ▼1.0211.08 ▼35.07
Posts /wp-admin/edit.php2.29 ▼1.079.59 ▼34.88
Add New Post /wp-admin/post-new.php2.29 ▼3.6011.75 ▼82.88
Media Library /wp-admin/upload.php2.29 ▼0.9410.49 ▼22.05
Business Hours /wp-admin/options-general.php?page=business-hours2.2910.16

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

Analyzing filesystem and database footprints of this plugin
This plugin was installed successfully
Filesystem: 40 new files
Database: no new tables, 7 new options
New WordPress options
can_compress_scripts
theysaidso_admin_options
widget_recent-posts
widget_theysaidso_widget
db_upgraded
widget_recent-comments
widget_workinghourswidget

Browser metrics Passed 4 tests

A check of browser resources used by Business Hours Plugin
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,793 ▲3214.35 ▼0.001.79 ▲0.0944.98 ▲4.29
Dashboard /wp-admin2,193 ▲135.55 ▼0.1186.83 ▼1.0137.35 ▼9.57
Posts /wp-admin/edit.php2,104 ▲42.03 ▼0.0137.10 ▼0.4235.10 ▲0.76
Add New Post /wp-admin/post-new.php1,531 ▲323.03 ▲0.04646.10 ▼41.9753.16 ▲3.24
Media Library /wp-admin/upload.php1,404 ▲44.16 ▼0.0495.49 ▼6.1744.14 ▼1.44
Business Hours /wp-admin/options-general.php?page=business-hours1,3672.0121.6040.32

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

🔸 Tests weight: 35 | The uninstall procedure must remove all plugin files and extra database tables
These items require your attention
  • The plugin did not uninstall gracefully
    • > Deprecated in wp-content/plugins/business-hours-plugin/lib/BusinessHoursWidget.class.php+4
    Methods with the same name as their class will not be constructors in a future version of PHP; BusinessHoursWidget has a deprecated constructor
  • Zombie WordPress options detected upon uninstall: 7 options
    • can_compress_scripts
    • widget_workinghourswidget
    • theysaidso_admin_options
    • widget_theysaidso_widget
    • widget_recent-comments
    • widget_recent-posts
    • db_upgraded

Smoke tests 25% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | This is a shallow check for server-side errors
Almost there, just fix the following server-side errors
    • > GET request to /wp-admin/options-general.php?page=business-hours
    • > Deprecated in wp-content/plugins/business-hours-plugin/lib/BusinessHoursWidget.class.php+4
    Methods with the same name as their class will not be constructors in a future version of PHP; BusinessHoursWidget has a deprecated constructor
    • > GET request to /wp-admin/options-general.php?page=business-hours
    • > User deprecated in wp-includes/functions.php+5546
    The called constructor method for WP_Widget class in BusinessHoursWidget is deprecated since version 4.3.0! Use __construct() instead.
    • > GET request to /wp-admin/options-general.php?page=business-hours
    • > Notice in wp-content/plugins/business-hours-plugin/lib/BusinessHoursExceptions.class.php+177
    Trying to access array offset on value of type bool

SRP 0% from 2 tests

🔹 Tests weight: 20 | The single-responsibility principle applies for WordPress plugins as well - please make sure your PHP files perform no actions when accessed directly
Please fix the following items
  • 1× PHP files perform the action of outputting non-empty strings when accessed directly:
    • > /wp-content/plugins/business-hours-plugin/views/table-row.php
  • 18× PHP files trigger errors when accessed directly with GET requests (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Call to undefined function _e() in wp-content/plugins/business-hours-plugin/views/settings.php:3
    • > PHP Notice
      Undefined variable: closed_text in wp-content/plugins/business-hours-plugin/views/table-row.php on line 7
    • > PHP Fatal error
      Uncaught Error: Call to undefined function _e() in wp-content/plugins/business-hours-plugin/views/table.php:10
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/business-hours-plugin/widget.php:3
    • > PHP Notice
      Undefined variable: collapsible_link in wp-content/plugins/business-hours-plugin/views/table.php on line 1
    • > PHP Notice
      Undefined variable: is_open_today in wp-content/plugins/business-hours-plugin/views/table-row.php on line 3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function _e() in wp-content/plugins/business-hours-plugin/views/settings-exceptions.php:5
    • > PHP Notice
      Undefined variable: day_name in wp-content/plugins/business-hours-plugin/views/table-row.php on line 2
    • > PHP Fatal error
      Uncaught Error: Call to undefined function _e() in wp-content/plugins/business-hours-plugin/views/settings-exception-instructions.php:1
    • > PHP Fatal error
      Uncaught Error: Call to undefined function _e() in wp-content/plugins/business-hours-plugin/views/settings-days.php:5

User-side errors Passed 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
There were no browser issues found

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 94% from 16 tests

You should put a lot of thought into formatting readme.txt as it is used by WordPress.org to prepare the public listing of your plugin
These attributes need your attention:
  • Screenshots: Please add images for these screenshots: #1 (Business Hours Settings), #2 (Exceptions Settings), #3 (Widget Settings), #4 (Front-End Widget: Closed), #5 (Front-End Widget: Working), #6 (Front-End Widget: Full week, with an exception)
The official readme.txt might help

business-hours-plugin/working-hours.php 92% from 13 tests

The main file in "Business Hours Plugin" v. 2.0 serves as a complement to information provided in readme.txt and as the entry point to the plugin
Please take the time to fix the following:
  • Main file name: The principal plugin file should be the same as the plugin slug ("business-hours-plugin.php" instead of "working-hours.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 plugin1,848 lines of code in 29 files:
LanguageFilesBlank linesComment linesLines of code
PHP215143671,395
PO File2110134235
CSS3320179
JavaScript329039

PHP code Passed 2 tests

Analyzing cyclomatic complexity and code structure
There were no cyclomatic complexity issued detected
Cyclomatic complexity
Average complexity per logical line of code0.24
Average class complexity10.94
▷ Minimum class complexity1.00
▷ Maximum class complexity35.00
Average method complexity2.33
▷ Minimum method complexity1.00
▷ Maximum method complexity11.00
Code structure
Namespaces0
Interfaces1
Traits0
Classes15
▷ Abstract classes213.33%
▷ Concrete classes1386.67%
▷ Final classes00.00%
Methods127
▷ Static methods21.57%
▷ Public methods7760.63%
▷ Protected methods2318.11%
▷ Private methods2721.26%
Functions3
▷ Named functions3100.00%
▷ Anonymous functions00.00%
Constants7
▷ Global constants00.00%
▷ Class constants7100.00%
▷ Public constants7100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
7 PNG files occupy 0.46MB with 0.30MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
screenshot-1.png70.34KB25.42KB▼ 63.86%
screenshot-3.png51.62KB17.87KB▼ 65.39%
screenshot-6.png56.77KB18.01KB▼ 68.27%
screenshot-2.png134.68KB48.24KB▼ 64.18%
screenshot-4.png81.92KB26.93KB▼ 67.12%