84% mdc-theme-switcher

Code Review | MDC Theme Switcher

WordPress plugin MDC Theme Switcher scored 84% from 54 tests.

About plugin

  • Plugin page: mdc-theme-switcher
  • Plugin version: 3.1.0
  • PHP version: 7.4.16
  • WordPress compatibility: 3.0.1-4.4.2
  • WordPress version: 5.8.1
  • First release: Jun 29, 2014
  • Latest release: Apr 11, 2016
  • Number of updates: 33
  • Update frequency: every 19.8 days
  • Top authors: mukto90 (100%)

Code review

54 tests

User reviews

13 reviews

Install metrics

40+ active / 5,198 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

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

Server metrics [RAM: ▲0.15MB] [CPU: ▼135.42ms] Passed 4 tests

This is a short check of server-side resources used by MDC Theme Switcher
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /2.97 ▲0.1359.14 ▲25.34
Dashboard /wp-admin3.28 ▲0.2254.01 ▲8.40
Posts /wp-admin/edit.php3.33 ▲0.2256.42 ▲8.59
Add New Post /wp-admin/post-new.php5.54 ▲0.1195.88 ▼560.56
Media Library /wp-admin/upload.php3.14 ▲0.1435.74 ▲1.90

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

A short overview of filesystem and database impact
This plugin was installed successfully
Filesystem: 8 new files
Database: no new tables, 3 new options
New WordPress options
mdc_theme_switcher
current_theme
theme_switched

Browser metrics Passed 4 tests

This is an overview of browser requirements for MDC Theme Switcher
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /4,086 ▲49017.96 ▲2.4212.31 ▲3.3849.00 ▼0.02
Dashboard /wp-admin3,192 ▲2588.20 ▲2.26159.66 ▲14.40128.49 ▲9.13
Posts /wp-admin/edit.php3,018 ▲2794.40 ▲1.7183.43 ▲16.75125.47 ▲31.90
Add New Post /wp-admin/post-new.php1,712 ▲2918.05 ▼0.72350.74 ▼37.67116.53 ▼4.41
Media Library /wp-admin/upload.php1,864 ▲574.89 ▼0.13116.02 ▼41.20143.66 ▲21.75

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

🔸 Tests weight: 35 | The uninstall procedure must remove all plugin files and extra database tables
It is recommended to fix the following
  • This plugin does not fully uninstall, leaving 2 options in the database
    • current_theme
    • theme_switched

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

SRP 50% 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
The following issues need your attention
  • 2× PHP files trigger server errors when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/mdc-theme-switcher/admin/class.settings-api.php:30
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/mdc-theme-switcher/admin/class.settings-api.php:30

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
No browser issues were found

Optimizations

Plugin configuration Passed 29 tests

readme.txt Passed 16 tests

You should put a lot of thought into formatting readme.txt as it is used by WordPress.org to prepare the public listing of your plugin
10 plugin tags: activate, mdc, theme switch, switch, preview...

mdc-theme-switcher/mdc-theme-switcher.php Passed 13 tests

The principal PHP file in "MDC Theme Switcher" v. 3.1.0 is loaded by WordPress automatically on each request
101 characters long description:
MDC Theme Switcher allows to change and preview among available themes of a WordPress from front-end.

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | Executable files are not allowed as they can serve as attack vectors
There were no executable files found in this plugin748 lines of code in 6 files:
LanguageFilesBlank linesComment linesLines of code
PHP4156215630
CSS11583
JavaScript14035

PHP code Passed 2 tests

This is a short overview of cyclomatic complexity and code structure for this plugin
There were no cyclomatic complexity issued detected
Cyclomatic complexity
Average complexity per logical line of code0.31
Average class complexity22.00
▷ Minimum class complexity3.00
▷ Maximum class complexity49.00
Average method complexity2.40
▷ Minimum method complexity1.00
▷ Maximum method complexity15.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes3
▷ Abstract classes00.00%
▷ Concrete classes3100.00%
▷ Final classes00.00%
Methods45
▷ Static methods00.00%
▷ Public methods45100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions1
▷ Named functions1100.00%
▷ Anonymous functions00.00%
Constants0
▷ Global constants00.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
1 PNG file occupies 0.00MB with 0.00MB in potential savings
Potential savings
Compression of 1 random PNG file using pngquant
FileSize - originalSize - compressedSavings
assets/img/icon.png4.00KB1.26KB▼ 68.59%