10% nutrition-facts-label

Code Review | Nutrition Facts Label

WordPress plugin Nutrition Facts Label scored 10% from 54 tests.

About plugin

  • Plugin page: nutrition-facts-l...
  • Plugin version: 1.5
  • PHP version: 7.4.16
  • WordPress compatibility: 3.0.1-4.4
  • WordPress version: 6.3.1
  • First release: Nov 27, 2015
  • Latest release: Dec 17, 2015
  • Number of updates: 82
  • Update frequency: every 0.2 days
  • Top authors: kengimel (100%)

Code review

54 tests

User reviews

2 reviews

Install metrics

10+ active / 2,125 total downloads

Benchmarks

Plugin footprint 40% from 16 tests

Installer 0% from 1 test

🔺 Critical test (weight: 50) | It is important to correctly install your plugin, without throwing errors or notices
You still need to fix the following installer errors
  • The plugin cannot be installed
    • > Warning in wp-content/plugins/nutrition-facts-label/process.php+25
    Use of undefined constant NUT_API - assumed 'NUT_API' (this will throw an Error in a future version of PHP)

Server metrics [RAM: ▼1.91MB] [CPU: ▼53.00ms] Passed 4 tests

Server-side resources used by Nutrition Facts Label
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /2.08 ▼1.384.95 ▼38.59
Dashboard /wp-admin2.10 ▼1.206.65 ▼41.56
Posts /wp-admin/edit.php2.10 ▼1.265.34 ▼41.47
Add New Post /wp-admin/post-new.php2.10 ▼3.795.53 ▼90.36
Media Library /wp-admin/upload.php2.10 ▼1.137.18 ▼30.20
Nutrition Label /wp-admin/admin.php?page=gfb-nutrition-label-settings2.105.79
Update Recipes /wp-admin/admin.php?page=gfb-nutrition-label-settings-12.106.74

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

A short overview of filesystem and database impact
There were no storage issued detected upon installing this plugin
Filesystem: 27 new files
Database: no new tables, 6 new options
New WordPress options
can_compress_scripts
widget_theysaidso_widget
widget_recent-comments
db_upgraded
theysaidso_admin_options
widget_recent-posts

Browser metrics Passed 4 tests

A check of browser resources used by Nutrition Facts Label
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,853 ▲11813.72 ▼0.693.63 ▲1.7841.76 ▼11.32
Dashboard /wp-admin2,245 ▲605.97 ▲0.16103.43 ▼6.6850.50 ▲4.99
Posts /wp-admin/edit.php2,131 ▲422.27 ▲0.2232.57 ▼9.5134.67 ▼1.20
Add New Post /wp-admin/post-new.php1,549 ▲3023.42 ▲0.29599.65 ▼83.6233.97 ▼30.45
Media Library /wp-admin/upload.php1,433 ▲454.30 ▲0.1294.28 ▼18.0239.16 ▼10.42
Nutrition Label /wp-admin/admin.php?page=gfb-nutrition-label-settings1,1021.9730.4768.55
Update Recipes /wp-admin/admin.php?page=gfb-nutrition-label-settings-18341.8023.1127.01

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
Please fix the following items
  • This plugin cannot be uninstalled
    • > Warning in wp-content/plugins/nutrition-facts-label/process.php+25
    Use of undefined constant NUT_API - assumed 'NUT_API' (this will throw an Error in a future version of PHP)
  • The uninstall procedure has failed, leaving 6 options in the database
    • theysaidso_admin_options
    • can_compress_scripts
    • widget_recent-comments
    • widget_theysaidso_widget
    • widget_recent-posts
    • db_upgraded

