72% sponsor-banners

Code Review | Plugin Sponsor Banner

WordPress plugin Plugin Sponsor Banner scored72%from 54 tests.

About plugin

  • Plugin page: sponsor-banners
  • Plugin version: 1.0.0
  • PHP version: 7.4.16
  • WordPress compatibility: 3.0.1-4.6
  • WordPress version: 6.3.1
  • First release: Oct 5, 2016
  • Latest release: Oct 5, 2016
  • Number of updates: 18
  • Update frequency: every 0.8 days
  • Top authors: mbrughi (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /747 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | It is important to correctly install your plugin, without throwing errors or notices
Installer ran successfully

Server metrics [RAM: ▲0.57MB] [CPU: ▲4.37ms] Passed 4 tests

Analyzing server-side resources used by Plugin Sponsor Banner
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /4.00 ▲0.5446.90 ▲6.03
Dashboard /wp-admin3.89 ▲0.5956.01 ▲6.25
Posts /wp-admin/edit.php3.92 ▲0.5653.46 ▲2.95
Add New Post /wp-admin/post-new.php6.49 ▲0.60109.39 ▲2.24
Media Library /wp-admin/upload.php3.82 ▲0.5942.19 ▲10.14
Add new item /wp-admin/post-new.php?post_type=sponsor4.1046.78
All Sponsor /wp-admin/edit.php?post_type=sponsor3.8639.92
Categories /wp-admin/edit-tags.php?taxonomy=categoriesponsor&post_type=sponsor3.8135.00

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

A short overview of filesystem and database impact
No storage issues were detected
Filesystem: 371 new files
Database: no new tables, 8 new options
New WordPress options
widget_recent-comments
widget_recent-posts
can_compress_scripts
recovery_mode_email_last_sent
db_upgraded
theysaidso_admin_options
widget_sponsor_widget
widget_theysaidso_widget

Browser metrics Passed 4 tests

Plugin Sponsor Banner: an overview of browser usage
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,932 ▲19714.08 ▼0.244.74 ▲3.0939.23 ▼7.57
Dashboard /wp-admin2,252 ▲644.96 ▲0.02110.14 ▼6.8640.43 ▼8.03
Posts /wp-admin/edit.php2,138 ▲492.08 ▲0.0440.95 ▼2.7136.99 ▲0.21
Add New Post /wp-admin/post-new.php1,551 ▲1823.23 ▲0.06657.19 ▲64.4254.17 ▲8.99
Media Library /wp-admin/upload.php1,434 ▲524.29 ▼0.01114.17 ▲19.1247.45 ▲5.33
Add new item /wp-admin/post-new.php?post_type=sponsor1,3871.536.9326.80
All Sponsor /wp-admin/edit.php?post_type=sponsor1,1132.0035.1128.17
Categories /wp-admin/edit-tags.php?taxonomy=categoriesponsor&post_type=sponsor1,3072.2326.5423.86

Uninstaller [IO: ▲0.00MB] [DB: ▲0.00MB] 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 8 options in the database
    • widget_recent-posts
    • db_upgraded
    • theysaidso_admin_options
    • widget_recent-comments
    • widget_theysaidso_widget
    • recovery_mode_email_last_sent
    • can_compress_scripts
    • widget_sponsor_widget

Smoke tests 25% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | A shallow check that no server-side errors were triggered
These server-side errors were triggered
    • > GET request to /wp-admin/post-new.php?post_type=sponsor
    • > Compile error in wp-content/plugins/sponsor-banners/includes/cmb2/includes/types/CMB2_Type_File.php+15
    Declaration of CMB2_Type_File::render() must be compatible with CMB2_Type_Text::render($args = Array)

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
Please fix the following
  • 3× PHP files perform the task of outputting text when accessed with GET requests:
    • > /wp-content/plugins/sponsor-banners/admin/partials/sponsor-admin-display.php
    • > /wp-content/plugins/sponsor-banners/includes/class-sponsor-widget.php
    • > /wp-content/plugins/sponsor-banners/public/partials/sponsor-public-display.php
  • 33× GET requests to PHP files trigger server-side errors or Error 500 responses (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Class 'CMB2_Type_Picker_Base' not found in wp-content/plugins/sponsor-banners/includes/cmb2/includes/types/CMB2_Type_Text_Datetime_Timestamp.php:13
    • > PHP Fatal error
      Uncaught Error: Class 'CMB2_Type_Base' not found in wp-content/plugins/sponsor-banners/includes/cmb2/includes/types/CMB2_Type_Title.php:13
    • > PHP Fatal error
      Uncaught Error: Class 'CMB2_Base' not found in wp-content/plugins/sponsor-banners/includes/cmb2/includes/CMB2.php:17
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/sponsor-banners/includes/cmb2/example-functions.php:105
    • > PHP Fatal error
      Uncaught Error: Class 'CMB2_Type_Text' not found in wp-content/plugins/sponsor-banners/includes/cmb2/includes/types/CMB2_Type_Checkbox.php:13
    • > PHP Fatal error
      Uncaught Error: Class 'CMB2_Type_Text_Date' not found in wp-content/plugins/sponsor-banners/includes/cmb2/includes/types/CMB2_Type_Text_Time.php:13
    • > PHP Fatal error
      Uncaught Error: Class 'CMB2_Type_File_Base' not found in wp-content/plugins/sponsor-banners/includes/cmb2/includes/types/CMB2_Type_File.php:13
    • > PHP Fatal error
      Uncaught Error: Class 'CMB2_Type_Base' not found in wp-content/plugins/sponsor-banners/includes/cmb2/includes/types/CMB2_Type_Text.php:13
    • > PHP Fatal error
      Uncaught Error: Class 'CMB2_Base' not found in wp-content/plugins/sponsor-banners/includes/cmb2/includes/CMB2_Field.php:17
    • > PHP Fatal error
      Uncaught Error: Class 'CMB2_Type_File_Base' not found in wp-content/plugins/sponsor-banners/includes/cmb2/includes/types/CMB2_Type_File_List.php:13

User-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the browser (console and network errors and warnings)
Everything seems fine, but this is not an exhaustive test

Optimizations

Plugin configuration 90% from 29 tests

readme.txt 94% from 16 tests

You should put a lot of thought into formatting readme.txt as it is used by WordPress.org to prepare the public listing of your plugin
Attributes that require attention:
  • Screenshots: Please add descriptions for these screenshots #2, #3 in sponsor-banners/assets to your readme.txt
The official readme.txt is a good inspiration

sponsor-banners/sponsor.php 85% from 13 tests

The main PHP script in "Plugin Sponsor Banner" version 1.0.0 is automatically included on every request by WordPress
You should first fix the following items:
  • Text Domain: If you choose to specify the text domain, it must be the same as the plugin slug; optional since WordPress version 4.6
  • Main file name: It is recommended to name the main PHP file as the plugin slug ("sponsor-banners.php" instead of "sponsor.php")

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
Good job! No executable or dangerous file extensions detected43,379 lines of code in 217 files:
LanguageFilesBlank linesComment linesLines of code
PO File12113,77417,85631,513
PHP591,5203,9635,040
CSS141,0021,0424,406
Sass13238251,149
JavaScript6225296842
Markdown41560429

PHP code Passed 2 tests

An overview of cyclomatic complexity and code structure
There were no cyclomatic complexity issued detected
Cyclomatic complexity
Average complexity per logical line of code0.46
Average class complexity13.14
▷ Minimum class complexity1.00
▷ Maximum class complexity144.00
Average method complexity3.30
▷ Minimum method complexity1.00
▷ Maximum method complexity26.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes66
▷ Abstract classes69.09%
▷ Concrete classes6090.91%
▷ Final classes00.00%
Methods350
▷ Static methods4613.14%
▷ Public methods29985.43%
▷ Protected methods4312.29%
▷ Private methods82.29%
Functions37
▷ Named functions3697.30%
▷ Anonymous functions12.70%
Constants5
▷ Global constants360.00%
▷ Class constants240.00%
▷ Public constants2100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

It is recommended to compress PNG files in your plugin to minimize bandwidth usage
14 compressed PNG files occupy 0.02MB
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
includes/cmb2/images/ui-bg_glass_75_dadada_1x400.png0.11KB0.16KB0.00%
includes/cmb2/images/ui-icons_cd0a0a_256x240.png4.27KB4.11KB▼ 3.78%
includes/cmb2/images/ui-icons_454545_256x240.png4.27KB4.11KB▼ 3.78%
includes/cmb2/images/ui-bg_highlight-soft_75_cccccc_1x100.png0.10KB0.17KB0.00%
includes/cmb2/images/ico-delete.png0.70KB0.72KB0.00%