67% better-sharing

Code Review | Better Sharing

WordPress plugin Better Sharing scored67%from 54 tests.

About plugin

  • Plugin page: better-sharing
  • Plugin version: 2.3.1
  • PHP compatiblity: 7.0+
  • PHP version: 7.4.16
  • WordPress compatibility: 5.0.0-6.4
  • WordPress version: 6.3.1
  • First release: Feb 19, 2021
  • Latest release: Nov 16, 2023
  • Number of updates: 94
  • Update frequency: every 11.0 days
  • Top authors: CloudSponge (97.87%)easilyamused (3.19%)

Code review

54 tests

User reviews

6 reviews

Install metrics

30+ active /2,550 total downloads

Benchmarks

Plugin footprint 64% from 16 tests

Installer Passed 1 test

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

Server metrics [RAM: ▲5.14MB] [CPU: ▲29.22ms] 50% from 4 tests

A check of server-side resources used by Better Sharing
Please take the time to fix the following items
  • CPU: Total CPU usage should be kept under 500.00ms (currently 1,678.06ms on /wp-admin/admin.php?page=better-sharing-general)
  • Extra RAM: The extra memory usage should kept under 5MB (currently 5.14MB on /wp-admin/admin.php?page=better-sharing-general)
PageMemory (MB)CPU Time (ms)
Home /8.89 ▲5.4269.10 ▲33.68
Dashboard /wp-admin8.91 ▲5.6080.88 ▲35.65
Posts /wp-admin/edit.php8.91 ▲5.5588.08 ▲40.24
Add New Post /wp-admin/post-new.php9.86 ▲3.97103.64 ▲7.29
Media Library /wp-admin/upload.php8.91 ▲5.6874.87 ▲43.34
Settings /wp-admin/admin.php?page=bswp-plugin-settings8.9167.74
Integrations /wp-admin/admin.php?page=better-sharing-addons8.9167.88
Email Templates /wp-admin/edit.php?post_type=bswp_email_template8.9167.71
UI Templates /wp-admin/edit.php?post_type=bswp_ui_template8.9168.28
Freemius Debug [v.2.5.10] /wp-admin/admin.php?page=freemius8.9163.17
Get Started /wp-admin/admin.php?page=better-sharing-general8.911,678.06

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

Analyzing filesystem and database footprints of this plugin
This plugin was installed successfully
Filesystem: 258 new files
Database: no new tables, 9 new options
New WordPress options
widget_recent-comments
widget_recent-posts
fs_active_plugins
db_upgraded
widget_theysaidso_widget
theysaidso_admin_options
can_compress_scripts
fs_debug_mode
fs_accounts

Browser metrics Passed 4 tests

An overview of browser requirements for Better Sharing
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,213 ▲45124.63 ▲10.3545.63 ▲43.8532.48 ▼10.75
Dashboard /wp-admin2,408 ▲23110.97 ▲5.31135.63 ▲37.2447.67 ▲3.86
Posts /wp-admin/edit.php2,317 ▲2149.82 ▲7.7993.21 ▲51.9445.32 ▲12.10
Add New Post /wp-admin/post-new.php1,540 ▲1421.59 ▼1.72555.86 ▼69.6438.60 ▼10.90
Media Library /wp-admin/upload.php1,634 ▲23412.49 ▲8.30135.50 ▲28.3944.62 ▲1.60
Settings /wp-admin/admin.php?page=bswp-plugin-settings1,2149.4785.2735.35
Integrations /wp-admin/admin.php?page=better-sharing-addons1,0929.5178.2334.24
Email Templates /wp-admin/edit.php?post_type=bswp_email_template1,3199.7385.6235.15
UI Templates /wp-admin/edit.php?post_type=bswp_ui_template1,2719.7884.7834.78
Freemius Debug [v.2.5.10] /wp-admin/admin.php?page=freemius1,2729.4983.6030.53
Get Started /wp-admin/admin.php?page=better-sharing-general1,2529.4773.1658.86

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
The following items require your attention
  • The plugin did not uninstall gracefully
    • > Notice in wp-content/plugins/better-sharing/vendor/freemius/wordpress-sdk/includes/class-freemius.php+8486
    Undefined property: stdClass::$plugins
  • This plugin did not uninstall successfully, leaving 9 options in the database
    • can_compress_scripts
    • widget_recent-posts
    • fs_active_plugins
    • theysaidso_admin_options
    • fs_accounts
    • db_upgraded
    • widget_theysaidso_widget
    • fs_debug_mode
    • widget_recent-comments

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for server-side errors
The smoke test was a success, however most plugin functionality was not tested

