83% conditional-widgets

Code Review | Conditional Widgets

WordPress plugin Conditional Widgets scored83%from 54 tests.

About plugin

  • Plugin page: conditional-widgets
  • Plugin version: 3.1
  • PHP version: 7.4.16
  • WordPress compatibility: 3.0-6.1.1
  • WordPress version: 6.3.1
  • First release: Mar 28, 2011
  • Latest release: Dec 6, 2022
  • Number of updates: 55
  • Update frequency: every 77.7 days
  • Top authors: MadtownLems (100%)

Code review

54 tests

User reviews

24 reviews

Install metrics

10,000+ active /116,554 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
Installer ran successfully

Server metrics [RAM: ▲0.01MB] [CPU: ▼5.84ms] Passed 4 tests

A check of server-side resources used by Conditional Widgets
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /3.47 ▲0.0137.12 ▼4.29
Dashboard /wp-admin3.31 ▲0.0144.33 ▼9.08
Posts /wp-admin/edit.php3.36 ▲0.0145.65 ▼3.10
Add New Post /wp-admin/post-new.php5.89 ▲0.0182.94 ▼6.88
Media Library /wp-admin/upload.php3.24 ▲0.0132.71 ▼0.15

Server storage [IO: ▲0.19MB] [DB: ▲0.07MB] Passed 3 tests

How much does this plugin use your filesystem and database?
This plugin installed successfully
Filesystem: 15 new files
Database: no new tables, 7 new options
New WordPress options
theysaidso_admin_options
widget_recent-comments
widget_recent-posts
db_upgraded
can_compress_scripts
widget_theysaidso_widget
conditional_widgets_version

Browser metrics Passed 4 tests

A check of browser resources used by Conditional Widgets
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,825 ▲9013.26 ▼1.111.82 ▲0.0741.79 ▼7.44
Dashboard /wp-admin2,206 ▲185.79 ▼0.1296.04 ▼10.2737.59 ▼7.00
Posts /wp-admin/edit.php2,089 ▼02.03 ▲0.0138.82 ▼1.4835.11 ▲0.96
Add New Post /wp-admin/post-new.php1,535 ▲322.89 ▼0.25648.93 ▲3.1252.47 ▲3.06
Media Library /wp-admin/upload.php1,385 ▼34.19 ▼0.0397.75 ▲2.5140.53 ▼0.95

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

🔸 Tests weight: 35 | All plugins must uninstall correctly, removing their source code and extra database tables they might have created
These items require your attention
  • This plugin did not uninstall successfully, leaving 7 options in the database
    • can_compress_scripts
    • conditional_widgets_version
    • widget_recent-posts
    • db_upgraded
    • widget_theysaidso_widget
    • widget_recent-comments
    • theysaidso_admin_options

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
The smoke test was a success, however most plugin functionality was not tested

SRP 50% from 2 tests

🔹 Tests weight: 20 | The single-responsibility principle applies for WordPress plugins as well - please make sure your PHP files perform no actions when accessed directly
Almost there! Just fix the following items
  • 7× PHP files trigger server errors when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Class 'Walker' not found in wp-content/plugins/conditional-widgets/includes/class-walker-category-checklist.php:12
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/conditional-widgets/admin.php:10
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/conditional-widgets/form.php:9
    • > PHP Fatal error
      Uncaught Error: Class 'Walker' not found in wp-content/plugins/conditional-widgets/includes/class-walker-page-checklist.php:12
    • > PHP Fatal error
      Uncaught Error: Call to undefined function is_admin() in wp-content/plugins/conditional-widgets/cets_conditional_widgets.php:57
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/conditional-widgets/update.php:9
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_filter() in wp-content/plugins/conditional-widgets/logic.php:9

User-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
No browser errors were detected

Optimizations

Plugin configuration 90% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file uses markdown syntax to describe your plugin to the world
These attributes need to be fixed:
  • Screenshots: Please add an image for screenshot #1 (Each widget gets an expandable form at the bottom of it for controlling display options on the home page and for both pages and categories.)
The official readme.txt is a good inspiration

conditional-widgets/cets_conditional_widgets.php 85% from 13 tests

Analyzing the main PHP file in "Conditional Widgets" version 3.1
It is important to fix the following:
  • Main file name: Name the main plugin file the same as the plugin slug ("conditional-widgets.php" instead of "cets_conditional_widgets.php")
  • Domain Path: The domain path is invalid: folder "/languages" does not exist

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | An overview of files in this plugin; executable files are not allowed
Success! There were no dangerous files found in this plugin792 lines of code in 8 files:
LanguageFilesBlank linesComment linesLines of code
PHP7214223697
CSS10195

PHP code Passed 2 tests

Analyzing cyclomatic complexity and code structure
This plugin has no cyclomatic complexity problems
Cyclomatic complexity
Average complexity per logical line of code0.47
Average class complexity1.00
▷ Minimum class complexity1.00
▷ Maximum class complexity1.00
Average method complexity1.00
▷ Minimum method complexity1.00
▷ Maximum method complexity1.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes2
▷ Abstract classes00.00%
▷ Concrete classes2100.00%
▷ Final classes00.00%
Methods10
▷ Static methods00.00%
▷ Public methods10100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions15
▷ Named functions15100.00%
▷ Anonymous functions00.00%
Constants0
▷ Global constants00.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
2 PNG files occupy 0.03MB with 0.01MB in potential savings
Potential savings
Compression of 2 random PNG files using pngquant
FileSize - originalSize - compressedSavings
.assets/screenshot-1.png14.67KB7.02KB▼ 52.16%
screenshot-1.png14.67KB7.02KB▼ 52.16%