68% nd-restaurant-reservations

Code Review | Restaurant Reservations

WordPress plugin Restaurant Reservations scored68%from 54 tests.

About plugin

  • Plugin page: nd-restaurant-res...
  • Plugin version: 1.9
  • PHP version: 7.4.16
  • WordPress compatibility: 4.5-6.3
  • WordPress version: 6.3.1
  • First release: Dec 17, 2018
  • Latest release: Oct 18, 2023
  • Number of updates: 30
  • Update frequency: every 59.2 days
  • Top authors: nicdark (100%)

Code review

54 tests

User reviews

1 review

Install metrics

4,000+ active /32,064 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: ▲0.85MB] [CPU: ▼2.84ms] Passed 4 tests

Analyzing server-side resources used by Restaurant Reservations
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /4.32 ▲0.8641.77 ▲1.83
Dashboard /wp-admin4.18 ▲0.8349.68 ▼13.01
Posts /wp-admin/edit.php4.29 ▲0.9352.57 ▲5.74
Add New Post /wp-admin/post-new.php6.76 ▲0.8790.84 ▼5.45
Media Library /wp-admin/upload.php4.10 ▲0.8741.63 ▲5.27
Add New /wp-admin/post-new.php?post_type=nd_rst_cpt_14.2254.24
Add Timing /wp-admin/admin.php?page=nd-restaurant-reservations-add-timing4.0637.74
Calendar View /wp-admin/admin.php?page=nd-restaurant-reservations-settings-calendar-view4.0436.68
Add Exceptions /wp-admin/admin.php?page=nd-restaurant-reservations-add-exception4.0636.76
Paypal /wp-admin/admin.php?page=nd-restaurant-reservations-paypal4.0739.79
All Orders /wp-admin/admin.php?page=nd-restaurant-reservations-settings-orders4.1235.65
ND Restaurant /wp-admin/admin.php?page=nd-restaurant-reservations-settings4.0738.90
Reservation Settings /wp-admin/admin.php?page=nd-restaurant-reservations-reservation-settings4.0737.00
Restaurants /wp-admin/edit.php?post_type=nd_rst_cpt_14.1439.40
Import Export /wp-admin/admin.php?page=nd-restaurant-reservations-settings-import-export4.0634.99

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

Filesystem and database footprint
This plugin was installed successfully
Filesystem: 87 new files
Database: 1 new table, 6 new options
New tables
wp_nd_rst_booking
New WordPress options
theysaidso_admin_options
widget_recent-comments
db_upgraded
can_compress_scripts
widget_recent-posts
widget_theysaidso_widget

Browser metrics Passed 4 tests

Checking browser requirements for Restaurant Reservations
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,983 ▲22213.42 ▼0.987.75 ▲6.1738.61 ▲2.04
Dashboard /wp-admin2,302 ▲1315.57 ▼0.0183.84 ▼6.9738.89 ▼3.89
Posts /wp-admin/edit.php2,207 ▲1072.02 ▼0.0140.33 ▲0.8438.54 ▲4.62
Add New Post /wp-admin/post-new.php1,614 ▲8722.89 ▼0.07652.30 ▼34.4566.79 ▲10.55
Media Library /wp-admin/upload.php1,507 ▲1104.29 ▲0.0998.14 ▼1.6941.86 ▼4.81
Add New /wp-admin/post-new.php?post_type=nd_rst_cpt_12,3107.63160.9766.57
Add Timing /wp-admin/admin.php?page=nd-restaurant-reservations-add-timing9801.7825.2827.36
Calendar View /wp-admin/admin.php?page=nd-restaurant-reservations-settings-calendar-view9961.9628.9126.32
Add Exceptions /wp-admin/admin.php?page=nd-restaurant-reservations-add-exception9962.1622.4723.57
Paypal /wp-admin/admin.php?page=nd-restaurant-reservations-paypal1,3182.0123.0427.91
All Orders /wp-admin/admin.php?page=nd-restaurant-reservations-settings-orders8772.0524.1724.32
ND Restaurant /wp-admin/admin.php?page=nd-restaurant-reservations-settings1,3592.1722.9026.23
Reservation Settings /wp-admin/admin.php?page=nd-restaurant-reservations-reservation-settings1,1812.0123.4327.18
Restaurants /wp-admin/edit.php?post_type=nd_rst_cpt_11,1801.9431.0231.50
Import Export /wp-admin/admin.php?page=nd-restaurant-reservations-settings-import-export1,0332.1623.6926.34

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

🔸 Tests weight: 35 | It is important to correctly uninstall your plugin, without leaving any traces
You still need to fix the following
  • The uninstall procedure failed, leaving 1 table in the database
    • wp_nd_rst_booking
  • This plugin did not uninstall successfully, leaving 6 options in the database
    • can_compress_scripts
    • widget_recent-comments
    • widget_recent-posts
    • widget_theysaidso_widget
    • db_upgraded
    • theysaidso_admin_options

