83% codepeople-theme-switch

Code Review | Theme Switch in Mobile and Desktop

WordPress plugin Theme Switch in Mobile and Desktop scored83%from 54 tests.

About plugin

  • Plugin page: codepeople-theme-...
  • Plugin version: 1.0.16
  • PHP version: 7.4.16
  • WordPress compatibility: 3.0.5-6.3
  • WordPress version: 6.3.1
  • First release: Aug 21, 2012
  • Latest release: Jul 23, 2023
  • Number of updates: 67
  • Update frequency: every 59.5 days
  • Top authors: codepeople (100%)

Code review

54 tests

User reviews

6 reviews

Install metrics

100+ active /29,545 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
Install script ran successfully

Server metrics [RAM: ▲0.11MB] [CPU: ▼1.94ms] Passed 4 tests

Analyzing server-side resources used by Theme Switch in Mobile and Desktop
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /3.59 ▲0.1353.82 ▲11.49
Dashboard /wp-admin3.41 ▲0.1054.44 ▼0.66
Posts /wp-admin/edit.php3.52 ▲0.1649.20 ▼1.25
Add New Post /wp-admin/post-new.php5.99 ▲0.1087.34 ▼14.19
Media Library /wp-admin/upload.php3.33 ▲0.1042.55 ▲8.33
Theme Switch in Mobile and Desktop /wp-admin/options-general.php?page=codepeople_theme_switch_slug3.3243.30

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

Filesystem and database footprint
The plugin installed successfully
Filesystem: 12 new files
Database: no new tables, 6 new options
New WordPress options
widget_recent-posts
widget_theysaidso_widget
theysaidso_admin_options
can_compress_scripts
widget_recent-comments
db_upgraded

Browser metrics Passed 4 tests

This is an overview of browser requirements for Theme Switch in Mobile and Desktop
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,818 ▲5714.27 ▼0.131.96 ▲0.2843.44 ▼3.34
Dashboard /wp-admin2,199 ▲225.58 ▼0.0195.52 ▼6.2742.75 ▲0.48
Posts /wp-admin/edit.php2,104 ▲42.01 ▲0.0133.14 ▼3.4135.49 ▼1.31
Add New Post /wp-admin/post-new.php1,529 ▲323.36 ▲0.41678.69 ▼22.5959.51 ▲4.30
Media Library /wp-admin/upload.php1,401 ▲44.19 ▲0.02106.30 ▲5.0147.60 ▲0.26
Theme Switch in Mobile and Desktop /wp-admin/options-general.php?page=codepeople_theme_switch_slug1,5749.19293.7332.26

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
It is recommended to fix the following
  • This plugin does not fully uninstall, leaving 6 options in the database
    • widget_recent-comments
    • widget_recent-posts
    • can_compress_scripts
    • theysaidso_admin_options
    • widget_theysaidso_widget
    • db_upgraded

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 | SRP (Single-Responsibility Principle) - PHP files must act as libraries and never output text or perform any action when accessed directly in a browser
Almost there! Just fix the following items
  • 2× GET requests to PHP files have triggered server-side errors or warnings:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/codepeople-theme-switch/banner.php:108
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/codepeople-theme-switch/banner.php:108

User-side errors Passed 1 test

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

Optimizations

Plugin configuration 90% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file is important because it is parsed by WordPress.org for the public listing of your plugin
These attributes need your attention:
  • Tags: There are too many tags (20 tag instead of maximum 10)
You can take inspiration from this readme.txt

codepeople-theme-switch/codepeople-theme-switch.php 85% from 13 tests

This is the main PHP file of "Theme Switch in Mobile and Desktop" version 1.0.16, providing information about the plugin in the header fields and serving as the principal entry point to the plugin's functions
The following require your attention:
  • Description: If Twitter did it, so should we! Keep the description under 140 characters (currently 362 characters long)
  • Text Domain: You no longer need to specify the text domain since WordPress 4.6; it must be the same as the plugin slug

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
Everything looks great! No dangerous files found in this plugin712 lines of code in 7 files:
LanguageFilesBlank linesComment linesLines of code
PHP26041557
JavaScript216695
PO File1121240
CSS20020

PHP code Passed 2 tests

This plugin's cyclomatic complexity and code structure detailed below
Although this was not an exhaustive test, there were no cyclomatic complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.81
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%
Functions15
▷ Named functions15100.00%
▷ Anonymous functions00.00%
Constants1
▷ Global constants1100.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
2 PNG files occupy 0.00MB with 0.00MB in potential savings
Potential savings
Compression of 2 random PNG files using pngquant
FileSize - originalSize - compressedSavings
images/empty.png0.18KB0.08KB▼ 54.70%
styles/screenshot.png1.82KB1.61KB▼ 11.65%