84% simple-onoff-switch

Code Review | Simple On/Off Switch

WordPress plugin Simple On/Off Switch scored84%from 54 tests.

About plugin

  • Plugin page: simple-onoff-switch
  • Plugin version: 1.2
  • PHP version: 7.4.16
  • WordPress compatibility: 3.5-3.5.1
  • WordPress version: 6.3.1
  • First release: Apr 16, 2013
  • Latest release: Apr 16, 2013
  • Number of updates: 8
  • Update frequency: N/A
  • Top authors: mattbeekler (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /1,433 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Verifying that this plugin installs correctly without errors
Install script ran successfully

Server metrics [RAM: ▲0.00MB] [CPU: ▼9.44ms] Passed 4 tests

Analyzing server-side resources used by Simple On/Off Switch
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /3.50 ▲0.0332.86 ▼15.37
Dashboard /wp-admin3.29 ▼0.0237.66 ▼10.10
Posts /wp-admin/edit.php3.37 ▲0.0140.49 ▼4.60
Add New Post /wp-admin/post-new.php5.90 ▲0.0178.34 ▼7.68
Media Library /wp-admin/upload.php3.24 ▲0.0135.04 ▲0.47

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

Analyzing filesystem and database footprints of this plugin
The plugin installed successfully
Filesystem: 2 new files
Database: no new tables, 9 new options
New WordPress options
can_compress_scripts
simpleswitch_offvalue
widget_recent-comments
widget_recent-posts
db_upgraded
simpleswitch
simpleswitch_onvalue
widget_theysaidso_widget
theysaidso_admin_options

Browser metrics Passed 4 tests

Checking browser requirements for Simple On/Off Switch
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,875 ▲12913.34 ▼1.034.00 ▲1.9238.43 ▲0.62
Dashboard /wp-admin2,281 ▲934.86 ▲0.00113.22 ▲5.1239.64 ▼1.14
Posts /wp-admin/edit.php2,086 ▼32.05 ▲0.0439.01 ▲2.6539.24 ▲3.89
Add New Post /wp-admin/post-new.php1,534 ▲123.40 ▲0.29591.13 ▼114.2153.71 ▼0.48
Media Library /wp-admin/upload.php1,391 ▼04.19 ▼0.02101.92 ▲0.4541.11 ▼1.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
Please fix the following items
  • This plugin did not uninstall successfully, leaving 9 options in the database
    • simpleswitch_onvalue
    • simpleswitch
    • simpleswitch_offvalue
    • db_upgraded
    • widget_theysaidso_widget
    • can_compress_scripts
    • widget_recent-posts
    • theysaidso_admin_options
    • widget_recent-comments

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
Even though no errors were found, this is by no means an exhaustive test

SRP 50% from 2 tests

🔹 Tests weight: 20 | It is important to ensure that your PHP files perform no action when accessed directly, respecting the single-responsibility principle
Please take a closer look at the following
  • 1× PHP files trigger server errors when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_option() in wp-content/plugins/simple-onoff-switch/simple-on-off-switch.php:29

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
There were no browser issues found

Optimizations

Plugin configuration 96% from 29 tests

readme.txt Passed 16 tests

Often overlooked, readme.txt is one of the most important files in your plugin
5 plugin tags: dashboard, select, switch, widgets, admin

simple-onoff-switch/simple-on-off-switch.php 92% from 13 tests

The main PHP script in "Simple On/Off Switch" version 1.2 is automatically included on every request by WordPress
The following require your attention:
  • Main file name: Please rename the main PHP file in this plugin to the plugin slug ("simple-onoff-switch.php" instead of "simple-on-off-switch.php")

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
There were no executable files found in this plugin64 lines of code in 1 file:
LanguageFilesBlank linesComment linesLines of code
PHP1162364

PHP code Passed 2 tests

A short review of cyclomatic complexity and code structure
This plugin has no cyclomatic complexity issues
Cyclomatic complexity
Average complexity per logical line of code0.33
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%
Functions7
▷ Named functions7100.00%
▷ Anonymous functions00.00%
Constants0
▷ Global constants00.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 images were found in this plugin