10% post-switch

Code Review | Post Switch

WordPress plugin Post Switch scored10%from 54 tests.

About plugin

  • Plugin page: post-switch
  • Plugin version: 1.0
  • PHP version: 7.4.16
  • WordPress compatibility: 3.1-3.5
  • WordPress version: 6.3.1
  • First release: Oct 13, 2012
  • Latest release: Oct 21, 2012
  • Number of updates: 11
  • Update frequency: every 2.0 days
  • Top authors: chaozh (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /1,214 total downloads

Benchmarks

Plugin footprint 40% from 16 tests

Installer 0% from 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
You still need to fix the following installer errors
  • The plugin did not install without errors
    • > Warning in wp-content/plugins/post-switch/post-switch.php+10
    Use of undefined constant POSTSWITCH_PLUGIN - assumed 'POSTSWITCH_PLUGIN' (this will throw an Error in a future version of PHP)

Server metrics [RAM: ▼1.91MB] [CPU: ▼61.70ms] Passed 4 tests

A check of server-side resources used by Post Switch
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /2.09 ▼1.384.88 ▼39.55
Dashboard /wp-admin2.11 ▼1.246.45 ▼60.84
Posts /wp-admin/edit.php2.11 ▼1.256.66 ▼44.33
Add New Post /wp-admin/post-new.php2.11 ▼3.786.66 ▼102.07
Media Library /wp-admin/upload.php2.11 ▼1.126.17 ▼31.92

Server storage [IO: ▲0.01MB] [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: 3 new files
Database: no new tables, 6 new options
New WordPress options
theysaidso_admin_options
widget_recent-posts
widget_theysaidso_widget
db_upgraded
widget_recent-comments
can_compress_scripts

Browser metrics Passed 4 tests

A check of browser resources used by Post Switch
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,789 ▲2814.69 ▲0.341.73 ▼0.2542.79 ▲0.61
Dashboard /wp-admin2,195 ▲155.61 ▼0.0491.40 ▼4.9841.28 ▼0.09
Posts /wp-admin/edit.php2,103 ▲32.04 ▲0.0539.02 ▼1.4537.20 ▲2.64
Add New Post /wp-admin/post-new.php6,256 ▲4,70926.22 ▲7.83930.39 ▲245.9066.14 ▼15.36
Media Library /wp-admin/upload.php1,394 ▼34.21 ▲0.00100.20 ▲0.5842.97 ▲1.58

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

🔸 Tests weight: 35 | It is important to correctly uninstall your plugin, without leaving any traces
It is recommended to fix the following
  • The plugin did not uninstall gracefully
    • > Warning in wp-content/plugins/post-switch/post-switch.php+10
    Use of undefined constant POSTSWITCH_PLUGIN - assumed 'POSTSWITCH_PLUGIN' (this will throw an Error in a future version of PHP)
  • Zombie WordPress options were found after uninstall: 6 options
    • widget_recent-comments
    • theysaidso_admin_options
    • db_upgraded
    • can_compress_scripts
    • widget_recent-posts
    • widget_theysaidso_widget

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for server-side errors
Even though no errors were found, this is by no means an exhaustive test

SRP 50% from 2 tests

🔹 Tests weight: 20 | A shallow check of the single-responsibility principle; PHP files should perform no action - including output of placeholder text - and trigger no errors when accessed directly
Almost there! Just fix the following items
  • 3× GET requests to PHP files trigger server-side errors or Error 500 responses:
    • > PHP Warning
      Use of undefined constant POSTSWITCH_VERSION - assumed 'POSTSWITCH_VERSION' (this will throw an Error in a future version of PHP) in wp-content/plugins/post-switch/post-switch.php on line 11
    • > PHP Warning
      Use of undefined constant POSTSWITCH_PLUGIN - assumed 'POSTSWITCH_PLUGIN' (this will throw an Error in a future version of PHP) in wp-content/plugins/post-switch/post-switch.php on line 10
    • > PHP Fatal error
      Uncaught Error: Call to undefined function load_plugin_textdomain() in wp-content/plugins/post-switch/post-switch.php:12

User-side errors Passed 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
Everything seems fine, but this is not an exhaustive test

Optimizations

Plugin configuration 97% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file describes your plugin functionality and requirements and it is parsed to prepare the your plugin's listing
These attributes need your attention:
  • Plugin Name: "Plugin Name" should be replaced with the name of your plugin on the first line ( === post-switch === )
You can take inspiration from this readme.txt

post-switch/post-switch.php Passed 13 tests

"Post Switch" version 1.0's primary PHP file adds more information about the plugin and serves as the entry point for WordPress
24 characters long description:
Quickly switch edit post

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
Good job! No executable or dangerous file extensions detected177 lines of code in 2 files:
LanguageFilesBlank linesComment linesLines of code
PHP12519132
JavaScript10345

PHP code Passed 2 tests

An short overview of logical lines of code, cyclomatic complexity, and other code metrics
Great job! No cyclomatic complexity issues were detected in this plugin
Cyclomatic complexity
Average complexity per logical line of code0.31
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%
Functions9
▷ Named functions9100.00%
▷ Anonymous functions00.00%
Constants2
▷ Global constants2100.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
There were not PNG files found in your plugin