84% conditional-menus

Code Review | Conditional Menus

WordPress plugin Conditional Menus scored84%from 54 tests.

About plugin

  • Plugin page: conditional-menus
  • Plugin version: 1.2.3
  • PHP version: 7.4.16
  • WordPress compatibility: 4.0-6.3.1
  • WordPress version: 6.3.1
  • First release: Sep 1, 2016
  • Latest release: Sep 11, 2023
  • Number of updates: 104
  • Update frequency: every 32.9 days
  • Top authors: themifyme (100%)

Code review

54 tests

User reviews

62 reviews

Install metrics

70,000+ active /616,798 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
Install script ran successfully

Server metrics [RAM: ▲0.10MB] [CPU: ▼9.31ms] Passed 4 tests

A check of server-side resources used by Conditional Menus
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /3.56 ▲0.1039.28 ▼5.79
Dashboard /wp-admin3.40 ▲0.1055.78 ▼1.43
Posts /wp-admin/edit.php3.52 ▲0.1652.55 ▼15.95
Add New Post /wp-admin/post-new.php5.99 ▲0.1086.37 ▼14.07
Media Library /wp-admin/upload.php3.33 ▲0.1044.10 ▲4.60
Conditional Menus /wp-admin/tools.php?page=conditional-menus3.3136.67

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

A short overview of filesystem and database impact
This plugin installed successfully
Filesystem: 14 new files
Database: no new tables, 6 new options
New WordPress options
can_compress_scripts
widget_recent-posts
widget_recent-comments
db_upgraded
widget_theysaidso_widget
theysaidso_admin_options

Browser metrics Passed 4 tests

Checking browser requirements for Conditional Menus
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,793 ▲3214.72 ▲0.162.19 ▲0.6342.42 ▼1.39
Dashboard /wp-admin2,202 ▲285.64 ▲0.0486.01 ▼12.0040.50 ▼2.79
Posts /wp-admin/edit.php2,104 ▲12.01 ▼0.0244.56 ▲7.6433.31 ▼3.61
Add New Post /wp-admin/post-new.php1,537 ▲1121.03 ▼2.00685.30 ▼5.8053.86 ▼3.35
Media Library /wp-admin/upload.php1,404 ▲74.14 ▲0.0393.83 ▼17.0138.97 ▼8.51
Conditional Menus /wp-admin/tools.php?page=conditional-menus8162.1121.9726.79

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

🔸 Tests weight: 35 | All plugins must uninstall correctly, removing their source code and extra database tables they might have created
You still need to fix the following
  • The uninstall procedure has failed, leaving 6 options in the database
    • can_compress_scripts
    • widget_theysaidso_widget
    • widget_recent-posts
    • widget_recent-comments
    • theysaidso_admin_options
    • db_upgraded

Smoke tests 75% 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 no errors were found, this is by no means an exhaustive test

SRP 50% 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× GET requests to PHP files have triggered server-side errors or warnings:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function apply_filters() in wp-content/plugins/conditional-menus/templates/conditions.php:3

User-side errors Passed 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
No browser errors were detected

Optimizations

Plugin configuration 93% from 29 tests

readme.txt Passed 16 tests

The readme.txt file describes your plugin functionality and requirements and it is parsed to prepare the your plugin's listing
5 plugin tags: menu, admin, menu-items, context, conditional-tags

conditional-menus/init.php 85% from 13 tests

The principal PHP file in "Conditional Menus" v. 1.2.3 is loaded by WordPress automatically on each request
The following require your attention:
  • Text Domain: The text domain must be the same as the plugin slug, although optional since WordPress version 4.6
  • Main file name: It is recommended to name the main PHP file as the plugin slug ("conditional-menus.php" instead of "init.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | An overview of files in this plugin; executable files are not allowed
There were no executable files found in this plugin1,328 lines of code in 7 files:
LanguageFilesBlank linesComment linesLines of code
PHP26379569
CSS276521
JavaScript22711225
HTML10013

PHP code Passed 2 tests

Cyclomatic complexity and code structure are the fingerprint of this plugin
Although this was not an exhaustive test, there were no cyclomatic complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code1.00
Average class complexity168.00
▷ Minimum class complexity168.00
▷ Maximum class complexity168.00
Average method complexity7.19
▷ Minimum method complexity1.00
▷ Maximum method complexity87.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes1
▷ Abstract classes00.00%
▷ Concrete classes1100.00%
▷ Final classes00.00%
Methods27
▷ Static methods311.11%
▷ Public methods2488.89%
▷ Protected methods00.00%
▷ Private methods311.11%
Functions0
▷ Named functions00.00%
▷ Anonymous functions00.00%
Constants1
▷ Global constants1100.00%
▷ Class constants00.00%
▷ Public constants00.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.03MB
Potential savings
Compression of 1 random PNG file using pngquant
FileSize - originalSize - compressedSavings
docs/images/conditional-menus.png29.36KB31.14KB0.00%