10% subdomain-theme-switch

Code Review | Sub domain theme switch

WordPress plugin Sub domain theme switch scored 10% from 54 tests.

About plugin

  • Plugin page: subdomain-theme-s...
  • Plugin version: 0.1
  • PHP version: 7.4.16
  • WordPress compatibility: 3.8-4.0
  • WordPress version: 6.3.1
  • First release: Nov 3, 2014
  • Latest release: Nov 3, 2014
  • Number of updates: 5
  • Update frequency: every 26.8 days
  • Top authors: Bijayoli (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active / 1,137 total downloads

Benchmarks

Plugin footprint 40% from 16 tests

Installer 0% from 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
The following installer errors require your attention
  • Install procedure had errors
    • > Notice in wp-content/plugins/subdomain-theme-switch/subdomain-theme-switch.php+18
    Undefined variable: mobilethemeswitch

Server metrics [RAM: ▼1.93MB] [CPU: ▼52.76ms] Passed 4 tests

Analyzing server-side resources used by Sub domain theme switch
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /2.06 ▼1.405.76 ▼44.10
Dashboard /wp-admin2.08 ▼1.228.81 ▼39.59
Posts /wp-admin/edit.php2.08 ▼1.288.16 ▼36.80
Add New Post /wp-admin/post-new.php2.08 ▼3.818.51 ▼90.55
Media Library /wp-admin/upload.php2.08 ▼1.156.88 ▼28.66
Subdomain theme /wp-admin/themes.php?page=subdomain-theme-switch2.087.67

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

A short overview of filesystem and database impact
No storage issues were detected
Filesystem: 4 new files
Database: no new tables, 6 new options
New WordPress options
can_compress_scripts
widget_theysaidso_widget
widget_recent-comments
db_upgraded
widget_recent-posts
theysaidso_admin_options

Browser metrics Passed 4 tests

An overview of browser requirements for Sub domain theme switch
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,804 ▲5813.18 ▼1.204.81 ▲1.9540.68 ▼2.32
Dashboard /wp-admin2,213 ▲254.90 ▼0.17106.67 ▼8.1941.26 ▼6.08
Posts /wp-admin/edit.php2,093 ▲42.02 ▲0.0340.15 ▲2.1135.76 ▲2.57
Add New Post /wp-admin/post-new.php1,543 ▲1022.05 ▼1.01656.53 ▼22.2360.19 ▲5.79
Media Library /wp-admin/upload.php1,392 ▲14.23 ▲0.0593.94 ▼3.0240.07 ▼4.42
Subdomain theme /wp-admin/themes.php?page=subdomain-theme-switch8402.0527.5430.14

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
The following items require your attention
  • This plugin cannot be uninstalled
    • > Notice in wp-content/plugins/subdomain-theme-switch/subdomain-theme-switch.php+18
    Undefined variable: mobilethemeswitch
  • Zombie WordPress options were found after uninstall: 6 options
    • widget_recent-posts
    • widget_theysaidso_widget
    • db_upgraded
    • theysaidso_admin_options
    • can_compress_scripts
    • widget_recent-comments

Smoke tests 50% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | This is a shallow check for server-side errors
Almost there, just fix the following server-side errors
  • 4 occurences, only the last one shown
    • > GET request to /wp-admin/themes.php?page=subdomain-theme-switch
    • > Notice in wp-content/plugins/subdomain-theme-switch/subdomain-theme-switch.php+48
    Undefined variable: mobilethemeswitch
    • > GET request to /wp-admin/themes.php?page=subdomain-theme-switch
    • > Notice in wp-content/plugins/subdomain-theme-switch/subdomain-theme-switch.php+41
    Undefined index: SCRIPT_URI
    • > GET request to /wp-admin/themes.php?page=subdomain-theme-switch
    • > Notice in wp-content/plugins/subdomain-theme-switch/subdomain-theme-switch.php+44
    Undefined index: host
    • > GET request to /wp-admin/themes.php?page=subdomain-theme-switch
    • > Notice in wp-content/plugins/subdomain-theme-switch/subdomain-theme-switch-admin.php+3
    Undefined index: form_hidden
    • > GET request to /wp-admin/themes.php?page=subdomain-theme-switch
    • > User deprecated in wp-includes/functions.php+5453
    Function get_themes is deprecated since version 3.4.0! Use wp_get_themes() instead.
    • > GET request to /wp-admin/themes.php?page=subdomain-theme-switch
    • > User deprecated in wp-includes/functions.php+5453
    Function get_current_theme is deprecated since version 3.4.0! Use wp_get_theme() instead.

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
Please fix the following
  • 3× PHP files trigger errors when accessed directly with GET requests:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_option() in wp-content/plugins/subdomain-theme-switch/subdomain-theme-switch.php:14
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_option() in wp-content/plugins/subdomain-theme-switch/subdomain-theme-switch-admin.php:15
    • > PHP Notice
      Undefined index: form_hidden in wp-content/plugins/subdomain-theme-switch/subdomain-theme-switch-admin.php on line 3

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
Everything seems fine on the user side

Optimizations

Plugin configuration 97% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file is an important file in your plugin as it is parsed by WordPress.org to prepare the public listing of your plugin
Attributes that require attention:
  • Screenshots: Add an image for screenshot #1 (screenshot-1.png)
The official readme.txt might help

subdomain-theme-switch/subdomain-theme-switch.php Passed 13 tests

"Sub domain theme switch" version 0.1's main PHP file describes plugin functionality and also serves as the entry point to any WordPress functionality
116 characters long description:
This plugin detects if your site is being viewed by a mobile browser and switches to an different, selectable theme.

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 detected108 lines of code in 2 files:
LanguageFilesBlank linesComment linesLines of code
PHP23211108

PHP code Passed 2 tests

This is a very shot review of cyclomatic complexity and code structure
Great job! No cyclomatic complexity issues were detected in this plugin
Cyclomatic complexity
Average complexity per logical line of code0.54
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%
Functions3
▷ Named functions3100.00%
▷ Anonymous functions00.00%
Constants4
▷ Global constants4100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Using a strong compression for your PNG files is a great way to speed-up your plugin
1 PNG file occupies 0.02MB with 0.01MB in potential savings
Potential savings
Compression of 1 random PNG file using pngquant
FileSize - originalSize - compressedSavings
screenshot-1.png15.67KB5.81KB▼ 62.95%