84% hiweb-theme-switcher

Code Review | hiWeb Theme Switcher

WordPress plugin hiWeb Theme Switcher scored84%from 54 tests.

About plugin

  • Plugin page: hiweb-theme-switcher
  • Plugin version: 1.0.1.0
  • PHP version: 7.4.16
  • WordPress compatibility: 4.1-4.5
  • WordPress version: 6.3.1
  • First release: Aug 14, 2016
  • Latest release: Aug 15, 2016
  • Number of updates: 5
  • Update frequency: every 16.6 days
  • Top authors: Den Media (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /1,291 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | All plugins must install correctly, without throwing any errors, warnings, or notices
The plugin installed gracefully, with no errors

Server metrics [RAM: ▲0.02MB] [CPU: ▼1.42ms] Passed 4 tests

An overview of server-side resources used by hiWeb Theme Switcher
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /3.49 ▲0.0335.48 ▼1.11
Dashboard /wp-admin3.33 ▲0.0242.66 ▼2.71
Posts /wp-admin/edit.php3.38 ▲0.0244.69 ▼1.43
Add New Post /wp-admin/post-new.php5.91 ▲0.0289.57 ▲9.45
Media Library /wp-admin/upload.php3.25 ▲0.0234.95 ▼0.41
hiWeb Theme Switcher /wp-admin/edit.php?post_type=hw_theme_switcher3.2934.06

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

Input-output and database impact of this plugin
No storage issues were detected
Filesystem: 24 new files
Database: no new tables, 6 new options
New WordPress options
widget_recent-posts
db_upgraded
widget_recent-comments
theysaidso_admin_options
widget_theysaidso_widget
can_compress_scripts

Browser metrics Passed 4 tests

Checking browser requirements for hiWeb Theme Switcher
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,835 ▲8913.28 ▼1.091.99 ▲0.3938.51 ▲0.59
Dashboard /wp-admin2,210 ▲555.79 ▲0.0895.19 ▲0.3340.00 ▲2.16
Posts /wp-admin/edit.php2,093 ▲12.00 ▼0.1633.68 ▼7.1834.43 ▼5.27
Add New Post /wp-admin/post-new.php1,520 ▲617.41 ▼0.10623.27 ▼31.0058.63 ▼0.67
Media Library /wp-admin/upload.php1,395 ▲44.19 ▲0.0395.84 ▼3.4840.87 ▼2.16
hiWeb Theme Switcher /wp-admin/edit.php?post_type=hw_theme_switcher1,0601.9532.1828.72

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
These items require your attention
  • This plugin did not uninstall successfully, leaving 6 options in the database
    • widget_theysaidso_widget
    • widget_recent-comments
    • theysaidso_admin_options
    • can_compress_scripts
    • db_upgraded
    • widget_recent-posts

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
Even though everything seems fine, this is not 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
Please fix the following items
  • 10× PHP files trigger errors when accessed directly with GET requests:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_post_meta() in wp-content/plugins/hiweb-theme-switcher/templates/meta_boxes_post_types.php:3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function __() in wp-content/plugins/hiweb-theme-switcher/templates/meta_boxes_post_ids.php:1
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/hiweb-theme-switcher/inc/post-type.php:10
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/hiweb-theme-switcher/inc/ajax.php:4
    • > PHP Warning
      Use of undefined constant HW_THEME_SWITCHER_PREFIX - assumed 'HW_THEME_SWITCHER_PREFIX' (this will throw an Error in a future version of PHP) in wp-content/plugins/hiweb-theme-switcher/templates/meta_boxes_post_ids.php on line 1
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/hiweb-theme-switcher/inc/post-type.php:10
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_post_meta() in wp-content/plugins/hiweb-theme-switcher/templates/meta_boxes_theme_id.php:3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_post_meta() in wp-content/plugins/hiweb-theme-switcher/templates/meta_boxes_theme_id.php:3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function hw_theme_switcher() in wp-content/plugins/hiweb-theme-switcher/inc/columns.php:10
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/hiweb-theme-switcher/inc/meta-boxes.php:4

User-side errors Passed 1 test

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

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 88% 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
Please fix the following attributes:
  • Donate link: Please fix this invalid URI: ""
  • Screenshots: These screenshots require images: #1 (List of rules), #2 (Admin rule), #3 (Markers indicating the pages and posts with a modified theme)
Please take inspiration from this readme.txt

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

The main PHP script in "hiWeb Theme Switcher" version 1.0.1.0 is automatically included on every request by WordPress
46 characters long description:
Changing the theme on selected pages and posts

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 plugin430 lines of code in 16 files:
LanguageFilesBlank linesComment linesLines of code
PHP1181115332
JavaScript37454
CSS27144

PHP code Passed 2 tests

A short review of cyclomatic complexity and code structure
There are no cyclomatic complexity problems detected for this plugin
Cyclomatic complexity
Average complexity per logical line of code0.54
Average class complexity52.00
▷ Minimum class complexity52.00
▷ Maximum class complexity52.00
Average method complexity6.10
▷ Minimum method complexity1.00
▷ Maximum method complexity33.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes1
▷ Abstract classes00.00%
▷ Concrete classes1100.00%
▷ Final classes00.00%
Methods10
▷ Static methods00.00%
▷ Public methods10100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions8
▷ Named functions8100.00%
▷ Anonymous functions00.00%
Constants3
▷ Global constants3100.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
5 PNG files occupy 0.16MB with 0.05MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
screenshot-2.png66.31KB34.27KB▼ 48.32%
screenshot-1.png42.21KB21.86KB▼ 48.22%
asset/chosen-sprite@2x.png0.72KB0.83KB0.00%
asset/chosen-sprite.png0.53KB0.88KB0.00%
screenshot-3.png54.24KB28.92KB▼ 46.67%