77% hashbar-wp-notification-bar

Code Review | HashBar - WordPress Notification Bar

WordPress plugin HashBar - WordPress Notification Bar scored77%from 54 tests.

About plugin

  • Plugin page: hashbar-wp-notifi...
  • Plugin version: 1.4.3
  • PHP version: 7.4.16
  • WordPress compatibility: 5.0-6.3
  • WordPress version: 6.3.1
  • First release: Jan 8, 2018
  • Latest release: Oct 16, 2023
  • Number of updates: 101
  • Update frequency: every 20.9 days
  • Top authors: devitemsllc (100%)

Code review

54 tests

User reviews

19 reviews

Install metrics

9,000+ active /207,824 total downloads

Benchmarks

Plugin footprint 82% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
This plugin's installer ran successfully

Server metrics [RAM: ▲1.22MB] [CPU: ▲1.69ms] 50% from 4 tests

A check of server-side resources used by HashBar - WordPress Notification Bar
Please fix the following
  • RAM: You should keep total memory usage under 10MB (currently 10.79MB on /wp-admin/edit.php?post_type=wphash_ntf_bar&page=recommendations)
  • CPU: Total CPU usage must kept under 500.00ms (currently 1,867.09ms on /wp-admin/edit.php?post_type=wphash_ntf_bar&page=recommendations)
PageMemory (MB)CPU Time (ms)
Home /5.01 ▲1.5057.79 ▲17.30
Dashboard /wp-admin4.56 ▲1.1759.75 ▼7.58
Posts /wp-admin/edit.php4.61 ▲1.2161.34 ▲10.66
Add New Post /wp-admin/post-new.php7.22 ▲1.2999.30 ▼10.93
Media Library /wp-admin/upload.php4.48 ▲1.2152.36 ▲14.59
Recommendations /wp-admin/edit.php?post_type=wphash_ntf_bar&page=recommendations10.791,867.09
Add New Notification /wp-admin/post-new.php?post_type=wphash_ntf_bar9.16109.87
All Notifications /wp-admin/edit.php?post_type=wphash_ntf_bar6.9168.21
Settings /wp-admin/edit.php?post_type=wphash_ntf_bar&page=hashbar_options_page6.8458.07

Server storage [IO: ▲2.44MB] [DB: ▲0.70MB] Passed 3 tests

A short overview of filesystem and database impact
The plugin installed successfully
Filesystem: 194 new files
Database: 1 new table, 9 new options
New tables
wp_hthb_analytics
New WordPress options
hashbar_1st_upgrade_completed
widget_theysaidso_widget
db_upgraded
hthb_analyticstbl_exist
theysaidso_admin_options
hashbar_143
widget_recent-comments
can_compress_scripts
widget_recent-posts

Browser metrics Passed 4 tests

An overview of browser requirements for HashBar - WordPress Notification Bar
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,121 ▲37513.42 ▼0.8112.90 ▲10.9643.22 ▼1.35
Dashboard /wp-admin2,304 ▲1305.64 ▼0.0389.57 ▼3.0740.40 ▲3.28
Posts /wp-admin/edit.php2,203 ▲1032.00 ▲0.0239.96 ▲4.6535.66 ▼2.48
Add New Post /wp-admin/post-new.php1,626 ▲9123.05 ▲4.68656.56 ▲21.5563.84 ▼7.84
Media Library /wp-admin/upload.php1,509 ▲1064.20 ▲0.1095.15 ▼9.7343.81 ▼0.82
Recommendations /wp-admin/edit.php?post_type=wphash_ntf_bar&page=recommendations3,2104.1369.48112.28
Add New Notification /wp-admin/post-new.php?post_type=wphash_ntf_bar8,27520.94945.5570.03
All Notifications /wp-admin/edit.php?post_type=wphash_ntf_bar1,4154.1466.4828.57
Settings /wp-admin/edit.php?post_type=wphash_ntf_bar&page=hashbar_options_page1,2583.8547.8025.82

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

🔸 Tests weight: 35 | It is important to correctly uninstall your plugin, without leaving any traces
You still need to fix the following
  • The uninstall procedure has failed, leaving 8 options in the database
    • hashbar_143
    • can_compress_scripts
    • db_upgraded
    • theysaidso_admin_options
    • widget_recent-posts
    • hashbar_1st_upgrade_completed
    • widget_recent-comments
    • widget_theysaidso_widget

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no server-side errors were triggered
Even though everything seems fine, this is not 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
Please fix the following items
  • 6× PHP files trigger errors when accessed directly with GET requests:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugins_url() in wp-content/plugins/hashbar-wp-notification-bar/init.php:16
    • > PHP Fatal error
      Uncaught Error: Call to undefined function Hashbarfree\\Analytics\\add_action() in wp-content/plugins/hashbar-wp-notification-bar/inc/analytical-store.php:30
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/hashbar-wp-notification-bar/inc/custom-posts.php:58
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/hashbar-wp-notification-bar/inc/metabox.php:2
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/hashbar-wp-notification-bar/admin/plugin-options.php:2
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_filter() in wp-content/plugins/hashbar-wp-notification-bar/inc/shortcode.php:4

