68% wp-hotel-booking

Code Review | WP Hotel Booking

WordPress plugin WP Hotel Booking scored68%from 54 tests.

About plugin

  • Plugin page: wp-hotel-booking
  • Plugin version: 2.0.9
  • PHP compatiblity: 7.0+
  • PHP version: 7.4.16
  • WordPress compatibility: 6.2-6.3.2
  • WordPress version: 6.3.1
  • First release: Feb 28, 2016
  • Latest release: Oct 26, 2023
  • Number of updates: 214
  • Update frequency: every 13.1 days
  • Top authors: leehld (61.21%)ThimPress (34.58%)phamtungpth (5.14%)

Code review

54 tests

User reviews

59 reviews

Install metrics

9,000+ active /296,240 total downloads

Benchmarks

Plugin footprint 65% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Verifying that this plugin installs correctly without errors
This plugin's installer ran successfully

Server metrics [RAM: ▲2.88MB] [CPU: ▲23.81ms] Passed 4 tests

An overview of server-side resources used by WP Hotel Booking
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /6.16 ▲2.7061.37 ▲22.92
Dashboard /wp-admin6.26 ▲2.9669.59 ▲14.55
Posts /wp-admin/edit.php6.32 ▲2.9679.24 ▲33.08
Add New Post /wp-admin/post-new.php8.96 ▲3.08111.56 ▲29.50
Media Library /wp-admin/upload.php6.11 ▲2.8963.00 ▲28.25
Settings /wp-admin/admin.php?page=tp_hotel_booking_settings6.2056.92
Room Types /wp-admin/edit-tags.php?taxonomy=hb_room_type&post_type=hb_room6.1157.58
Rooms /wp-admin/edit.php?post_type=hb_room6.1866.18
Bookings Order /wp-admin/edit.php?post_type=hb_booking6.1856.28
Coupons /wp-admin/edit.php?post_type=hb_coupon6.1858.50
Extra Options /wp-admin/edit.php?post_type=hb_extra_room6.1863.66
Add New Room /wp-admin/post-new.php?post_type=hb_room6.4378.41
Tools /wp-admin/admin.php?page=wphb-tools6.1154.34
Calendar Manager /wp-admin/admin.php?page=tp_hotel_booking_calender_manager6.0853.14

Server storage [IO: ▲3.97MB] [DB: ▲0.01MB] Passed 3 tests

Analyzing filesystem and database footprints of this plugin
This plugin installed successfully
Filesystem: 341 new files
Database: 3 new tables, 58 new options
New tables
wp_hotel_booking_order_itemmeta
wp_hotel_booking_plans
wp_hotel_booking_order_items
New WordPress options
tp_hotel_booking_rooms_page_id
tp_hotel_booking_price_currency_position
tp_hotel_booking_enable_review_rating
hotel_booking_checkout_page_id
tp_hotel_booking_price_number_of_decimal
tp_hotel_booking_posts_per_page
tp_hotel_booking_filter_price_max
hotel_booking_rooms_page_id
tp_hotel_booking_display_pricing_plans
wphb_check_tables
...

Browser metrics Passed 4 tests

An overview of browser requirements for WP Hotel Booking
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,179 ▲39315.87 ▲1.5016.95 ▲15.1938.06 ▼4.89
Dashboard /wp-admin2,346 ▲1696.18 ▲0.5295.28 ▲8.3838.39 ▼0.07
Posts /wp-admin/edit.php2,274 ▲1743.44 ▲1.4545.14 ▲9.7634.46 ▼6.50
Add New Post /wp-admin/post-new.php1,666 ▲14022.89 ▼0.15684.82 ▼14.2836.96 ▼20.17
Media Library /wp-admin/upload.php1,571 ▲1685.62 ▲1.41101.81 ▲1.2441.49 ▼1.53
Settings /wp-admin/admin.php?page=tp_hotel_booking_settings2,1833.3040.5725.63
Room Types /wp-admin/edit-tags.php?taxonomy=hb_room_type&post_type=hb_room1,4893.3537.3030.28
Rooms /wp-admin/edit.php?post_type=hb_room1,3143.5439.3428.30
Bookings Order /wp-admin/edit.php?post_type=hb_booking1,3363.4841.8027.18
Coupons /wp-admin/edit.php?post_type=hb_coupon1,2663.5241.2227.61
Extra Options /wp-admin/edit.php?post_type=hb_extra_room1,2453.4046.8130.24
Add New Room /wp-admin/post-new.php?post_type=hb_room4,29011.32318.6589.08
Tools /wp-admin/admin.php?page=wphb-tools1,0063.2536.1622.81
Calendar Manager /wp-admin/admin.php?page=tp_hotel_booking_calender_manager1,6005.59102.3640.49

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

🔸 Tests weight: 35 | It is important to correctly uninstall your plugin, without leaving any traces
The following items require your attention
  • Zombie tables were found after uninstall: 3 tables
    • wp_hotel_booking_order_items
    • wp_hotel_booking_order_itemmeta
    • wp_hotel_booking_plans
  • This plugin did not uninstall successfully, leaving 58 options in the database
    • widget_recent-comments
    • tp_hotel_booking_cart_page_id
    • hotel_booking_rooms_page_id
    • tp_hotel_booking_price_number_of_decimal
    • widget_recent-posts
    • tp_hotel_booking_advance_payment
    • tp_hotel_booking_single_purchase
    • tp_hotel_booking_price_including_tax
    • tp_hotel_booking_display_pricing_plans
    • tp_hotel_booking_rooms_page_id
    • ...

