68% mobile-switcher

Code Review | Mobile Switcher

WordPress plugin Mobile Switcher scored68%from 54 tests.

About plugin

  • Plugin page: mobile-switcher
  • Plugin version: 1.0.0
  • PHP version: 7.4.16
  • WordPress compatibility: 3.0.1-4.1.1
  • WordPress version: 6.3.1
  • First release: Mar 26, 2015
  • Latest release: Mar 26, 2015
  • Number of updates: 3
  • Update frequency: every 1.0 days
  • Top authors: TimurKhamitov (100%)

Code review

54 tests

User reviews

1 review

Install metrics

200+ active /5,828 total downloads

Benchmarks

Plugin footprint 65% from 16 tests

Installer Passed 1 test

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

Server metrics [RAM: ▼0.68MB] [CPU: ▼26.99ms] Passed 4 tests

An overview of server-side resources used by Mobile Switcher
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /3.68 ▲0.2246.73 ▲5.55
Dashboard /wp-admin3.26 ▼0.0429.11 ▼15.21
Posts /wp-admin/edit.php3.26 ▼0.1026.92 ▼16.08
Add New Post /wp-admin/post-new.php3.26 ▼2.6325.09 ▼67.37
Media Library /wp-admin/upload.php3.26 ▲0.0324.97 ▼9.29

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

Input-output and database impact of this plugin
There were no storage issued detected upon installing this plugin
Filesystem: 23 new files
Database: no new tables, 10 new options
New WordPress options
ms_mobile_template
ms_desktop_template
can_compress_scripts
mobile_switcher_enabled
ms_tablet_template
widget_recent-posts
widget_theysaidso_widget
db_upgraded
theysaidso_admin_options
widget_recent-comments

Browser metrics Passed 4 tests

Mobile Switcher: an overview of browser usage
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,924 ▲16713.92 ▼0.485.23 ▲3.1738.31 ▼6.11
Dashboard /wp-admin2,222 ▲335.91 ▲1.01107.09 ▼5.9341.57 ▲4.54
Posts /wp-admin/edit.php2,105 ▲132.02 ▼0.0339.40 ▼3.8134.67 ▼4.15
Add New Post /wp-admin/post-new.php1,528 ▼1423.23 ▲5.16663.42 ▲64.1365.73 ▲12.09
Media Library /wp-admin/upload.php1,407 ▲224.25 ▲0.0598.16 ▲2.0040.54 ▼0.68

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
You still need to fix the following
  • The plugin did not uninstall gracefully
    • > User deprecated in wp-includes/functions.php+5737
    Function has_cap was called with an argument that is deprecated since version 2.0.0! Usage of user levels is deprecated. Use capabilities instead.
  • This plugin does not fully uninstall, leaving 6 options in the database
    • widget_recent-posts
    • can_compress_scripts
    • widget_theysaidso_widget
    • widget_recent-comments
    • theysaidso_admin_options
    • db_upgraded

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
Everything seems fine, however this is by no means an exhaustive test

SRP 0% 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 output text when accessed directly:
    • > /wp-content/plugins/mobile-switcher/public/partials/mobile-switcher-public-display.php
  • 1× GET requests to PHP files trigger server-side errors or Error 500 responses:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function _e() in wp-content/plugins/mobile-switcher/admin/partials/plugin-mobile-switcher-display.php:18

User-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
Everything seems fine on the user side

Optimizations

Plugin configuration 97% from 29 tests

readme.txt 94% from 16 tests

It's important to format your readme.txt file correctly as it is parsed for the public listing of your plugin
These attributes need your attention:
  • Screenshots: Screenshot #1 (= 1.0.0 =) image not found
The official readme.txt is a good inspiration

mobile-switcher/mobile-switcher.php Passed 13 tests

"Mobile Switcher" version 1.0.0's main PHP file describes plugin functionality and also serves as the entry point to any WordPress functionality
61 characters long description:
This plugin allow to set themes for mobile phones and tablets

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | Executable files are considered dangerous and should not be included with any WordPress plugin
Everything looks great! No dangerous files found in this plugin956 lines of code in 17 files:
LanguageFilesBlank linesComment linesLines of code
PHP132481,162944
CSS2286
JavaScript24546

PHP code Passed 2 tests

Analyzing logical lines of code, cyclomatic complexity, and other code metrics
Although this was not an exhaustive test, there were no cyclomatic complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.56
Average class complexity17.38
▷ Minimum class complexity1.00
▷ Maximum class complexity123.00
Average method complexity3.02
▷ Minimum method complexity1.00
▷ Maximum method complexity77.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes8
▷ Abstract classes00.00%
▷ Concrete classes8100.00%
▷ Final classes00.00%
Methods65
▷ Static methods1116.92%
▷ Public methods5889.23%
▷ Protected methods23.08%
▷ Private methods57.69%
Functions3
▷ Named functions3100.00%
▷ Anonymous functions00.00%
Constants10
▷ Global constants110.00%
▷ Class constants990.00%
▷ Public constants9100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

It is recommended to compress PNG files in your plugin to minimize bandwidth usage
There were not PNG files found in your plugin