SRP 0% 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
  • 2× PHP files output text when accessed directly:
    • > /wp-content/plugins/better-sharing/includes/AdminScreens/admin-templates/ui-template/modules-container.php
    • > /wp-content/plugins/better-sharing/includes/templates/bswp-modules-container.php
  • 79× GET requests to PHP files trigger server-side errors or Error 500 responses (only 10 are shown):
    • > PHP Warning
      include(): Failed opening 'BETTER_SHARING_ADMIN_TEMPLATE_PATHui-template/template-parts/social-share-module.php' for inclusion (include_path='.:/usr/share/php') in wp-content/plugins/better-sharing/includes/AdminScreens/admin-templates/ui-template/modules-container.php on line 9
    • > PHP Fatal error
      Uncaught Error: Class 'BetterSharingWP\\AddOnsCore' not found in wp-content/plugins/better-sharing/includes/AdminScreens/admin-templates/addons-page.php:13
    • > PHP Warning
      Use of undefined constant BETTER_SHARING_ADMIN_TEMPLATE_PATH - assumed 'BETTER_SHARING_ADMIN_TEMPLATE_PATH' (this will throw an Error in a future version of PHP) in wp-content/plugins/better-sharing/includes/AdminScreens/admin-templates/ui-template/modules-container.php on line 9
    • > PHP Warning
      Use of undefined constant BETTER_SHARING_PATH - assumed 'BETTER_SHARING_PATH' (this will throw an Error in a future version of PHP) in wp-content/plugins/better-sharing/includes/templates/bswp-modules-container.php on line 10
    • > PHP Notice
      Undefined variable: is_full_view_hidden in wp-content/plugins/better-sharing/includes/AdminScreens/admin-templates/ui-template/template-parts/view-style/ui-template-full.php on line 1
    • > PHP Warning
      Use of undefined constant BETTER_SHARING_PATH - assumed 'BETTER_SHARING_PATH' (this will throw an Error in a future version of PHP) in wp-content/plugins/better-sharing/includes/AdminScreens/admin-templates/plugin-settings/email-sending.php on line 5
    • > PHP Warning
      Use of undefined constant BETTER_SHARING_ADMIN_TEMPLATE_PATH - assumed 'BETTER_SHARING_ADMIN_TEMPLATE_PATH' (this will throw an Error in a future version of PHP) in wp-content/plugins/better-sharing/includes/AdminScreens/admin-templates/ui-template/modules-container.php on line 10
    • > PHP Warning
      Use of undefined constant BETTER_SHARING_PATH - assumed 'BETTER_SHARING_PATH' (this will throw an Error in a future version of PHP) in wp-content/plugins/better-sharing/includes/templates/bswp-modules-container.php on line 8
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_attr() in wp-content/plugins/better-sharing/includes/AdminScreens/admin-templates/ui-template/template-parts/email-module.php:18
    • > PHP Notice
      Undefined variable: default_settings in wp-content/plugins/better-sharing/includes/AdminScreens/admin-templates/ui-template/template-parts/ui-template-modules/social_share.php on line 5

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)
No browser errors were detected

Optimizations

Plugin configuration 93% from 29 tests

readme.txt Passed 16 tests

Don't ignore readme.txt as it is the file that instructs WordPress.org on how to present your plugin to the world
4 plugin tags: sharing, contact picker, cloudsponge, woocommerce

better-sharing/BetterSharingWP.php 85% from 13 tests

The main PHP script in "Better Sharing" version 2.3.1 is automatically included on every request by WordPress
The following require your attention:
  • Main file name: Please rename the main PHP file in this plugin to the plugin slug ("better-sharing.php" instead of "BetterSharingWP.php")
  • Text Domain: The text domain must be the same as the plugin slug, although optional since WordPress version 4.6

Code Analysis 97% from 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short check of programming languages and file extensions; no executable files are allowed
Good job! No executable or dangerous file extensions detected40,894 lines of code in 210 files:
LanguageFilesBlank linesComment linesLines of code
PHP1739,39019,07938,003
Sass418901,309
JavaScript141953031,159
Markdown2890248
HTML18178
JSON10052
SVG20032
CSS130013

PHP code 50% from 2 tests

Analyzing cyclomatic complexity and code structure
It is recommended to fix the following
  • Please reduce cyclomatic complexity of classes to less than 1000 (currently 3,073)
Cyclomatic complexity
Average complexity per logical line of code0.59
Average class complexity71.62
▷ Minimum class complexity1.00
▷ Maximum class complexity3,073.00
Average method complexity4.36
▷ Minimum method complexity1.00
▷ Maximum method complexity94.00
Code structure
Namespaces9
Interfaces0
Traits0
Classes68
▷ Abstract classes34.41%
▷ Concrete classes6595.59%
▷ Final classes00.00%
Methods1,454
▷ Static methods21915.06%
▷ Public methods1,05072.21%
▷ Protected methods181.24%
▷ Private methods38626.55%
Functions108
▷ Named functions9991.67%
▷ Anonymous functions98.33%
Constants149
▷ Global constants10268.46%
▷ Class constants4731.54%
▷ Public constants47100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
2 PNG files occupy 0.02MB with 0.01MB in potential savings
Potential savings
Compression of 2 random PNG files using pngquant
FileSize - originalSize - compressedSavings
vendor/freemius/wordpress-sdk/assets/img/theme-icon.png10.97KB5.78KB▼ 47.37%
vendor/freemius/wordpress-sdk/assets/img/plugin-icon.png9.16KB5.26KB▼ 42.58%