10% sb-hotel-rooms

Code Review | SB Hotel Rooms

WordPress plugin SB Hotel Rooms scored 10% from 54 tests.

About plugin

  • Plugin page: sb-hotel-rooms
  • Plugin version: 1.0.0
  • PHP version: 7.4.16
  • WordPress compatibility: 3.3-3.4
  • WordPress version: 6.3.1
  • First release: Oct 26, 2012
  • Latest release: Dec 4, 2012
  • Number of updates: 53
  • Update frequency: every 0.8 days
  • Top authors: mrumengan (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active / 3,031 total downloads

Benchmarks

Plugin footprint 40% from 16 tests

Installer 0% from 1 test

🔺 Critical test (weight: 50) | All plugins must install correctly, without throwing any errors, warnings, or notices
These installer errors require your attention
  • The plugin did not install without errors
    • > Notice in wp-content/plugins/sb-hotel-rooms/sb_hotel_rooms.php+53
    Constant WP_POST_REVISIONS already defined

Server metrics [RAM: ▼1.85MB] [CPU: ▼53.25ms] Passed 4 tests

A check of server-side resources used by SB Hotel Rooms
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /2.14 ▼1.324.33 ▼36.66
Dashboard /wp-admin2.16 ▼1.156.42 ▼41.54
Posts /wp-admin/edit.php2.16 ▼1.206.18 ▼42.79
Add New Post /wp-admin/post-new.php2.16 ▼3.736.82 ▼91.99
Media Library /wp-admin/upload.php2.16 ▼1.076.19 ▼28.53
Rooms /wp-admin/edit.php?post_type=rooms2.166.19
Rooms Options /wp-admin/options-general.php?page=jfcow-options-rooms2.166.25
New Room /wp-admin/post-new.php?post_type=rooms2.167.12

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

Input-output and database impact of this plugin
No storage issues were detected
Filesystem: 18 new files
Database: no new tables, 6 new options
New WordPress options
widget_recent-posts
db_upgraded
widget_recent-comments
can_compress_scripts
theysaidso_admin_options
widget_theysaidso_widget

Browser metrics Passed 4 tests

Checking browser requirements for SB Hotel Rooms
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,833 ▲7613.21 ▼1.051.79 ▼0.0847.00 ▼0.95
Dashboard /wp-admin2,239 ▲486.01 ▲1.14102.01 ▼2.8873.23 ▲35.50
Posts /wp-admin/edit.php2,122 ▲332.04 ▲0.0135.26 ▼0.9432.75 ▲0.70
Add New Post /wp-admin/post-new.php1,555 ▲2223.39 ▲0.10648.28 ▲41.5690.11 ▲40.54
Media Library /wp-admin/upload.php1,409 ▲244.23 ▼0.0298.94 ▼2.8688.79 ▲42.16
Rooms /wp-admin/edit.php?post_type=rooms1,0801.9330.2127.64
Rooms Options /wp-admin/options-general.php?page=jfcow-options-rooms8422.0228.0725.73
New Room /wp-admin/post-new.php?post_type=rooms2,3047.75163.66115.10

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

🔸 Tests weight: 35 | All plugins must uninstall correctly, removing their source code and extra database tables they might have created
These items require your attention
  • This plugin cannot be uninstalled
    • > Notice in wp-content/plugins/sb-hotel-rooms/sb_hotel_rooms.php+55
    Undefined index: sb_hotel_options
  • Zombie WordPress options were found after uninstall: 6 options
    • widget_recent-comments
    • db_upgraded
    • theysaidso_admin_options
    • widget_recent-posts
    • can_compress_scripts
    • widget_theysaidso_widget

Smoke tests 0% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | A shallow check that no server-side errors were triggered
Smoke test failed, please fix the following
  • 4 occurences, only the last one shown
    • > GET request to /wp-admin/post-new.php?post_type=rooms
    • > Notice in wp-content/plugins/sb-hotel-rooms/sb_hotel_rooms.php+55
    Undefined index: sb_hotel_options
  • 10 occurences, only the last one shown
    • > GET request to /wp-admin/post-new.php?post_type=rooms
    • > Notice in wp-content/plugins/sb-hotel-rooms/sb_hotel_rooms.php+74
    Trying to access array offset on value of type bool
    • > GET request to /wp-admin/options-general.php?page=jfcow-options-rooms
    • > Notice in wp-content/plugins/sb-hotel-rooms/sb_hotel_rooms.php+234
    Undefined index: saved
    • > GET request to /wp-admin/options-general.php?page=jfcow-options-rooms
    • > Notice in wp-content/plugins/sb-hotel-rooms/sb_hotel_rooms.php+235
    Undefined index: reset
    • > GET request to /wp-admin/options-general.php?page=jfcow-options-rooms
    • > User deprecated in wp-includes/functions.php+5463
    Function screen_icon is deprecated since version 3.8.0 with no alternative available.
    • > GET request to /wp-admin/options-general.php?page=jfcow-options-rooms
    • > User deprecated in wp-includes/functions.php+5463
    Function get_screen_icon is deprecated since version 3.8.0 with no alternative available.
    • > GET request to /wp-admin/options-general.php?page=jfcow-options-rooms
    • > User deprecated in wp-includes/functions.php+5453
    Function get_current_theme is deprecated since version 3.4.0! Use wp_get_theme() instead.
    • > GET request to /wp-admin/post-new.php?post_type=rooms
    • > Notice in wp-content/plugins/sb-hotel-rooms/sb_hotel_rooms.php+180
    Undefined index: room-details
    • > GET request to /wp-admin/post-new.php?post_type=rooms
    • > Warning in wp-content/plugins/sb-hotel-rooms/sb_hotel_rooms.php+143
    Illegal string offset 'Price'
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/post-new.php?post_type=rooms
    • > Notice in wp-content/plugins/sb-hotel-rooms/sb_hotel_rooms.php+145
    Uninitialized string offset: 0
    • > GET request to /wp-admin/post-new.php?post_type=rooms
    • > Warning in wp-content/plugins/sb-hotel-rooms/sb_hotel_rooms.php+145
    Illegal string offset 'Amenities'
    • > GET request to /wp-admin/post-new.php?post_type=rooms
    • > Notice in wp-content/plugins/sb-hotel-rooms/forms/room_pictures.php+27
    Undefined offset: 0

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 take a closer look at the following
  • 1× PHP files perform the task of outputting text when accessed with GET requests:
    • > /wp-content/plugins/sb-hotel-rooms/forms/room_pictures.php
  • 4× GET requests to PHP files have triggered server-side errors or warnings:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugins_url() in wp-content/plugins/sb-hotel-rooms/sb_hotel_rooms.php:44
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/sb-hotel-rooms/ajax_responses.php:2
    • > PHP Notice
      Undefined variable: metas in wp-content/plugins/sb-hotel-rooms/forms/room_pictures.php on line 27
    • > PHP Notice
      Trying to access array offset on value of type null in wp-content/plugins/sb-hotel-rooms/forms/room_pictures.php on line 27

User-side errors 0% from 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the browser (console and network errors and warnings)
These are user-side errors you should fix
    • > GET request to /wp-admin/post-new.php?post_type=rooms
    • > Console-api (warning) in unknown
    /wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils,moxiejs,plupload&ver=6.3.1 1:28609 "jQuery.Deferred exception: $(...).live is not a function" "TypeError: $(...).live is not a function\n at HTMLDocument.\u003Canonymous> (/wp-admin/post-new.php?post_type=rooms:447:20)\n at e (/wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils,moxiejs,plupload&ver=6.3.1:2:26990)\n at t (/wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils,moxiejs,plupload&ver=6.3.1:2:27292)" undefined
    • > GET request to /wp-admin/post-new.php?post_type=rooms
    • > Javascript (severe) in unknown
    /wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils,moxiejs,plupload&ver=6.3.1 1:28721 Uncaught TypeError: $(...).live is not a function

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file is an important file in your plugin as it is parsed by WordPress.org to prepare the public listing of your plugin
Attributes that require attention:
  • Screenshots: These screenshots do not have images: #1 (http://sitebridge.net/wp-content/uploads/2012/10/screenshot1.png), #2 (http://sitebridge.net/wp-content/uploads/2012/10/screenshot2.png)
The official readme.txt is a good inspiration

sb-hotel-rooms/sb_hotel_rooms.php 92% from 13 tests

Analyzing the main PHP file in "SB Hotel Rooms" version 1.0.0
It is important to fix the following:
  • Main file name: Please rename the main PHP file in this plugin to the plugin slug ("sb-hotel-rooms.php" instead of "sb_hotel_rooms.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is a short overview of programming languages used in this plugin, detecting executable files
There were no executable files found in this plugin434 lines of code in 8 files:
LanguageFilesBlank linesComment linesLines of code
PHP48260307
CSS201389
JavaScript201338

PHP code Passed 2 tests

This is a short overview of cyclomatic complexity and code structure for this plugin
There are no cyclomatic complexity problems detected for this plugin
Cyclomatic complexity
Average complexity per logical line of code0.24
Average class complexity12.50
▷ Minimum class complexity2.00
▷ Maximum class complexity23.00
Average method complexity2.28
▷ Minimum method complexity1.00
▷ Maximum method complexity7.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes2
▷ Abstract classes00.00%
▷ Concrete classes2100.00%
▷ Final classes00.00%
Methods18
▷ Static methods00.00%
▷ Public methods18100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions0
▷ Named functions00.00%
▷ Anonymous functions00.00%
Constants1
▷ Global constants1100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

PNG files should be compressed to save space and minimize bandwidth usage
3 PNG files occupy 0.06MB with 0.01MB in potential savings
Potential savings
Compression of 3 random PNG files using pngquant
FileSize - originalSize - compressedSavings
images/room_icon.png1.71KB0.68KB▼ 60.19%
screenshot1.png26.20KB25.27KB▼ 3.56%
screenshot2.png31.84KB30.90KB▼ 2.96%