78% open-hours

Code Review | Open Hours - Easy Opening Hours

WordPress plugin Open Hours - Easy Opening Hours scored78%from 54 tests.

About plugin

  • Plugin page: open-hours
  • Plugin version: 1.0.9
  • PHP version: 7.4.16
  • WordPress compatibility: 4.9.0-6.0
  • WordPress version: 6.3.1
  • First release: Feb 15, 2017
  • Latest release: Aug 15, 2022
  • Number of updates: 21
  • Update frequency: every 95.6 days
  • Top authors: jumparound (80.95%)pixelgrade (14.29%)vlad.olaru (14.29%)

Code review

54 tests

User reviews

4 reviews

Install metrics

600+ active /9,895 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Verifying that this plugin installs correctly without errors
The plugin installed successfully, without throwing any errors or notices

Server metrics [RAM: ▲0.21MB] [CPU: ▼5.08ms] Passed 4 tests

This is a short check of server-side resources used by Open Hours - Easy Opening Hours
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /3.67 ▲0.2145.95 ▼1.54
Dashboard /wp-admin3.51 ▲0.2150.25 ▼2.21
Posts /wp-admin/edit.php3.63 ▲0.2752.43 ▲0.31
Add New Post /wp-admin/post-new.php6.10 ▲0.2287.34 ▼11.79
Media Library /wp-admin/upload.php3.44 ▲0.2140.66 ▼4.77

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

Filesystem and database footprint
The plugin installed successfully
Filesystem: 23 new files
Database: no new tables, 8 new options
New WordPress options
theysaidso_admin_options
can_compress_scripts
widget_recent-posts
widget_recent-comments
widget_open_overview_widget
widget_theysaidso_widget
widget_open_current_status_widget
db_upgraded

Browser metrics Passed 4 tests

This is an overview of browser requirements for Open Hours - Easy Opening Hours
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,789 ▲2814.68 ▲0.331.67 ▼0.0145.69 ▼0.08
Dashboard /wp-admin2,198 ▲185.61 ▼0.0690.07 ▼7.6438.17 ▼7.16
Posts /wp-admin/edit.php2,100 ▼01.99 ▼0.0434.86 ▼3.0637.44 ▲1.15
Add New Post /wp-admin/post-new.php1,526 ▼223.60 ▲0.49618.26 ▼74.6446.64 ▼16.41
Media Library /wp-admin/upload.php1,403 ▲34.22 ▲0.02109.61 ▼1.3546.01 ▼1.55

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
You still need to fix the following
  • The uninstall procedure has failed, leaving 8 options in the database
    • widget_recent-comments
    • widget_open_current_status_widget
    • can_compress_scripts
    • widget_theysaidso_widget
    • widget_recent-posts
    • widget_open_overview_widget
    • db_upgraded
    • theysaidso_admin_options

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
Everything seems fine, however this is by no means an exhaustive test

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
The following issues need your attention
  • 1× PHP files output non-empty strings when accessed directly via GET requests:
    • > /wp-content/plugins/open-hours/open-hours.php
  • 6× PHP files trigger errors when accessed directly with GET requests:
    • > PHP Fatal error
      Uncaught Error: Class 'WP_Widget' not found in wp-content/plugins/open-hours/includes/Widget/abstract-widget.php:4
    • > PHP Fatal error
      Uncaught Error: Class 'WP_Widget' not found in wp-content/plugins/open-hours/includes/Widget/abstract-widget.php:4
    • > PHP Fatal error
      Uncaught Error: Class 'WP_Customize_Control' not found in wp-content/plugins/open-hours/includes/Control/class-Pix_Open_Customize_Control.php:8
    • > PHP Fatal error
      Uncaught Error: Class 'WP_Customize_Control' not found in wp-content/plugins/open-hours/includes/Control/class-Pix_Open_Customize_Control.php:8
    • > PHP Fatal error
      Uncaught Error: Class 'WP_Widget' not found in wp-content/plugins/open-hours/includes/Widget/abstract-widget.php:4
    • > PHP Fatal error
      Uncaught Error: Class 'WP_Customize_Control' not found in wp-content/plugins/open-hours/includes/Control/class-Pix_Open_Customize_Control.php:8

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)
No browser issues were found

Optimizations

Plugin configuration 97% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file is undoubtedly the most important file in your plugin, preparing it for public listing on WordPress.org
These attributes need to be fixed:
  • Tags: Please reduce the number of tags, currently 14 tag instead of maximum 10
Please take inspiration from this readme.txt

open-hours/open-hours.php Passed 13 tests

The entry point to "Open Hours - Easy Opening Hours" version 1.0.9 is a PHP file that has certain tags in its header comment area
76 characters long description:
An easy to use opening hours WordPress plugin manager for any kind of venue.

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | Executable files are not allowed as they can serve as attack vectors
Good job! No executable or dangerous file extensions detected1,779 lines of code in 20 files:
LanguageFilesBlank linesComment linesLines of code
PHP112953851,097
JavaScript57191392
Sass2430150
CSS2179140

PHP code Passed 2 tests

Analyzing cyclomatic complexity and code structure
This plugin has no cyclomatic complexity issues
Cyclomatic complexity
Average complexity per logical line of code0.35
Average class complexity18.89
▷ Minimum class complexity1.00
▷ Maximum class complexity83.00
Average method complexity3.73
▷ Minimum method complexity1.00
▷ Maximum method complexity19.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes9
▷ Abstract classes111.11%
▷ Concrete classes888.89%
▷ Final classes00.00%
Methods60
▷ Static methods23.33%
▷ Public methods5388.33%
▷ Protected methods711.67%
▷ Private methods00.00%
Functions1
▷ Named functions1100.00%
▷ Anonymous functions00.00%
Constants0
▷ Global constants00.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
1 PNG file occupies 0.04MB with 0.03MB in potential savings
Potential savings
Compression of 1 random PNG file using pngquant
FileSize - originalSize - compressedSavings
images/opening_hours_scheme.png40.97KB13.46KB▼ 67.16%