77% different-menus-in-different-pages

Code Review | Different Menu in Different Pages - Control Menu Visibility (All in One)

WordPress plugin Different Menu in Different Pages - Control Menu Visibility (All in One) scored77%from 54 tests.

About plugin

  • Plugin page: different-menus-i...
  • Plugin version: 2.3.2
  • PHP compatiblity: 5.4+
  • PHP version: 7.4.16
  • WordPress compatibility: 5.1-6.3
  • WordPress version: 6.3.1
  • First release: Jun 30, 2019
  • Latest release: Aug 30, 2023
  • Number of updates: 104
  • Update frequency: every 14.6 days
  • Top authors: recorp (100%)

Code review

54 tests

User reviews

20 reviews

Install metrics

4,000+ active /43,122 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | It is important to correctly install your plugin, without throwing errors or notices
Install script ran successfully

Server metrics [RAM: ▲0.06MB] [CPU: ▼1.99ms] Passed 4 tests

This is a short check of server-side resources used by Different Menu in Different Pages - Control Menu Visibility (All in One)
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /3.52 ▲0.0637.07 ▼1.78
Dashboard /wp-admin3.37 ▲0.0650.59 ▲1.74
Posts /wp-admin/edit.php3.42 ▲0.0646.21 ▼1.39
Add New Post /wp-admin/post-new.php5.95 ▲0.0783.99 ▼3.86
Media Library /wp-admin/upload.php3.29 ▲0.0634.64 ▼0.94
Different Menus /wp-admin/options-general.php?page=different-menus-in-different-pages3.5161.37

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

How much does this plugin use your filesystem and database?
The plugin installed successfully
Filesystem: 73 new files
Database: no new tables, 8 new options
New WordPress options
theysaidso_admin_options
category_children
widget_recent-posts
widget_recent-comments
widget_theysaidso_widget
db_upgraded
can_compress_scripts
dmidp_notices

Browser metrics Passed 4 tests

Checking browser requirements for Different Menu in Different Pages - Control Menu Visibility (All in One)
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,915 ▲15813.60 ▼0.795.34 ▲3.3744.64 ▲0.61
Dashboard /wp-admin2,213 ▲285.83 ▼0.04107.23 ▼10.9842.10 ▼15.37
Posts /wp-admin/edit.php2,096 ▲72.02 ▲0.0536.66 ▲0.5430.20 ▼4.08
Add New Post /wp-admin/post-new.php6,318 ▲4,79019.41 ▼4.00900.46 ▲217.6574.05 ▲21.52
Media Library /wp-admin/upload.php1,395 ▲104.16 ▼0.04109.05 ▲0.9248.15 ▲3.00
Different Menus /wp-admin/options-general.php?page=different-menus-in-different-pages2,8582.3337.3084.87

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
You still need to fix the following
  • The uninstall procedure has failed, leaving 8 options in the database
    • widget_theysaidso_widget
    • widget_recent-posts
    • theysaidso_admin_options
    • dmidp_notices
    • category_children
    • can_compress_scripts
    • widget_recent-comments
    • db_upgraded

Smoke tests 50% 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)
Even though everything seems fine, this is not an exhaustive test

SRP 0% 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
Please take a closer look at the following
  • 1× PHP files perform the action of outputting non-empty strings when accessed directly:
    • > /wp-content/plugins/different-menus-in-different-pages/public/partials/different-menus-for-different-page-public-display.php
  • 14× PHP files trigger server-side errors or warnings when accessed directly (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Call to undefined function wp_get_nav_menus() in wp-content/plugins/different-menus-in-different-pages/admin/partials/Tabs/DuplicateMenus.php:1
    • > PHP Fatal error
      Uncaught Error: Class 'TabOrganizer' not found in wp-content/plugins/different-menus-in-different-pages/admin/partials/TabItems/Pages.php:7
    • > PHP Fatal error
      Uncaught Error: Class 'TabOrganizer' not found in wp-content/plugins/different-menus-in-different-pages/admin/partials/TabItems/Categories.php:7
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_html_e() in wp-content/plugins/different-menus-in-different-pages/admin/partials/Tabs/RemoveMenu.php:7
    • > PHP Fatal error
      Uncaught Error: Class 'TabOrganizer' not found in wp-content/plugins/different-menus-in-different-pages/admin/partials/TabItems/PostTypes.php:7
    • > PHP Fatal error
      Uncaught Error: Call to undefined function DMIDP\\AjaxRequests\\add_action() in wp-content/plugins/different-menus-in-different-pages/admin/includes/AjaxRequests/duplicate-menus.php:15
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_html_e() in wp-content/plugins/different-menus-in-different-pages/admin/partials/Tabs/BackUpAndRestore.php:7
    • > PHP Fatal error
      Uncaught Error: Class 'TabOrganizer' not found in wp-content/plugins/different-menus-in-different-pages/admin/partials/TabItems/Taxonomies.php:7
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_html_e() in wp-content/plugins/different-menus-in-different-pages/admin/partials/Tabs/ResetSettings.php:7
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_dir_url() in wp-content/plugins/different-menus-in-different-pages/admin/deactivate-reason/deactivate_reason.php:10

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
Everything seems fine, but this is not an exhaustive test

Optimizations

Plugin configuration 83% from 29 tests

readme.txt 88% from 16 tests

The readme.txt file is important because it is parsed by WordPress.org for the public listing of your plugin
These attributes need to be fixed:
  • Tags: You are using too many tags: 17 tag instead of maximum 10
  • Requires at least: Version format is invalid
The official readme.txt is a good inspiration

different-menus-in-different-pages/different-menus-in-different-page.php 77% from 13 tests

Analyzing the main PHP file in "Different Menu in Different Pages - Control Menu Visibility (All in One)" version 2.3.2
The following require your attention:
  • Text Domain: Since WordPress version 4.6 the text domain is optional; if specified, it must be the same as the plugin slug
  • Main file name: Name the main plugin file the same as the plugin slug ("different-menus-in-different-pages.php" instead of "different-menus-in-different-page.php")
  • Description: If Twitter did it, so should we! Keep the description under 140 characters (currently 213 characters long)

Code Analysis 97% from 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
Success! There were no dangerous files found in this plugin10,079 lines of code in 59 files:
LanguageFilesBlank linesComment linesLines of code
CSS8668443,930
PHP379617033,160
JavaScript134531832,976
SVG11013

PHP code 50% from 2 tests

This is a short overview of cyclomatic complexity and code structure for this plugin
Please tend to the following items
  • Method cyclomatic complexity has to be reduced to less than 100 (currently 110)
Cyclomatic complexity
Average complexity per logical line of code0.33
Average class complexity16.62
▷ Minimum class complexity1.00
▷ Maximum class complexity153.00
Average method complexity4.90
▷ Minimum method complexity1.00
▷ Maximum method complexity110.00
Code structure
Namespaces13
Interfaces0
Traits0
Classes26
▷ Abstract classes00.00%
▷ Concrete classes26100.00%
▷ Final classes00.00%
Methods104
▷ Static methods21.92%
▷ Public methods9995.19%
▷ Protected methods00.00%
▷ Private methods54.81%
Functions11
▷ Named functions11100.00%
▷ Anonymous functions00.00%
Constants1
▷ Global constants1100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
2 PNG files occupy 0.04MB with 0.01MB in potential savings
Potential savings
Compression of 2 random PNG files using pngquant
FileSize - originalSize - compressedSavings
admin/images/recorp-logo.png10.36KB3.47KB▼ 66.54%
admin/images/flags.png26.02KB26.27KB0.00%