Smoke tests 0% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
These errors were triggered by the plugin
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=gfb-nutrition-label-settings-1
    • > Warning in wp-content/plugins/nutrition-facts-label/process.php+25
    Use of undefined constant NUT_API - assumed 'NUT_API' (this will throw an Error in a future version of PHP)
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=gfb-nutrition-label-settings-1
    • > Warning in wp-content/plugins/nutrition-facts-label/process.php+27
    Use of undefined constant C_URL - assumed 'C_URL' (this will throw an Error in a future version of PHP)
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=gfb-nutrition-label-settings-1
    • > Warning in wp-content/plugins/nutrition-facts-label/process.php+28
    Use of undefined constant META_KEY - assumed 'META_KEY' (this will throw an Error in a future version of PHP)
    • > GET request to /wp-admin/admin.php?page=gfb-nutrition-label-settings
    • > Notice in wp-content/plugins/nutrition-facts-label/sections.php+15
    Undefined variable: message
    • > GET request to /wp-admin/admin.php?page=gfb-nutrition-label-settings
    • > Notice in wp-content/plugins/nutrition-facts-label/sections.php+21
    Undefined variable: readonly
    • > GET request to /wp-admin/admin.php?page=gfb-nutrition-label-settings
    • > Notice in wp-content/plugins/nutrition-facts-label/sections.php+21
    Undefined variable: ingredients
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=gfb-nutrition-label-settings
    • > Notice in wp-content/plugins/nutrition-facts-label/admin_front_end.php+1
    Trying to get property 'ID' of non-object

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 fix the following items
  • 1× GET requests to PHP files return non-empty strings:
    • > /wp-content/plugins/nutrition-facts-label/nutrition-facts-label.php
  • 14× GET requests to PHP files have triggered server-side errors or warnings (only 10 are shown):
    • > PHP Notice
      Undefined variable: ingredients in wp-content/plugins/nutrition-facts-label/sections.php on line 21
    • > PHP Notice
      Undefined variable: message in wp-content/plugins/nutrition-facts-label/sections.php on line 15
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_dir_url() in wp-content/plugins/nutrition-facts-label/form.php:24
    • > PHP Notice
      Undefined variable: readonly in wp-content/plugins/nutrition-facts-label/sections.php on line 21
    • > PHP Warning
      Use of undefined constant C_URL - assumed 'C_URL' (this will throw an Error in a future version of PHP) in wp-content/plugins/nutrition-facts-label/process.php on line 27
    • > PHP Notice
      Trying to get property 'ID' of non-object in wp-content/plugins/nutrition-facts-label/sections.php on line 23
    • > PHP Fatal error
      Uncaught Error: Call to undefined function admin_url() in wp-content/plugins/nutrition-facts-label/process.php:27
    • > PHP Warning
      Use of undefined constant C_URL - assumed 'C_URL' (this will throw an Error in a future version of PHP) in wp-content/plugins/nutrition-facts-label/sections.php on line 22
    • > PHP Warning
      Use of undefined constant NUT_API - assumed 'NUT_API' (this will throw an Error in a future version of PHP) in wp-content/plugins/nutrition-facts-label/process.php on line 25
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_post_meta() in wp-content/plugins/nutrition-facts-label/admin_front_end.php:1

User-side errors 0% from 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
Please fix the following user-side errors
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=gfb-nutrition-label-settings-1
    • > Network (severe)
    wp-content/plugins/nutrition-facts-label/includes/assets/css/jquery-ui-1.7.2.custom.css?ver=6.3.1 - Failed to load resource: the server responded with a status of 404 (Not Found)
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=gfb-nutrition-label-settings-1
    • > Network (severe)
    wp-content/plugins/nutrition-facts-label/includes/assets/javascript/jquery.ui.progressbar.min.js - Failed to load resource: the server responded with a status of 404 (Not Found)

Optimizations

Plugin configuration 93% from 29 tests

readme.txt Passed 16 tests

The readme.txt file is undoubtedly the most important file in your plugin, preparing it for public listing on WordPress.org
8 plugin tags: recipe plugin, shortcode, nutrition label, nutrition, global food book...

nutrition-facts-label/nutrition-facts-label.php 85% from 13 tests

Analyzing the main PHP file in "Nutrition Facts Label" version 1.5
You should first fix the following items:
  • Git Repository: A Git repository was detected inside this plugin
  • Description: Keep the plugin description shorter than 140 characters (currently 214 characters long)

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short review of files and their extensions; it is not recommended to include executable files
Good job! No executable or dangerous file extensions detected5,204 lines of code in 16 files:
LanguageFilesBlank linesComment linesLines of code
JavaScript47013874,407
PHP86059416
CSS22339216
Markdown1560116
HTML14049

PHP code Passed 2 tests

Cyclomatic complexity and code structure are the fingerprint of this plugin
No cyclomatic complexity issues were detected for this plugin
Cyclomatic complexity
Average complexity per logical line of code0.26
Average class complexity0.00
▷ Minimum class complexity0.00
▷ Maximum class complexity0.00
Average method complexity0.00
▷ Minimum method complexity0.00
▷ Maximum method complexity0.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes0
▷ Abstract classes00.00%
▷ Concrete classes00.00%
▷ Final classes00.00%
Methods0
▷ Static methods00.00%
▷ Public methods00.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions16
▷ Named functions16100.00%
▷ Anonymous functions00.00%
Constants4
▷ Global constants4100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
8 PNG files occupy 1.12MB with 0.76MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
screenshot-2.png430.63KB124.39KB▼ 71.11%
screenshot-1.png350.40KB105.33KB▼ 69.94%
includes/assets/css/images/down.png2.77KB0.11KB▼ 95.98%
includes/assets/images/beta.png0.83KB0.80KB▼ 4.45%
includes/assets/css/images/up.png2.78KB0.11KB▼ 95.99%