Smoke tests 50% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
These server-side errors were triggered
    • > GET request to /wp-admin/admin.php?page=nd-restaurant-reservations-settings-calendar-view
    • > Notice in wp-content/plugins/nd-restaurant-reservations/addons/calendar-view/index.php+20
    Undefined index: nd_rst_arrive_from_filter
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=nd-restaurant-reservations-settings-orders
    • > Notice in wp-content/plugins/nd-restaurant-reservations/inc/admin/3-orders/include/orders.php+7
    Undefined index: nd_rst_order_status
    • > GET request to /wp-admin/admin.php?page=nd-restaurant-reservations-settings-calendar-view
    • > Notice in wp-content/plugins/nd-restaurant-reservations/addons/calendar-view/index.php+22
    Undefined index: nd_rst_date
    • > GET request to /wp-admin/admin.php?page=nd-restaurant-reservations-settings-calendar-view
    • > Notice in wp-content/plugins/nd-restaurant-reservations/addons/calendar-view/index.php+23
    Undefined index: nd_rst_restaurant
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=nd-restaurant-reservations-settings-calendar-view
    • > Notice in wp-content/plugins/nd-restaurant-reservations/inc/functions/functions.php+55
    A non well formed numeric value encountered
    • > GET request to /wp-admin/admin.php?page=nd-restaurant-reservations-settings-orders
    • > Notice in wp-content/plugins/nd-restaurant-reservations/inc/admin/3-orders/include/orders.php+5
    Undefined index: nd_rst_pag_from
    • > GET request to /wp-admin/admin.php?page=nd-restaurant-reservations-settings-orders
    • > Notice in wp-content/plugins/nd-restaurant-reservations/inc/admin/3-orders/include/orders.php+6
    Undefined index: nd_rst_pag_to
    • > GET request to /wp-admin/admin.php?page=nd-restaurant-reservations-settings-orders
    • > User notice in wp-includes/functions.php+5905
    Function wpdb::prepare was called incorrectly. The query argument of wpdb::prepare() must have a placeholder. Please see Debugging in WordPress for more information. (This message was added in version 3.9.0.)

SRP 50% from 2 tests

🔹 Tests weight: 20 | The single-responsibility principle: PHP files have to remain inert when accessed directly, throwing no errors and performing no actions
Almost there! Just fix the following items
  • 40× PHP files trigger server errors when accessed directly (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_option() in wp-content/plugins/nd-restaurant-reservations/inc/admin/8-premium-addons/index.php:4
    • > PHP Fatal error
      Uncaught Error: Call to undefined function sanitize_text_field() in wp-content/plugins/nd-restaurant-reservations/inc/admin/3-orders/include/edit.php:4
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/nd-restaurant-reservations/inc/admin/3-orders/include/add.php:4
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/nd-restaurant-reservations/inc/admin/plugin-settings.php:5
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/nd-restaurant-reservations/addons/calendar-view/index.php:6
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_shortcode() in wp-content/plugins/nd-restaurant-reservations/addons/visual/search/index.php:5
    • > PHP Notice
      Undefined variable: nd_rst_date in wp-content/plugins/nd-restaurant-reservations/inc/shortcodes/include/nd_rst_reservation_details.php on line 4
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_option() in wp-content/plugins/nd-restaurant-reservations/addons/visual/search/layout/layout-2.php:4
    • > PHP Notice
      Undefined variable: nd_rst_date in wp-content/plugins/nd-restaurant-reservations/inc/shortcodes/include/nd_rst_reservation_confirm.php on line 5
    • > PHP Warning
      cal_days_in_month(): invalid date in wp-content/plugins/nd-restaurant-reservations/inc/shortcodes/include/nd_rst_reservation_calendar.php on line 6

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

Optimizations

Plugin configuration 96% from 29 tests

readme.txt Passed 16 tests

The readme.txt file uses markdown syntax to describe your plugin to the world
2 plugin tags: table, restaurants

nd-restaurant-reservations/nd-restaurant-reservations.php 92% from 13 tests

The main PHP file in "Restaurant Reservations" ver. 1.9 adds more information about the plugin and also serves as the entry point for this plugin
It is important to fix the following:
  • Description: Keep the plugin description shorter than 140 characters (currently 219 characters long)

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
No dangerous file extensions were detected7,383 lines of code in 51 files:
LanguageFilesBlank linesComment linesLines of code
PHP353,0124065,740
CSS10179741,024
JavaScript4351156543
SVG20276

PHP code Passed 2 tests

A short review of cyclomatic complexity and code structure
This plugin has no cyclomatic complexity issues
Cyclomatic complexity
Average complexity per logical line of code0.18
Average class complexity4.00
▷ Minimum class complexity1.00
▷ Maximum class complexity8.00
Average method complexity1.45
▷ Minimum method complexity1.00
▷ Maximum method complexity4.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes3
▷ Abstract classes00.00%
▷ Concrete classes3100.00%
▷ Final classes133.33%
Methods20
▷ Static methods15.00%
▷ Public methods1680.00%
▷ Protected methods420.00%
▷ Private methods00.00%
Functions70
▷ Named functions70100.00%
▷ Anonymous functions00.00%
Constants3
▷ Global constants00.00%
▷ Class constants3100.00%
▷ Public constants3100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
24 PNG files occupy 0.21MB with 0.19MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
inc/shortcodes/include/002-calendar.png15.74KB0.76KB▼ 95.15%
assets/img/icon-down-greydark.png1.06KB0.19KB▼ 82.38%
assets/img/remove.png14.69KB0.15KB▼ 98.97%
assets/img/004-restaurant.png18.86KB3.49KB▼ 81.48%
assets/img/002-calendar.png15.74KB0.76KB▼ 95.15%