10% leadsquared-website-topbar

Code Review | LeadSquared Website Topbar

WordPress plugin LeadSquared Website Topbar scored10%from 54 tests.

About plugin

  • Plugin page: leadsquared-websi...
  • Plugin version: 1.5
  • PHP version: 7.4.16
  • WordPress compatibility: 3.0-3.8
  • WordPress version: 6.3.1
  • First release: Nov 13, 2013
  • Latest release: Apr 11, 2014
  • Number of updates: 20
  • Update frequency: every 7.5 days
  • Top authors: leadsquared (100%)

Code review

54 tests

User reviews

3 reviews

Install metrics

10+ active /1,777 total downloads

Benchmarks

Plugin footprint 40% from 16 tests

Installer 0% from 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
Please fix the following installer errors
  • The plugin did not install without errors
    • > Warning in wp-content/plugins/leadsquared-website-topbar/index.php+155
    Use of undefined constant leadsquared_home_page - assumed 'leadsquared_home_page' (this will throw an Error in a future version of PHP)

Server metrics [RAM: ▼1.91MB] [CPU: ▼56.08ms] Passed 4 tests

An overview of server-side resources used by LeadSquared Website Topbar
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /2.08 ▼1.384.27 ▼38.13
Dashboard /wp-admin2.10 ▼1.215.57 ▼46.76
Posts /wp-admin/edit.php2.10 ▼1.266.20 ▼45.11
Add New Post /wp-admin/post-new.php2.10 ▼3.797.45 ▼94.30
Media Library /wp-admin/upload.php2.10 ▼1.135.47 ▼27.52
/wp-admin/admin.php?page=leadsquared2.106.35
Website Topbar /wp-admin/admin.php?page=top_nav_html_page_slug2.107.47

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

How much does this plugin use your filesystem and database?
No storage issues were detected
Filesystem: 39 new files
Database: no new tables, 7 new options
New WordPress options
db_upgraded
can_compress_scripts
widget_recent-posts
widget_recent-comments
widget_theysaidso_widget
theysaidso_admin_options
leadsquared_all_fields

Browser metrics Passed 4 tests

LeadSquared Website Topbar: an overview of browser usage
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,938 ▲20314.43 ▲0.056.39 ▲4.6240.69 ▼4.78
Dashboard /wp-admin2,259 ▲705.88 ▲0.87116.50 ▼10.0281.06 ▲35.88
Posts /wp-admin/edit.php2,145 ▲532.82 ▲0.8344.57 ▲6.7435.64 ▲4.45
Add New Post /wp-admin/post-new.php1,555 ▲4123.68 ▲6.24692.20 ▲3.6340.50 ▼15.19
Media Library /wp-admin/upload.php1,432 ▲415.08 ▲0.85105.33 ▼1.3882.07 ▲34.67
/wp-admin/admin.php?page=leadsquared8592.1635.7531.96
Website Topbar /wp-admin/admin.php?page=top_nav_html_page_slug1,6732.3437.4848.76

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
Please fix the following items
  • This plugin cannot be uninstalled
    • > User notice in wp-includes/functions.php+5905
    Function wp_register_style was called incorrectly. Scripts and styles should not be registered or enqueued until the wp_enqueue_scripts, admin_enqueue_scripts, or login_enqueue_scripts hooks. This notice was triggered by the LeadSquared-home-style handle. Please see Debugging in WordPress for more information. (This message was added in version 3.3.0.)
  • This plugin did not uninstall successfully, leaving 6 options in the database
    • can_compress_scripts
    • theysaidso_admin_options
    • widget_theysaidso_widget
    • widget_recent-posts
    • widget_recent-comments
    • db_upgraded

