66% my-restaurant-menu

Code Review | My Restaurant Menu

WordPress plugin My Restaurant Menu scored 66% from 54 tests.

About plugin

  • Plugin page: my-restaurant-menu
  • Plugin version: 0.2.0
  • PHP version: 7.4.16
  • WordPress compatibility: 3.9-3.9.1
  • WordPress version: 5.8.1
  • First release: Jul 13, 2014
  • Latest release: Sep 26, 2014
  • Number of updates: 11
  • Update frequency: every 8.0 days
  • Top authors: mp62 (100%)

Code review

54 tests

User reviews

1 review

Install metrics

20+ active / 2,611 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Verifying that this plugin installs correctly without errors
Installer ran successfully

Server metrics [RAM: ▲0.14MB] [CPU: ▼142.17ms] Passed 4 tests

An overview of server-side resources used by My Restaurant Menu
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /2.93 ▲0.2137.99 ▲15.87
Dashboard /wp-admin3.20 ▲0.1456.82 ▲16.26
Posts /wp-admin/edit.php3.32 ▲0.2148.57 ▲4.15
Add New Post /wp-admin/post-new.php5.52 ▲0.0987.68 ▼586.96
Media Library /wp-admin/upload.php3.11 ▲0.1031.51 ▼1.72
Menus /wp-admin/edit.php?post_type=mp62_mrm_menu3.1935.21
Add New /wp-admin/post-new.php?post_type=mp62_mrm_item3.2749.48
Settings /wp-admin/edit.php?post_type=mp62_mrm_item&page=my-restaurant-menu-settings3.0828.92
Item need /wp-admin/edit-tags.php?taxonomy=mp62_mrm_item_need&post_type=mp62_mrm_item3.1031.02
All items /wp-admin/edit.php?post_type=mp62_mrm_item3.1938.78
Categories /wp-admin/edit-tags.php?taxonomy=mp62_mrm_item_section&post_type=mp62_mrm_item3.1033.42

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

A short overview of filesystem and database impact
This plugin was installed successfully
Filesystem: 189 new files
Database: no new tables, 1 new option
New WordPress options
mp62_mrm_fonts_list

Browser metrics Passed 4 tests

Checking browser requirements for My Restaurant Menu
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /4,013 ▲41717.96 ▲1.998.84 ▼1.2941.22 ▼6.78
Dashboard /wp-admin3,265 ▲3348.39 ▲2.43164.64 ▲19.34112.07 ▼5.23
Posts /wp-admin/edit.php3,066 ▲3273.96 ▲1.2596.81 ▲33.0687.67 ▼2.61
Add New Post /wp-admin/post-new.php1,691 ▲821.80 ▲3.03265.33 ▼121.85105.00 ▼4.01
Media Library /wp-admin/upload.php1,912 ▲1024.99 ▼0.05116.17 ▼26.31120.30 ▲1.89
Menus /wp-admin/edit.php?post_type=mp62_mrm_menu1,7234.4083.5673.68
Add New /wp-admin/post-new.php?post_type=mp62_mrm_item3,3839.10220.41135.91
Settings /wp-admin/edit.php?post_type=mp62_mrm_item&page=my-restaurant-menu-settings1,5494.0080.4683.55
Item need /wp-admin/edit-tags.php?taxonomy=mp62_mrm_item_need&post_type=mp62_mrm_item2,1104.3476.2193.06
All items /wp-admin/edit.php?post_type=mp62_mrm_item1,7204.3783.1872.62
Categories /wp-admin/edit-tags.php?taxonomy=mp62_mrm_item_section&post_type=mp62_mrm_item2,1354.3175.27110.44

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

🔸 Tests weight: 35 | The uninstall procedure must remove all plugin files and extra database tables
Please fix the following items
  • The uninstall procedure has failed, leaving 1 option in the database
    • mp62_mrm_fonts_list

Smoke tests 0% 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)
These errors were triggered by the plugin
    • > GET request to /wp-admin/edit.php?post_type=mp62_mrm_item&page=my-restaurant-menu-settings
    • > User deprecated in wp-includes/functions.php+5221
    screen_icon is deprecated since version 3.8.0 with no alternative available.
    • > GET request to /wp-admin/edit.php?post_type=mp62_mrm_item&page=my-restaurant-menu-settings
    • > User deprecated in wp-includes/functions.php+5221
    get_screen_icon is deprecated since version 3.8.0 with no alternative available.
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/edit-tags.php?taxonomy=mp62_mrm_item_section&post_type=mp62_mrm_item
    • > Notice in wp-content/plugins/my-restaurant-menu/includes/class-mp62-mrm-main.php+193
    Trying to get property 'term_id' of non-object

SRP 0% from 2 tests