Smoke tests 50% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the server (in the Apache logs)
Please fix the following server-side errors
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/edit.php?post_type=hb_extra_room
    • > request to
    • > Notice in wp-config.php+20
    Undefined index: REQUEST_METHOD

SRP 50% from 2 tests

🔹 Tests weight: 20 | A shallow check of the single-responsibility principle; PHP files should perform no action - including output of placeholder text - and trigger no errors when accessed directly
Almost there! Just fix the following items
  • 13× PHP files trigger server errors when accessed directly (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'WPHB_Abstract_REST_Controller' not found in wp-content/plugins/wp-hotel-booking/includes/rest-api/v1/frontend/class-wphb-rooms-controller.php:6
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_filter() in wp-content/plugins/wp-hotel-booking/includes/plugins/wp-hotel-booking-extra/inc/admin/class-hb-admin.php:14
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/wp-hotel-booking/includes/admin/setup/class-wphb-setup-wizard.php:22
    • > PHP Fatal error
      Uncaught Error: Class 'WP_REST_Controller' not found in wp-content/plugins/wp-hotel-booking/includes/abstracts/class-wphb-abstract-rest-controller.php:6
    • > PHP Fatal error
      Uncaught Error: Class 'WPHB_Meta_Box' not found in wp-content/plugins/wp-hotel-booking/includes/admin/metaboxes/rooms/class-wphb-admin-metabox-rooms.php:3
    • > PHP Fatal error
      Uncaught Error: Class 'WPHB_Meta_Box' not found in wp-content/plugins/wp-hotel-booking/includes/admin/metaboxes/rooms/class-wphb-admin-metabox-extra-options.php:3
    • > PHP Fatal error
      Uncaught Error: Class 'WPHB_Meta_Box' not found in wp-content/plugins/wp-hotel-booking/includes/admin/metaboxes/rooms/class-wphb-admin-metabox-coupons.php:3
    • > PHP Fatal error
      Uncaught Error: Class 'WPHB_Abstract_REST_Controller' not found in wp-content/plugins/wp-hotel-booking/includes/rest-api/v1/admin/class-wphb-admin-updates-controller.php:5
    • > PHP Fatal error
      Uncaught Error: Class 'WPHB_Abstract_REST_Controller' not found in wp-content/plugins/wp-hotel-booking/includes/rest-api/v1/admin/class-wphb-admin-rooms-controller.php:5
    • > PHP Fatal error
      Uncaught Error: Class 'WP_Block_Template' not found in wp-content/plugins/wp-hotel-booking/includes/abstracts/class-wphb-abstract-block-template.php:8

User-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
No browser issues were found

Optimizations

Plugin configuration Passed 29 tests

readme.txt Passed 16 tests

The readme.txt file uses markdown syntax to describe your plugin to the world
5 plugin tags: reservations, hotel, booking, reservation, hotel booking

wp-hotel-booking/wp-hotel-booking.php Passed 13 tests

The main PHP file in "WP Hotel Booking" ver. 2.0.9 adds more information about the plugin and also serves as the entry point for this plugin
55 characters long description:
Full of professional features for a booking room system

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is an overview of programming languages used in this plugin; dangerous file extensions are not allowed
Good job! No executable or dangerous file extensions detected31,782 lines of code in 300 files:
LanguageFilesBlank linesComment linesLines of code
PHP2363,8406,44220,682
CSS231,1122565,982
JavaScript377836484,462
SVG200652
HTML20104

PHP code Passed 2 tests

Analyzing cyclomatic complexity and code structure
Everything seems fine, there were no complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.42
Average class complexity16.64
▷ Minimum class complexity1.00
▷ Maximum class complexity118.00
Average method complexity3.59
▷ Minimum method complexity1.00
▷ Maximum method complexity73.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes98
▷ Abstract classes88.16%
▷ Concrete classes9091.84%
▷ Final classes00.00%
Methods591
▷ Static methods8814.89%
▷ Public methods57396.95%
▷ Protected methods61.02%
▷ Private methods122.03%
Functions226
▷ Named functions22499.12%
▷ Anonymous functions20.88%
Constants17
▷ Global constants1058.82%
▷ Class constants741.18%
▷ Public constants7100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

PNG files should be compressed to save space and minimize bandwidth usage
20 PNG files occupy 0.08MB with 0.03MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/images/patterns/overlay8.png0.93KB0.10KB▼ 88.82%
assets/images/patterns/overlay6.png0.94KB0.10KB▼ 88.95%
assets/images/prev.png0.30KB0.29KB▼ 2.94%
includes/libraries/lightbox/lightbox2/images/prev.png1.33KB1.59KB0.00%
includes/libraries/lightbox/lightbox2/images/close.png0.27KB0.29KB0.00%