62% random-banner

Code Review | Random Banner

WordPress plugin Random Banner scored62%from 54 tests.

About plugin

  • Plugin page: random-banner
  • Plugin version: 4.2.3
  • PHP version: 7.4.16
  • WordPress compatibility: 5.3-6.4.1
  • WordPress version: 6.3.1
  • First release: Jan 25, 2014
  • Latest release: Nov 18, 2023
  • Number of updates: 125
  • Update frequency: every 28.7 days
  • Top authors: vinoth06 (100%)

Code review

54 tests

User reviews

53 reviews

Install metrics

2,000+ active /101,679 total downloads

Benchmarks

Plugin footprint 65% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
The plugin installed gracefully, with no errors

Server metrics [RAM: ▲0.54MB] [CPU: ▲0.37ms] Passed 4 tests

Server-side resources used by Random Banner
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /4.03 ▲0.5739.04 ▼0.16
Dashboard /wp-admin3.87 ▲0.5646.57 ▼0.96
Posts /wp-admin/edit.php3.92 ▲0.5653.15 ▲8.51
Add New Post /wp-admin/post-new.php6.41 ▲0.5286.00 ▼1.20
Media Library /wp-admin/upload.php3.73 ▲0.5036.89 ▲3.81
Support /wp-admin/admin.php?page=bc_random_banner_support3.7342.53
Campaign (pro) /wp-admin/admin.php?page=bc_random_banner_campaign3.7337.95
Random Banner /wp-admin/admin.php?page=bc_random_banner3.7338.93
Settings /wp-admin/admin.php?page=bc_random_banner_option3.7337.43
Statistics (pro) /wp-admin/admin.php?page=bc_random_banner_statistics3.7337.98

