78% toggles-shortcode-and-widget

Code Review | Toggles Shortcode and Widget

WordPress plugin Toggles Shortcode and Widget scored78%from 54 tests.

About plugin

  • Plugin page: toggles-shortcode...
  • Plugin version: 1.14
  • PHP version: 7.4.16
  • WordPress compatibility: 3.6-5.9
  • WordPress version: 6.3.1
  • First release: May 30, 2014
  • Latest release: May 7, 2022
  • Number of updates: 23
  • Update frequency: every 126.0 days
  • Top authors: OTWthemes (100%)

Code review

54 tests

User reviews

2 reviews

Install metrics

1,000+ active /30,549 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
This plugin's installer ran successfully

Server metrics [RAM: ▲0.19MB] [CPU: ▲4.68ms] Passed 4 tests

A check of server-side resources used by Toggles Shortcode and Widget
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /3.67 ▲0.2051.83 ▲9.93
Dashboard /wp-admin3.52 ▲0.2253.55 ▲4.19
Posts /wp-admin/edit.php3.57 ▲0.2157.24 ▲4.37
Add New Post /wp-admin/post-new.php6.06 ▲0.17100.23 ▲0.21
Media Library /wp-admin/upload.php3.40 ▲0.1746.59 ▲10.32
otwfcr /wp-admin/admin.php?page=otwfcr3.3735.74
License Manager /wp-admin/admin.php?page=otw-tgsw-lm3.50180.63
Settings /wp-admin/admin.php?page=otw-tgsw-settings3.3937.08

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

A short overview of filesystem and database impact
There were no storage issued detected upon installing this plugin
Filesystem: 127 new files
Database: no new tables, 7 new options
New WordPress options
widget_recent-posts
theysaidso_admin_options
can_compress_scripts
widget_otw_shortcode_widget
widget_recent-comments
db_upgraded
widget_theysaidso_widget

Browser metrics Passed 4 tests

An overview of browser requirements for Toggles Shortcode and Widget
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,952 ▲19113.86 ▼0.7010.39 ▲8.7244.01 ▼0.28
Dashboard /wp-admin2,232 ▲555.78 ▲0.1795.87 ▲7.4168.99 ▲27.67
Posts /wp-admin/edit.php2,161 ▲582.31 ▲0.2940.60 ▼0.9434.85 ▼2.81
Add New Post /wp-admin/post-new.php6,256 ▲4,73021.37 ▼1.61910.91 ▲226.1449.35 ▼14.15
Media Library /wp-admin/upload.php1,455 ▲554.59 ▲0.42106.54 ▼7.2380.10 ▲28.68
otwfcr /wp-admin/admin.php?page=otwfcr8311.8725.5626.41
License Manager /wp-admin/admin.php?page=otw-tgsw-lm9781.8228.7227.19
Settings /wp-admin/admin.php?page=otw-tgsw-settings9342.0028.4139.46

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

🔸 Tests weight: 35 | All plugins must uninstall correctly, removing their source code and extra database tables they might have created
You still need to fix the following
  • Zombie WordPress options were found after uninstall: 7 options
    • widget_theysaidso_widget
    • widget_recent-comments
    • widget_recent-posts
    • theysaidso_admin_options
    • widget_otw_shortcode_widget
    • can_compress_scripts
    • db_upgraded

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a short smoke test looking for server-side errors
Everything seems fine, however this is by no means an exhaustive test