Smoke tests 50% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
These errors were triggered by the plugin
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=top_nav_html_page_slug
    • > User notice in wp-includes/functions.php+5905
    Function wp_register_style was called incorrectly. Scripts and styles should not be registered or enqueued until the wp_enqueue_scripts, admin_enqueue_scripts, or login_enqueue_scripts hooks. This notice was triggered by the LeadSquared-home-style handle. Please see Debugging in WordPress for more information. (This message was added in version 3.3.0.)
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=top_nav_html_page_slug
    • > User notice in wp-includes/functions.php+5905
    Function wp_enqueue_style was called incorrectly. Scripts and styles should not be registered or enqueued until the wp_enqueue_scripts, admin_enqueue_scripts, or login_enqueue_scripts hooks. This notice was triggered by the LeadSquared-home-style handle. Please see Debugging in WordPress for more information. (This message was added in version 3.3.0.)
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=top_nav_html_page_slug
    • > Warning in wp-content/plugins/leadsquared-website-topbar/index.php+155
    Use of undefined constant leadsquared_home_page - assumed 'leadsquared_home_page' (this will throw an Error in a future version of PHP)
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=top_nav_html_page_slug
    • > Notice in wp-content/plugins/leadsquared-website-topbar/index.php+139
    Undefined variable: menuExist
    • > GET request to /wp-admin/admin.php?page=top_nav_html_page_slug
    • > Notice in wp-content/plugins/leadsquared-website-topbar/inc/top_nav_bar_admin_page_sttings.php+2
    Constant LS_PLUGIN_URL already defined
  • 17 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=top_nav_html_page_slug
    • > Notice in wp-content/plugins/leadsquared-website-topbar/inc/top_nav_bar_admin_page_sttings.php+50
    Trying to access array offset on value of type null
    • > GET request to /wp-admin/admin.php?page=top_nav_html_page_slug
    • > Notice in wp-content/plugins/leadsquared-website-topbar/inc/top_nav_bar_admin_page_sttings.php+60
    Undefined variable: message

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
Please fix the following items
  • 5× PHP files trigger server errors when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_dir_url() in wp-content/plugins/leadsquared-website-topbar/index.php:12
    • > PHP Fatal error
      Uncaught Error: Call to undefined function _e() in wp-content/plugins/leadsquared-website-topbar/inc/leadsquared-admin.php:5
    • > PHP Warning
      Use of undefined constant LS_PLUGIN_URL - assumed 'LS_PLUGIN_URL' (this will throw an Error in a future version of PHP) in wp-content/plugins/leadsquared-website-topbar/inc/leadsquared-admin.php on line 4
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_dir_url() in wp-content/plugins/leadsquared-website-topbar/inc/top_nav_bar_admin_page_sttings.php:2
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_option() in wp-content/plugins/leadsquared-website-topbar/inc/page_html.php:2

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
Everything seems fine on the user side

Optimizations

Plugin configuration 93% from 29 tests

readme.txt Passed 16 tests

The readme.txt file is an important file in your plugin as it is parsed by WordPress.org to prepare the public listing of your plugin
7 plugin tags: top bar, header bar, lead bar, cta, notification bar...

leadsquared-website-topbar/index.php 85% from 13 tests

The main PHP file in "LeadSquared Website Topbar" ver. 1.5 adds more information about the plugin and also serves as the entry point for this plugin
It is important to fix the following:
  • Description: Keep the plugin description shorter than 140 characters (currently 289 characters long)
  • Main file name: Even though not officially enforced, the main plugin file should be the same as the plugin slug ("leadsquared-website-topbar.php" instead of "index.php")

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
No dangerous file extensions were detected3,530 lines of code in 16 files:
LanguageFilesBlank linesComment linesLines of code
JavaScript64073672,763
PHP57518456
CSS4410302
HTML1309

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.88
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
Classes1
▷ Abstract classes00.00%
▷ Concrete classes1100.00%
▷ Final classes00.00%
Methods3
▷ Static methods3100.00%
▷ Public methods3100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions6
▷ Named functions6100.00%
▷ Anonymous functions00.00%
Constants4
▷ Global constants4100.00%
▷ Class constants00.00%
▷ Public constants00.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
17 PNG files occupy 0.03MB with 0.02MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
css/images/ui-bg_highlight-soft_15_cc0000_1x100.png0.31KB0.18KB▼ 43.48%
css/images/ui-bg_flat_65_ffffff_40x100.png0.20KB0.08KB▼ 58.17%
css/images/ui-bg_glass_55_fbf8ee_1x400.png0.33KB0.13KB▼ 60.29%
images/powered_byLS.png4.55KB2.32KB▼ 49.02%
css/images/ui-bg_highlight-hard_100_eeeeee_1x100.png0.25KB0.14KB▼ 43.65%