83% wp-restaurant-menu

Code Review | WP Restaurant Menu

WordPress plugin WP Restaurant Menu scored 83% from 54 tests.

About plugin

  • Plugin page: wp-restaurant-menu
  • Plugin version: 1.0
  • PHP version: 7.4.16
  • WordPress compatibility: 3.3-3.5.1
  • WordPress version: 5.9.2
  • First release: Apr 18, 2013
  • Latest release: May 4, 2013
  • Number of updates: 8
  • Update frequency: every 2.1 days
  • Top authors: picobarn (100%)

Code review

54 tests

User reviews

5 reviews

Install metrics

10+ active / 3,781 total downloads

Benchmarks

Plugin footprint Passed 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | It is important to correctly install your plugin, without throwing errors or notices
The plugin installed gracefully, with no errors

Server metrics [RAM: ▲0.02MB] [CPU: ▼291.07ms] Passed 4 tests

Analyzing server-side resources used by WP Restaurant Menu
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /3.55 ▲0.0455.07 ▲3.43
Dashboard /wp-admin3.46 ▲0.0538.24 ▼8.61
Posts /wp-admin/edit.php3.69 ▲0.0588.84 ▲48.38
Add New Post /wp-admin/post-new.php6.92 ▼0.0593.32 ▼1,143.05
Media Library /wp-admin/upload.php3.34 ▲0.0430.17 ▼16.04
Food Menu /wp-admin/options-general.php?page=food-settings3.3122.89
Menu Groups /wp-admin/edit-tags.php?taxonomy=menu-groups&post_type=foodmenu3.3324.53
All Menu Items /wp-admin/edit.php?post_type=foodmenu3.3825.88
Add New /wp-admin/post-new.php?post_type=foodmenu3.7047.51

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

Filesystem and database footprint
No storage issues were detected
Filesystem: 11 new files
Database: no new tables, no new options

Browser metrics Passed 4 tests

This is an overview of browser requirements for WP Restaurant Menu
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,844 ▲10116.01 ▼0.147.12 ▲0.372.09 ▲0.00
Dashboard /wp-admin2,945 ▲916.23 ▲0.07115.51 ▼23.34163.57 ▼4.16
Posts /wp-admin/edit.php2,742 ▲573.25 ▲0.0264.61 ▼32.11146.53 ▲1.15
Add New Post /wp-admin/post-new.php1,669 ▼4020.82 ▼0.80409.52 ▼55.37173.17 ▲8.87
Media Library /wp-admin/upload.php1,753 ▲555.47 ▼0.06145.30 ▼6.19180.69 ▼13.36
Food Menu /wp-admin/options-general.php?page=food-settings1,1212.7555.55203.02
Menu Groups /wp-admin/edit-tags.php?taxonomy=menu-groups&post_type=foodmenu1,6732.7970.39151.92
All Menu Items /wp-admin/edit.php?post_type=foodmenu1,4382.9360.75111.88
Add New /wp-admin/post-new.php?post_type=foodmenu3,4689.99237.71220.96

Uninstaller [IO: ▲0.00MB] [DB: ▲0.00MB] Passed 4 tests

🔸 Tests weight: 35 | It is important to correctly uninstall your plugin, without leaving any traces
The plugin uninstalled successfully, without leaving any zombie files or tables

Smoke tests 25% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the server (in the Apache logs)
Everything seems fine, however this is by no means an exhaustive test

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
The following issues need your attention
  • 1× PHP files output non-empty strings when accessed directly via GET requests:
    • > /wp-content/plugins/wp-restaurant-menu/extends/settings.php
  • 6× PHP files trigger server-side errors or warnings when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function is_admin() in wp-content/plugins/wp-restaurant-menu/extends/meta-box.php:125
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/wp-restaurant-menu/extends/settings-panel.php:2
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/wp-restaurant-menu/extends/init.php:2
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/wp-restaurant-menu/extends/admin-head.php:3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_shortcode() in wp-content/plugins/wp-restaurant-menu/extends/shortcode.php:484
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/wp-restaurant-menu/extends/init.php:2

User-side errors 0% from 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
There are user-side issues you should fix
    • > GET request to /wp-admin/options-general.php?page=food-settings
    • > Network (severe)
    wp-content/plugins/food-menu/js/jquery-ui-1.8.4.custom.min.js - Failed to load resource: the server responded with a status of 404 (Not Found)
    • > GET request to /wp-admin/options-general.php?page=food-settings
    • > Console-api (warning) in unknown
    /wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils&ver=5.9.2 1:31592 "jQuery.Deferred exception: jQuery(...).sortable is not a function" "TypeError: jQuery(...).sortable is not a function\n at HTMLDocument.\u003Canonymous> (/wp-admin/options-general.php?page=food-settings:238:32)\n at e (/wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils&ver=5.9.2:2:30038)\n at t (/wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils&ver=5.9.2:2:30340)" undefined
    • > GET request to /wp-admin/options-general.php?page=food-settings
    • > Javascript (severe) in unknown
    /wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils&ver=5.9.2 1:31702 Uncaught TypeError: jQuery(...).sortable is not a function
    • > GET request to /wp-admin/post-new.php?post_type=foodmenu
    • > Network (severe)
    wp-content/plugins/wp-restaurant-menu/extends/jquery.cmbScripts.js?ver=5.9.2 - Failed to load resource: the server responded with a status of 404 (Not Found)
    • > GET request to /wp-admin/post-new.php?post_type=foodmenu
    • > Network (severe)
    wp-content/plugins/wp-restaurant-menu/extends/css/food-menu-admin.css - Failed to load resource: the server responded with a status of 404 (Not Found)

Optimizations

Plugin configuration 96% from 29 tests

readme.txt Passed 16 tests

Don't ignore readme.txt as it is the file that instructs WordPress.org on how to present your plugin to the world
8 plugin tags: template function, bars, shortcode, restaurants, food...

wp-restaurant-menu/food-menu.php 92% from 13 tests

The main PHP script in "WP Restaurant Menu" version 1.0 is automatically included on every request by WordPress
You should first fix the following items:
  • Main file name: The principal plugin file should be the same as the plugin slug ("wp-restaurant-menu.php" instead of "food-menu.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is an overview of file extensions present in this plugin and a short test that no dangerous files are bundled with this plugin
Everything looks great! No dangerous files found in this plugin1,452 lines of code in 9 files:
LanguageFilesBlank linesComment linesLines of code
PHP71851411,096
CSS22944356

PHP code Passed 2 tests

Analyzing cyclomatic complexity and code structure
Great job! No cyclomatic complexity issues were detected in this plugin
Cyclomatic complexity
Average complexity per logical line of code0.47
Average class complexity62.50
▷ Minimum class complexity2.00
▷ Maximum class complexity123.00
Average method complexity18.57
▷ Minimum method complexity1.00
▷ Maximum method complexity69.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes2
▷ Abstract classes00.00%
▷ Concrete classes2100.00%
▷ Final classes00.00%
Methods7
▷ Static methods00.00%
▷ Public methods7100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions15
▷ Named functions15100.00%
▷ Anonymous functions00.00%
Constants1
▷ Global constants1100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

It is recommended to compress PNG files in your plugin to minimize bandwidth usage
1 PNG file occupies 0.00MB with 0.00MB in potential savings
Potential savings
Compression of 1 random PNG file using pngquant
FileSize - originalSize - compressedSavings
images/icon.png2.98KB1.70KB▼ 42.89%