84% if-menu

Code Review | If Menu - Visibility control for Menus

WordPress plugin If Menu - Visibility control for Menus scored84%from 54 tests.

About plugin

  • Plugin page: if-menu
  • Plugin version: 0.17.0
  • PHP compatiblity: 5.6+
  • PHP version: 7.4.16
  • WordPress version: 6.3.1
  • First release: Oct 10, 2012
  • Latest release: Mar 29, 2023
  • Number of updates: 62
  • Update frequency: every 61.7 days
  • Top authors: andrei.igna (100%)

Code review

54 tests

User reviews

122 reviews

Install metrics

70,000+ active /853,173 total downloads

Benchmarks

Plugin footprint 82% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
Installer ran successfully

Server metrics [RAM: ▲0.31MB] [CPU: ▼1.06ms] 75% from 4 tests

An overview of server-side resources used by If Menu - Visibility control for Menus
It is recommended to improve the following
  • CPU: Total CPU usage should be kept under 500.00ms (currently 705.44ms on /wp-admin/themes.php?page=if-menu)
PageMemory (MB)CPU Time (ms)
Home /3.77 ▲0.3144.07 ▲0.34
Dashboard /wp-admin3.61 ▲0.3151.00 ▲0.13
Posts /wp-admin/edit.php3.73 ▲0.3752.90 ▼0.67
Add New Post /wp-admin/post-new.php6.20 ▲0.3190.65 ▼4.04
Media Library /wp-admin/upload.php3.53 ▲0.3143.82 ▲8.81
If Menu /wp-admin/themes.php?page=if-menu3.52705.44

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

Filesystem and database footprint
No storage issues were detected
Filesystem: 147 new files
Database: no new tables, 6 new options
New WordPress options
widget_recent-posts
widget_recent-comments
theysaidso_admin_options
db_upgraded
can_compress_scripts
widget_theysaidso_widget

Browser metrics Passed 4 tests

If Menu - Visibility control for Menus: an overview of browser usage
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,825 ▲7914.48 ▲0.101.94 ▲0.2542.96 ▼3.29
Dashboard /wp-admin2,232 ▲444.85 ▼1.05103.22 ▼16.6139.29 ▼4.28
Posts /wp-admin/edit.php2,112 ▲232.02 ▼0.0336.72 ▼4.9533.00 ▼4.75
Add New Post /wp-admin/post-new.php1,555 ▲3523.28 ▼0.08679.44 ▼16.2164.31 ▲1.00
Media Library /wp-admin/upload.php1,414 ▲264.17 ▲0.06102.80 ▼8.5045.94 ▲0.49
If Menu /wp-admin/themes.php?page=if-menu1,1072.0522.3063.23

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 6 options in the database
    • widget_recent-comments
    • can_compress_scripts
    • theysaidso_admin_options
    • widget_recent-posts
    • db_upgraded
    • widget_theysaidso_widget

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a short smoke test looking for server-side errors
Everything seems fine, however this is by no means an exhaustive test

SRP 50% from 2 tests

🔹 Tests weight: 20 | A shallow check of the single-responsibility principle; PHP files should perform no action - including output of placeholder text - and trigger no errors when accessed directly
Please fix the following items
  • 105× PHP files trigger server-side errors or warnings when accessed directly (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'Walker_Nav_Menu_Edit' not found in wp-content/plugins/if-menu/src/if-menu-nav-menu.php:10
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_filter() in wp-content/plugins/if-menu/src/user-info.php:12
    • > PHP Fatal error
      Uncaught Error: Class 'Composer\\Installers\\BaseInstaller' not found in wp-content/plugins/if-menu/vendor/composer/installers/src/Composer/Installers/ZendInstaller.php:4
    • > PHP Fatal error
      Uncaught Error: Class 'Composer\\Installers\\BaseInstaller' not found in wp-content/plugins/if-menu/vendor/composer/installers/src/Composer/Installers/ClanCatsFrameworkInstaller.php:4
    • > PHP Fatal error
      Uncaught Error: Class 'Composer\\Installers\\BaseInstaller' not found in wp-content/plugins/if-menu/vendor/composer/installers/src/Composer/Installers/SilverStripeInstaller.php:6
    • > PHP Fatal error
      Uncaught Error: Class 'Composer\\Installers\\BaseInstaller' not found in wp-content/plugins/if-menu/vendor/composer/installers/src/Composer/Installers/VanillaInstaller.php:4
    • > PHP Fatal error
      Uncaught Error: Class 'Composer\\Installers\\BaseInstaller' not found in wp-content/plugins/if-menu/vendor/composer/installers/src/Composer/Installers/PuppetInstaller.php:5
    • > PHP Fatal error
      Uncaught Error: Class 'Composer\\Installers\\BaseInstaller' not found in wp-content/plugins/if-menu/vendor/composer/installers/src/Composer/Installers/KnownInstaller.php:4
    • > PHP Fatal error
      Uncaught Error: Class 'Composer\\Installers\\BaseInstaller' not found in wp-content/plugins/if-menu/vendor/composer/installers/src/Composer/Installers/MicroweberInstaller.php:4
    • > PHP Fatal error
      Uncaught Error: Class 'Composer\\Installers\\BaseInstaller' not found in wp-content/plugins/if-menu/vendor/composer/installers/src/Composer/Installers/TheliaInstaller.php:4

User-side errors Passed 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
Everything seems fine, but this is not an exhaustive test

Optimizations

Plugin configuration 97% from 29 tests

readme.txt 94% from 16 tests

Perhaps the most important file in your plugin readme.txt gets parsed in order to generate the public listing of your plugin
Please fix the following attributes:
  • Requires at least: The plugin version is formatted incorrectly
Please take inspiration from this readme.txt

if-menu/if-menu.php Passed 13 tests

The main PHP script in "If Menu - Visibility control for Menus" version 0.17.0 is automatically included on every request by WordPress
65 characters long description:
Display tailored menu items to each visitor with visibility rules

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | There should be no dangerous file extensions present in any WordPress plugin
Everything looks great! No dangerous files found in this plugin5,135 lines of code in 134 files:
LanguageFilesBlank linesComment linesLines of code
PHP1166507084,108
JSON400359
CSS3714331
YAML3303118
PO File2202479
JavaScript219662
Markdown223047
XML13027
SVG1004

PHP code Passed 2 tests

This plugin's cyclomatic complexity and code structure detailed below
This plugin has no cyclomatic complexity issues
Cyclomatic complexity
Average complexity per logical line of code0.32
Average class complexity3.72
▷ Minimum class complexity1.00
▷ Maximum class complexity72.00
Average method complexity3.25
▷ Minimum method complexity1.00
▷ Maximum method complexity21.00
Code structure
Namespaces5
Interfaces0
Traits0
Classes108
▷ Abstract classes10.93%
▷ Concrete classes10799.07%
▷ Final classes00.00%
Methods137
▷ Static methods1712.41%
▷ Public methods9972.26%
▷ Protected methods3223.36%
▷ Private methods64.38%
Functions35
▷ Named functions1028.57%
▷ Anonymous functions2571.43%
Constants4
▷ Global constants00.00%
▷ Class constants4100.00%
▷ Public constants4100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
1 compressed PNG file occupies 0.19MB
Potential savings
Compression of 1 random PNG file using pngquant
FileSize - originalSize - compressedSavings
assets/plan-premium.png191.18KB202.21KB0.00%