10% wp-open-hours

Code Review | WP Open Hour Widget

WordPress plugin WP Open Hour Widget scored10%from 54 tests.

About plugin

  • Plugin page: wp-open-hours
  • Plugin version: 1.0
  • PHP version: 7.4.16
  • WordPress compatibility: 3.3-4.0
  • WordPress version: 6.3.1
  • First release: Nov 8, 2014
  • Latest release: Nov 18, 2014
  • Number of updates: 9
  • Update frequency: every 1.7 days
  • Top authors: rawalprashant (100%)

Code review

54 tests

User reviews

6 reviews

Install metrics

60+ active /5,549 total downloads

Benchmarks

Plugin footprint 40% from 16 tests

Installer 0% from 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
It is recommended to fix the following installer errors
  • Install procedure had errors
    • > Deprecated in wp-content/plugins/wp-open-hours/wp_openhour_widget.php+2
    Methods with the same name as their class will not be constructors in a future version of PHP; WpOpenhourWidget has a deprecated constructor

Server metrics [RAM: ▼1.72MB] [CPU: ▼56.01ms] Passed 4 tests

This is a short check of server-side resources used by WP Open Hour Widget
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /2.28 ▼1.188.99 ▼34.72
Dashboard /wp-admin2.29 ▼1.0511.48 ▼59.42
Posts /wp-admin/edit.php2.30 ▼1.0613.27 ▼39.36
Add New Post /wp-admin/post-new.php2.30 ▼3.599.95 ▼90.53
Media Library /wp-admin/upload.php2.30 ▼0.9310.47 ▼26.12
WP Openhour /wp-admin/options-general.php?page=wp-openhour2.3011.79

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

Filesystem and database footprint
The plugin installed successfully
Filesystem: 60 new files
Database: 1 new table, 8 new options
New tables
wp_openhour
New WordPress options
theysaidso_admin_options
widget_theysaidso_widget
widget_recent-comments
widget_wpopenhourwidget
can_compress_scripts
wp_openhour_individual
db_upgraded
widget_recent-posts

Browser metrics Passed 4 tests

An overview of browser requirements for WP Open Hour Widget
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,927 ▲16613.86 ▼0.5110.85 ▲8.8642.36 ▼5.21
Dashboard /wp-admin2,228 ▲255.88 ▼0.0296.02 ▼21.5938.22 ▼7.01
Posts /wp-admin/edit.php2,104 ▲11.98 ▼0.0139.45 ▼1.5535.74 ▼0.31
Add New Post /wp-admin/post-new.php1,553 ▼623.39 ▲4.99680.28 ▲38.6954.72 ▲2.30
Media Library /wp-admin/upload.php1,407 ▲44.20 ▼0.02101.47 ▼0.4345.23 ▼4.25
WP Openhour /wp-admin/options-general.php?page=wp-openhour1,0032.0229.0130.74

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
The following items require your attention
  • The plugin did not uninstall gracefully
    • > User deprecated in wp-includes/functions.php+5546
    The called constructor method for WP_Widget class in WpOpenhourWidget is deprecated since version 4.3.0! Use __construct() instead.
  • This plugin does not fully uninstall, leaving 7 options in the database
    • widget_wpopenhourwidget
    • widget_theysaidso_widget
    • widget_recent-comments
    • theysaidso_admin_options
    • db_upgraded
    • widget_recent-posts
    • can_compress_scripts

Smoke tests 25% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | This is a short smoke test looking for server-side errors
These errors were triggered by the plugin
    • > GET request to /wp-admin/options-general.php?page=wp-openhour
    • > User deprecated in wp-includes/functions.php+5546
    The called constructor method for WP_Widget class in WpOpenhourWidget is deprecated since version 4.3.0! Use __construct() instead.
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/options-general.php?page=wp-openhour
    • > User deprecated in wp-includes/functions.php+5737
    Function has_cap was called with an argument that is deprecated since version 2.0.0! Usage of user levels is deprecated. Use capabilities instead.
    • > GET request to /wp-admin/options-general.php?page=wp-openhour
    • > Notice in wp-content/plugins/wp-open-hours/openhour.php+58
    Undefined index: wp_openhour_saved

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
Almost there! Just fix the following items
  • 2× PHP files output text when accessed directly:
    • > /wp-content/plugins/wp-open-hours/js/county2.js.php
    • > /wp-content/plugins/wp-open-hours/time.php
  • 2× GET requests to PHP files have triggered server-side errors or warnings:
    • > PHP Fatal error
      Uncaught Error: Class 'WP_Widget' not found in wp-content/plugins/wp-open-hours/wp_openhour_widget.php:2
    • > PHP Warning
      date() expects at least 1 parameter, 0 given in wp-content/plugins/wp-open-hours/js/county2.js.php on line 153

User-side errors Passed 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
Everything seems fine, but this is not an exhaustive test

Optimizations

Plugin configuration 90% from 29 tests

readme.txt 88% from 16 tests

The readme.txt file is undoubtedly the most important file in your plugin, preparing it for public listing on WordPress.org
Attributes that need to be fixed:
  • Plugin Name: You should set the name of your plugin on the first line ( === wp-open-hours === )
  • Tags: Too many tags (11 tag instead of maximum 10); only the first 5 tags are used in your directory listing
The official readme.txt might help

wp-open-hours/openhour.php 92% from 13 tests

The main file in "WP Open Hour Widget" v. 1.0 serves as a complement to information provided in readme.txt and as the entry point to the plugin
You should first fix the following items:
  • Main file name: It is recommended to name the main PHP file as the plugin slug ("wp-open-hours.php" instead of "openhour.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short review of files and their extensions; it is not recommended to include executable files
Good job! No executable or dangerous file extensions detected2,690 lines of code in 12 files:
LanguageFilesBlank linesComment linesLines of code
CSS165371,205
SVG200845
PHP46953400
JavaScript34323169
INI23171

PHP code Passed 2 tests

A brief analysis of cyclomatic complexity and code structure for this plugin
All good! No complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.34
Average class complexity24.00
▷ Minimum class complexity24.00
▷ Maximum class complexity24.00
Average method complexity8.67
▷ Minimum method complexity1.00
▷ Maximum method complexity13.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes1
▷ Abstract classes00.00%
▷ Concrete classes1100.00%
▷ Final classes00.00%
Methods3
▷ Static methods00.00%
▷ Public methods3100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions6
▷ Named functions6100.00%
▷ Anonymous functions00.00%
Constants1
▷ Global constants1100.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
35 PNG files occupy 0.39MB with 0.14MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
images/cafe-closed.png9.34KB4.53KB▼ 51.49%
images/names.png107.04KB43.40KB▼ 59.46%
images/fwoh_business_open_bg.png12.91KB5.50KB▼ 57.43%
images/fwoh_social_icon_closed_door.png0.47KB0.50KB0.00%
images/fwoh_social_icon_clock.png0.67KB0.62KB▼ 7.00%