🔹 Tests weight: 20 | The single-responsibility principle applies for WordPress plugins as well - please make sure your PHP files perform no actions when accessed directly
Almost there! Just fix the following items
  • 4× PHP files output non-empty strings when accessed directly via GET requests:
    • > /wp-content/plugins/my-restaurant-menu/templates/01menu-section.php
    • > /wp-content/plugins/my-restaurant-menu/templates/01menu.php
    • > /wp-content/plugins/my-restaurant-menu/dompdf/load_font.php
    • > /wp-content/plugins/my-restaurant-menu/templates/01menu-item.php
  • 191× PHP files trigger errors when accessed directly with GET requests (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'Font_Table' not found in wp-content/plugins/my-restaurant-menu/dompdf/lib/php-font-lib/classes/Font_Table_loca.php:14
    • > PHP Warning
      Use of undefined constant DOMPDF_DIR - assumed 'DOMPDF_DIR' (this will throw an Error in a future version of PHP) in wp-content/plugins/my-restaurant-menu/dompdf/lib/fonts/dompdf_font_family_cache.dist.php on line 63
    • > PHP Warning
      Use of undefined constant DOMPDF_FONT_DIR - assumed 'DOMPDF_FONT_DIR' (this will throw an Error in a future version of PHP) in wp-content/plugins/my-restaurant-menu/dompdf/lib/fonts/dompdf_font_family_cache.php on line 67
    • > PHP Warning
      Use of undefined constant DOMPDF_DIR - assumed 'DOMPDF_DIR' (this will throw an Error in a future version of PHP) in wp-content/plugins/my-restaurant-menu/dompdf/lib/fonts/dompdf_font_family_cache.dist.php on line 12
    • > PHP Warning
      Use of undefined constant DOMPDF_DIR - assumed 'DOMPDF_DIR' (this will throw an Error in a future version of PHP) in wp-content/plugins/my-restaurant-menu/dompdf/lib/fonts/dompdf_font_family_cache.dist.php on line 33
    • > PHP Fatal error
      require_once(): Failed opening required 'DOMPDF_LIB_DIR/class.pdf.php' (include_path='.:/usr/share/php') in wp-content/plugins/my-restaurant-menu/dompdf/include/font_metrics.cls.php on line 11
    • > PHP Warning
      Use of undefined constant DOMPDF_DIR - assumed 'DOMPDF_DIR' (this will throw an Error in a future version of PHP) in wp-content/plugins/my-restaurant-menu/dompdf/lib/fonts/dompdf_font_family_cache.dist.php on line 13
    • > PHP Fatal error
      Uncaught Error: Class 'Positioner' not found in wp-content/plugins/my-restaurant-menu/dompdf/include/absolute_positioner.cls.php:12
    • > PHP Notice
      Undefined variable: item in wp-content/plugins/my-restaurant-menu/templates/01menu-item.php on line 3
    • > PHP Warning
      Use of undefined constant DOMPDF_FONT_DIR - assumed 'DOMPDF_FONT_DIR' (this will throw an Error in a future version of PHP) in wp-content/plugins/my-restaurant-menu/dompdf/lib/fonts/dompdf_font_family_cache.php on line 75

User-side errors 0% from 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
Please take a look at the following user-side issues
    • > GET request to /wp-admin/post-new.php?post_type=mp62_mrm_item
    • > Network (severe)
    var/www/wordpress/wp-content/plugins/my-restaurant-menu/css/my-restaurant-menu-fonts.css?wp-mce-49110-20201110 - 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

Perhaps the most important file in your plugin readme.txt gets parsed in order to generate the public listing of your plugin
4 plugin tags: menu, food, drink, restaurant

my-restaurant-menu/index.php 92% from 13 tests

Analyzing the main PHP file in "My Restaurant Menu" version 0.2.0
Please take the time to fix the following:
  • Main file name: Name the main plugin file the same as the plugin slug ("my-restaurant-menu.php" instead of "index.php")

Code Analysis 97% from 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
Success! There were no dangerous files found in this plugin23,779 lines of code in 140 files:
LanguageFilesBlank linesComment linesLines of code
PHP1266,41411,36722,697
CSS58851606
JavaScript22120239
Markdown3410175
JSON20039
HTML10017
XML1006

PHP code 50% from 2 tests

Analyzing cyclomatic complexity and code structure
Please fix the following
  • Please reduce cyclomatic complexity of methods to less than 100 (currently 653)
Cyclomatic complexity
Average complexity per logical line of code0.43
Average class complexity38.33
▷ Minimum class complexity1.00
▷ Maximum class complexity766.00
Average method complexity4.64
▷ Minimum method complexity1.00
▷ Maximum method complexity653.00
Code structure
Namespaces0
Interfaces1
Traits0
Classes115
▷ Abstract classes54.35%
▷ Concrete classes11095.65%
▷ Final classes00.00%
Methods1,229
▷ Static methods12310.01%
▷ Public methods1,04785.19%
▷ Protected methods13711.15%
▷ Private methods453.66%
Functions52
▷ Named functions5198.08%
▷ Anonymous functions11.92%
Constants157
▷ Global constants159.55%
▷ Class constants14290.45%
▷ Public constants142100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
2 PNG files occupy 0.00MB with 0.00MB in potential savings
Potential savings
Compression of 2 random PNG files using pngquant
FileSize - originalSize - compressedSavings
images/no-image.png1.33KB0.65KB▼ 51.57%
dompdf/lib/res/broken_image.png0.60KB0.47KB▼ 22.33%