SRP 0% 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
The following issues need your attention
  • 2× PHP files output text when accessed directly:
    • > /wp-content/plugins/toggles-shortcode-and-widget/include/otw_components/otw_shortcode/libs/recaptcha-php-1.11/example-mailhide.php
    • > /wp-content/plugins/toggles-shortcode-and-widget/include/otw_components/otw_factory/views/action_message.php
  • 14× PHP files trigger server errors when accessed directly (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Call to undefined function otw_post() in wp-content/plugins/toggles-shortcode-and-widget/include/otw_components/otw_shortcode/libs/recaptcha-php-1.11/example-captcha.php:18
    • > PHP Fatal error
      Uncaught Error: Class 'WP_Widget' not found in wp-content/plugins/toggles-shortcode-and-widget/include/otw_components/otw_shortcode/widgets/otw_shortcode_widget.class.php:2
    • > PHP Fatal error
      Uncaught Error: Call to undefined function __() in wp-content/plugins/toggles-shortcode-and-widget/include/otw_labels/otw_tgsw_factory_object.labels.php:2
    • > PHP Fatal error
      Uncaught Error: Class 'OTW_Component' not found in wp-content/plugins/toggles-shortcode-and-widget/include/otw_components/otw_shortcode/otw_shortcode.class.php:2
    • > PHP Fatal error
      Uncaught Error: Using $this when not in object context in wp-content/plugins/toggles-shortcode-and-widget/include/otw_components/otw_factory/views/license_manager.php:3
    • > PHP Fatal error
      Uncaught Error: Class 'OTW_Component' not found in wp-content/plugins/toggles-shortcode-and-widget/include/otw_components/otw_form/otw_form.class.php:2
    • > PHP Fatal error
      Uncaught Error: Call to undefined function load_plugin_textdomain() in wp-content/plugins/toggles-shortcode-and-widget/otw_content_manager.php:11
    • > PHP Fatal error
      Uncaught Error: Call to undefined function otw_post() in wp-content/plugins/toggles-shortcode-and-widget/include/otw_tgsw_process_actions.php:6
    • > PHP Notice
      Undefined variable: return_url in wp-content/plugins/toggles-shortcode-and-widget/include/otw_components/otw_factory/views/action_message.php on line 6
    • > PHP Fatal error
      Uncaught Error: Class 'OTW_Shortcodes' not found in wp-content/plugins/toggles-shortcode-and-widget/include/otw_components/otw_shortcode/shortcodes/otw_shortcode_content_toggle.class.php:2

User-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
Everything seems fine, but this is not an exhaustive test

Optimizations

Plugin configuration 93% 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
Please fix the following attributes:
  • Screenshots: These screenshots do not have images: #1 (WYSIWYG page/post editor button), #2 (OTW Shortcode Widget), #3 (Toggles Options), #4 (Front-end)
The official readme.txt is a good inspiration

toggles-shortcode-and-widget/otw_content_manager.php 92% from 13 tests

"Toggles Shortcode and Widget" version 1.14's primary PHP file adds more information about the plugin and serves as the entry point for WordPress
The following require your attention:
  • Main file name: Even though not officially enforced, the main plugin file should be the same as the plugin slug ("toggles-shortcode-and-widget.php" instead of "otw_content_manager.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short check of programming languages and file extensions; no executable files are allowed
Success! There were no dangerous files found in this plugin17,072 lines of code in 60 files:
LanguageFilesBlank linesComment linesLines of code
CSS144721137,722
PHP271,4239214,563
SVG4002,709
JavaScript145061322,061
JSON10017

PHP code Passed 2 tests

This is a short overview of cyclomatic complexity and code structure for this plugin
Great job! No cyclomatic complexity issues were detected in this plugin
Cyclomatic complexity
Average complexity per logical line of code0.51
Average class complexity75.67
▷ Minimum class complexity1.00
▷ Maximum class complexity193.00
Average method complexity5.23
▷ Minimum method complexity1.00
▷ Maximum method complexity35.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes9
▷ Abstract classes00.00%
▷ Concrete classes9100.00%
▷ Final classes00.00%
Methods159
▷ Static methods2213.84%
▷ Public methods12075.47%
▷ Protected methods2716.98%
▷ Private methods127.55%
Functions47
▷ Named functions47100.00%
▷ Anonymous functions00.00%
Constants3
▷ Global constants3100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

PNG files should be compressed to save space and minimize bandwidth usage
35 PNG files occupy 0.18MB with 0.04MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
include/otw_components/otw_shortcode/images/blockquote-testimonial.png0.16KB0.20KB0.00%
screenshot-2.png43.84KB18.28KB▼ 58.30%
include/otw_components/otw_form/img/colorpicker/colorpicker_hex.png0.52KB0.42KB▼ 19.92%
include/otw_components/otw_shortcode/images/diag-background-translucent-darker.png0.08KB0.10KB0.00%
include/otw_components/otw_form/img/colorpicker/colorpicker_hsb_s.png1.14KB0.80KB▼ 29.97%