User-side errors 0% from 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
Please fix the following user-side errors
    • > GET request to /wp-admin/post-new.php?post_type=wphash_ntf_bar
    • > Console-api (warning) in wp-includes/js/dist/blocks.min.js?ver=b5d3b99262dfb659bd26+9:22180
    Block validation: Expected attribute `%s` of value `%s`, saw `%s`." "style" "width:250px;background-color:#FB3555;background-image:url(undefined);background-position:center;background-repeat:no-repeat;background-size:cover;border-radius:6px" "background-color:#FB3555;background-image:url(undefined);background-position:center;background-repeat:no-repeat;background-size:cover;border-radius:6px
    • > GET request to /wp-admin/post-new.php?post_type=wphash_ntf_bar
    • > Console-api (severe) in wp-includes/js/dist/blocks.min.js?ver=b5d3b99262dfb659bd26+9:22180
    Block validation: Block validation failed for `%s` (%o).\n\nContent generated by `save` function:\n\n%s\n\nContent retrieved from post body:\n\n%s" "hashbar/hashbar-promo-banner" Object "\u003Cdiv class=\"wp-block-hashbar-hashbar-promo-banner ht-promo-banner\" style=\"width:250px;background-color:#FB3555;background-image:url(undefined);background-position:center;background-repeat:no-repeat;background-size:cover;border-radius:6px\">\u003Cdiv class=\"ht-content\">\u003Ch4 class=\"promo-title\" style=\"font-size:22px;color:#fff\">Add Promo Title\u003C/h4>\u003Cp class=\"promo-summery\" style=\"font-size:17px;color:#fff\">Add Promo Content\u003C/p>\u003C/div>\u003Cdiv class=\"ht-promo-button\">\u003Ca href=\"#\" style=\"background-color:#fff;color:#1D1E22\">Button\u003C/a>\u003C/div>\u003C/div>" "\u003Cdiv class=\"wp-block-hashbar-hashbar-promo-banner ht-promo-banner\" style=\"background-color:#FB3555;background-image:url(undefined);background-position:center;background-repeat:no-repeat;background-size:cover;border-radius:6px\">\u003Cdiv class=\"ht-content\">\u003Ch4 class=\"promo-title\" style=\"font-size:22px;color:#fff\">Add Promo Title\u003C/h4>\u003Cp class=\"promo-summery\" style=\"font-size:17px;color:#fff\">Add Promo Content\u003C/p>\u003C/div>\u003Cdiv class=\"ht-promo-button\">\u003Ca href=\"#\" style=\"background-color:#fff;color:#1D1E22\">Button\u003C/a>\u003C/div>\u003C/div>

Optimizations

Plugin configuration 93% from 29 tests

readme.txt Passed 16 tests

The readme.txt file describes your plugin functionality and requirements and it is parsed to prepare the your plugin's listing
5 plugin tags: wordpress notification bar, notification bar, notification, offer bar, promotion bar

hashbar-wp-notification-bar/init.php 85% from 13 tests

Analyzing the main PHP file in "HashBar - WordPress Notification Bar" version 1.4.3
The following require your attention:
  • Main file name: It is recommended to name the main PHP file as the plugin slug ("hashbar-wp-notification-bar.php" instead of "init.php")
  • 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

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | There should be no dangerous file extensions present in any WordPress plugin
Good job! No executable or dangerous file extensions detected26,578 lines of code in 152 files:
LanguageFilesBlank linesComment linesLines of code
PHP953,0441,25810,494
CSS124485225,579
Sass1592834,730
JavaScript171,4085224,622
SVG800794
JSON420354
XML1005

PHP code Passed 2 tests

Analyzing logical lines of code, cyclomatic complexity, and other code metrics
This plugin has no cyclomatic complexity issues
Cyclomatic complexity
Average complexity per logical line of code0.59
Average class complexity23.23
▷ Minimum class complexity1.00
▷ Maximum class complexity139.00
Average method complexity6.22
▷ Minimum method complexity1.00
▷ Maximum method complexity52.00
Code structure
Namespaces3
Interfaces0
Traits0
Classes69
▷ Abstract classes22.90%
▷ Concrete classes6797.10%
▷ Final classes00.00%
Methods294
▷ Static methods5318.03%
▷ Public methods29098.64%
▷ Protected methods10.34%
▷ Private methods31.02%
Functions67
▷ Named functions6597.01%
▷ Anonymous functions22.99%
Constants9
▷ Global constants9100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

It is recommended to compress PNG files in your plugin to minimize bandwidth usage
34 PNG files occupy 0.23MB with 0.06MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
admin/img/click-icons-bg.png1.29KB1.31KB0.00%
admin/img/views-icons-bg.png1.20KB1.23KB0.00%
admin/img/hashbar-1.png5.62KB5.83KB0.00%
inc/recomendation/assets/images/extensions/ht-slider-addons-pro.png6.41KB4.35KB▼ 32.23%
(invalid) inc/recomendation/assets/images/extensions/was-this-helpful.png1.21KB0.00KB▼ 100.00%