84% menu-swapper

Code Review | Menu Swapper

WordPress plugin Menu Swapper scored84%from 54 tests.

About plugin

  • Plugin page: menu-swapper
  • Plugin version: 1.2
  • PHP compatiblity: 7.4+
  • PHP version: 7.4.16
  • WordPress compatibility: 5.5-6.1.1
  • WordPress version: 6.3.1
  • First release: May 14, 2013
  • Latest release: Feb 7, 2023
  • Number of updates: 19
  • Update frequency: every 187.4 days
  • Top authors: sevenspark (100%)

Code review

54 tests

User reviews

43 reviews

Install metrics

5,000+ active /55,998 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
The plugin installed gracefully, with no errors

Server metrics [RAM: ▲0.04MB] [CPU: ▼4.16ms] Passed 4 tests

A check of server-side resources used by Menu Swapper
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /3.48 ▲0.0240.65 ▼1.20
Dashboard /wp-admin3.36 ▲0.0150.58 ▼14.61
Posts /wp-admin/edit.php3.47 ▲0.1253.99 ▲3.51
Add New Post /wp-admin/post-new.php5.94 ▲0.0694.08 ▼4.35
Media Library /wp-admin/upload.php3.28 ▲0.0539.41 ▲5.46
Menu Swapper /wp-admin/options-general.php?page=menu-swapper3.2532.51

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

Input-output and database impact of this plugin
This plugin installed successfully
Filesystem: 7 new files
Database: no new tables, 6 new options
New WordPress options
widget_theysaidso_widget
theysaidso_admin_options
widget_recent-posts
widget_recent-comments
can_compress_scripts
db_upgraded

Browser metrics Passed 4 tests

An overview of browser requirements for Menu Swapper
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,793 ▲714.31 ▼0.051.77 ▼0.2741.15 ▲0.49
Dashboard /wp-admin2,202 ▲255.64 ▲0.0594.19 ▲4.5841.04 ▼5.46
Posts /wp-admin/edit.php2,107 ▲71.98 ▼0.0640.42 ▲2.9435.04 ▼2.17
Add New Post /wp-admin/post-new.php6,284 ▲4,75019.29 ▼4.03922.51 ▲239.9769.06 ▲12.55
Media Library /wp-admin/upload.php1,401 ▲44.31 ▲0.10102.47 ▲3.3746.87 ▼1.63
Menu Swapper /wp-admin/options-general.php?page=menu-swapper9132.0423.7239.43

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
It is recommended to fix the following
  • This plugin did not uninstall successfully, leaving 6 options in the database
    • db_upgraded
    • widget_recent-comments
    • theysaidso_admin_options
    • can_compress_scripts
    • widget_recent-posts
    • widget_theysaidso_widget

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no server-side errors were triggered
Everything seems fine, however 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
  • 3× PHP files trigger server errors when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/menu-swapper/includes/functions.php:8
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/menu-swapper/includes/admin-page.php:3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/menu-swapper/includes/meta-box.php:23

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
Everything seems fine on the user side

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file describes your plugin functionality and requirements and it is parsed to prepare the your plugin's listing
These attributes need to be fixed:
  • Plugin Name: "Plugin Name" should be replaced with the name of your plugin on the first line ( === menu-swapper === )
You can look at the official readme.txt

menu-swapper/menu-swapper.php 92% from 13 tests

The main PHP script in "Menu Swapper" version 1.2 is automatically included on every request by WordPress
You should first fix the following items:
  • Text Domain: The text domain is optional since WordPress version 4.6; if you do specify it, it must be the same as the plugin slug

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is a short overview of programming languages used in this plugin, detecting executable files
No dangerous file extensions were detected362 lines of code in 6 files:
LanguageFilesBlank linesComment linesLines of code
PHP48759290
CSS14046
JavaScript110126

PHP code Passed 2 tests

Analyzing logical lines of code, cyclomatic complexity, and other code metrics
No cyclomatic complexity issues were detected for this plugin
Cyclomatic complexity
Average complexity per logical line of code0.53
Average class complexity7.00
▷ Minimum class complexity7.00
▷ Maximum class complexity7.00
Average method complexity2.50
▷ Minimum method complexity1.00
▷ Maximum method complexity5.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes1
▷ Abstract classes00.00%
▷ Concrete classes1100.00%
▷ Final classes1100.00%
Methods4
▷ Static methods125.00%
▷ Public methods250.00%
▷ Protected methods00.00%
▷ Private methods250.00%
Functions14
▷ Named functions14100.00%
▷ Anonymous functions00.00%
Constants7
▷ Global constants7100.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
No PNG files were detected