Server storage [IO: ▲1.86MB] [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: 54 new files
Database: 3 new tables, 9 new options
New tables
wp_bc_random_banner_options
wp_bc_random_banner_category
wp_bc_random_banner
New WordPress options
widget_recent-posts
can_compress_scripts
bc_random_banner_db_version
db_upgraded
bc_rb_payment_info
theysaidso_admin_options
widget_recent-comments
widget_theysaidso_widget
widget_random_banner_widget

Browser metrics Passed 4 tests

A check of browser resources used by Random Banner
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,963 ▲17613.86 ▼0.498.74 ▲6.6537.62 ▼5.94
Dashboard /wp-admin2,252 ▲755.69 ▲0.0695.06 ▼6.5639.49 ▼4.87
Posts /wp-admin/edit.php2,174 ▲742.06 ▲0.1041.19 ▲4.8137.42 ▲4.19
Add New Post /wp-admin/post-new.php6,277 ▲4,75126.24 ▲3.57910.47 ▲256.9055.94 ▼1.18
Media Library /wp-admin/upload.php1,451 ▲544.23 ▲0.0397.63 ▼5.1240.16 ▼2.86
Support /wp-admin/admin.php?page=bc_random_banner_support1,3663.5650.2082.41
Campaign (pro) /wp-admin/admin.php?page=bc_random_banner_campaign1,0483.5743.6260.34
Random Banner /wp-admin/admin.php?page=bc_random_banner1,1603.5641.6576.88
Settings /wp-admin/admin.php?page=bc_random_banner_option3,0903.6447.5467.04
Statistics (pro) /wp-admin/admin.php?page=bc_random_banner_statistics1,0743.6340.5866.11

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

🔸 Tests weight: 35 | The uninstall procedure must remove all plugin files and extra database tables
These items require your attention
  • Zombie tables detected upon uninstall: 3 tables
    • wp_bc_random_banner_options
    • wp_bc_random_banner_category
    • wp_bc_random_banner
  • This plugin does not fully uninstall, leaving 9 options in the database
    • widget_recent-comments
    • widget_recent-posts
    • widget_random_banner_widget
    • widget_theysaidso_widget
    • can_compress_scripts
    • db_upgraded
    • bc_rb_payment_info
    • bc_random_banner_db_version
    • theysaidso_admin_options

Smoke tests 25% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
Even though no errors were found, this is by no means an exhaustive test

SRP 0% from 2 tests

🔹 Tests weight: 20 | SRP (Single-Responsibility Principle) - PHP files must act as libraries and never output text or perform any action when accessed directly in a browser
Almost there! Just fix the following items
  • 7× GET requests to PHP files return non-empty strings:
    • > /wp-content/plugins/random-banner/include/models/constant.php
    • > /wp-content/plugins/random-banner/include/ajax/request.php
    • > /wp-content/plugins/random-banner/include/function/function.php
    • > /wp-content/plugins/random-banner/include/controller/populate-content.php
    • > /wp-content/plugins/random-banner/include/validation/random-banner.php
    • > /wp-content/plugins/random-banner/include/controller/save-update-delete.php
    • > /wp-content/plugins/random-banner/include/models/model.php
  • 8× GET requests to PHP files have triggered server-side errors or warnings:
    • > PHP Fatal error
      require_once(): Failed opening required 'BC_RB_PLUGIN_DIR/install-uninstall.php' (include_path='.:/usr/share/php') in wp-content/plugins/random-banner/bc-rb-load.php on line 5
    • > PHP Fatal error
      Uncaught Error: Class 'WP_Widget' not found in wp-content/plugins/random-banner/include/widget/random-banner-widget.php:11
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/random-banner/include/update/upgrade.php:8
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/random-banner/include/view/admin-setting.php:7
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/random-banner/install-uninstall.php:40
    • > PHP Warning
      Use of undefined constant BC_RB_PLUGIN_DIR - assumed 'BC_RB_PLUGIN_DIR' (this will throw an Error in a future version of PHP) in wp-content/plugins/random-banner/bc-rb-load.php on line 5
    • > PHP Warning
      require_once(BC_RB_PLUGIN_DIR/install-uninstall.php): failed to open stream: No such file or directory in wp-content/plugins/random-banner/bc-rb-load.php on line 5
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_basename() in wp-content/plugins/random-banner/random-banner.php:40

User-side errors 0% from 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
Please fix the following browser errors
    • > GET request to /wp-admin/admin.php?page=bc_random_banner_option
    • > Rendering (warning) in unknown
    /wp-admin/admin.php?page=bc_random_banner_option 398 The specified value "" does not conform to the required format. The format is "#rrggbb" where rr, gg, bb are two-digit hexadecimal numbers.
    • > GET request to /wp-admin/admin.php?page=bc_random_banner_option
    • > Rendering (warning) in unknown
    /wp-admin/admin.php?page=bc_random_banner_option 436 The specified value "" does not conform to the required format. The format is "#rrggbb" where rr, gg, bb are two-digit hexadecimal numbers.

Optimizations

Plugin configuration 97% from 29 tests

readme.txt 94% from 16 tests

Perhaps the most important file in your plugin readme.txt gets parsed in order to generate the public listing of your plugin
Please fix the following attributes:
  • Tags: Too many tags (20 tag instead of maximum 10); only the first 5 tags are used in your directory listing
The official readme.txt might help

random-banner/random-banner.php Passed 13 tests

"Random Banner" version 4.2.3's main PHP file describes plugin functionality and also serves as the entry point to any WordPress functionality
132 characters long description:
Random Banner WordPress plugin provides users with high level of flexibility to show image banner and script ads randomly on Widgets

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 plugin26,885 lines of code in 32 files:
LanguageFilesBlank linesComment linesLines of code
CSS92,45811313,863
JavaScript62,0649389,286
PHP153588743,260
SVG100288
PO File18191188

PHP code Passed 2 tests

This is a very shot review of cyclomatic complexity and code structure
All good! No complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.27
Average class complexity26.00
▷ Minimum class complexity26.00
▷ Maximum class complexity26.00
Average method complexity7.25
▷ Minimum method complexity1.00
▷ Maximum method complexity12.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes1
▷ Abstract classes00.00%
▷ Concrete classes1100.00%
▷ Final classes00.00%
Methods4
▷ Static methods00.00%
▷ Public methods4100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions133
▷ Named functions133100.00%
▷ Anonymous functions00.00%
Constants8
▷ Global constants8100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
10 PNG files occupy 0.06MB with 0.01MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/images/chat.png1.34KB1.09KB▼ 19.17%
assets/images/paypal.png21.61KB7.46KB▼ 65.46%
assets/images/tickets.png2.82KB2.56KB▼ 9.32%
assets/images/rate.png1.91KB1.66KB▼ 13.43%
assets/images/file_upload.png0.31KB0.37KB0.00%