52% rich-web-share-button

Code Review | Share Buttons – Social Media

WordPress plugin Share Buttons – Social Media scored52%from 54 tests.

About plugin

  • Plugin page: rich-web-share-bu...
  • Plugin version: 1.0.2
  • PHP version: 7.4.16
  • WordPress compatibility: 4.2-4.8
  • WordPress version: 6.3.1
  • First release: May 6, 2017
  • Latest release: Oct 11, 2018
  • Number of updates: 9
  • Update frequency: every 58.1 days
  • Top authors: richteam (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /1,278 total downloads

Benchmarks

Plugin footprint 48% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
Installer ran successfully

Server metrics [RAM: ▼1.65MB] [CPU: ▼58.56ms] Passed 4 tests

A check of server-side resources used by Share Buttons – Social Media
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /2.34 ▼1.136.10 ▼39.83
Dashboard /wp-admin2.36 ▼0.957.67 ▼50.03
Posts /wp-admin/edit.php2.36 ▼1.008.30 ▼41.56
Add New Post /wp-admin/post-new.php2.36 ▼3.536.50 ▼102.82
Media Library /wp-admin/upload.php2.36 ▼0.877.65 ▼34.53
Our Products /wp-admin/admin.php?page=Our-products2.367.24

Server storage [IO: ▲1.43MB] [DB: ▲0.01MB] Passed 3 tests

Analyzing filesystem and database footprints of this plugin
No storage issues were detected
Filesystem: 121 new files
Database: 3 new tables, 7 new options
New tables
wp_rich_web_share_buttons_style_options
wp_rich_web_share_buttons_short_options
wp_rich_web_share_buttons_general_options
New WordPress options
widget_recent-posts
widget_theysaidso_widget
widget_recent-comments
db_upgraded
can_compress_scripts
theysaidso_admin_options
widget_wich-web-share-button-widget

Browser metrics Passed 4 tests

Checking browser requirements for Share Buttons – Social Media
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,854 ▲9313.33 ▼1.401.69 ▲0.0242.30 ▼1.77
Dashboard /wp-admin2,254 ▲775.80 ▲0.2693.31 ▼12.6176.90 ▲34.77
Posts /wp-admin/edit.php2,161 ▲642.35 ▲0.3639.09 ▲3.4235.42 ▼0.29
Add New Post /wp-admin/post-new.php1,573 ▲4723.48 ▲0.04772.94 ▲137.8639.80 ▼13.08
Media Library /wp-admin/upload.php1,459 ▲654.47 ▲0.05104.37 ▲3.0687.07 ▲42.17
Our Products /wp-admin/admin.php?page=Our-products1,0081.9234.4646.66
Share Buttons Manager /wp-admin/admin.php?page=Rich-Web Share Buttons Admin?Rich_Web_ShButtons_Nonce=19a31cbc92280.420.073.59

Uninstaller [IO: ▲0.00MB] [DB: ▲0.01MB] 25% 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
  • Uninstall procedure had uncaught errors
    • > User notice in wp-includes/functions.php+5905
    Function wp_localize_script 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 rich-web-buttons-scripts handle. Please see Debugging in WordPress for more information. (This message was added in version 3.3.0.)
  • Zombie tables were found after uninstall: 3 tables
    • wp_rich_web_share_buttons_style_options
    • wp_rich_web_share_buttons_general_options
    • wp_rich_web_share_buttons_short_options
  • This plugin did not uninstall successfully, leaving 7 options in the database
    • widget_recent-comments
    • widget_recent-posts
    • db_upgraded
    • widget_theysaidso_widget
    • can_compress_scripts
    • widget_wich-web-share-button-widget
    • theysaidso_admin_options

Smoke tests 25% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the server (in the Apache logs)
Smoke test failed, please fix the following
    • > GET request to /wp-admin/admin.php?page=Our-products
    • > User notice in wp-includes/functions.php+5905
    Function wp_localize_script 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 rich-web-buttons-scripts handle. Please see Debugging in WordPress for more information. (This message was added in version 3.3.0.)
    • > GET request to /wp-admin/admin.php?page=Our-products
    • > 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 rich-web-buttons-admin-style-icons handle. Please see Debugging in WordPress for more information. (This message was added in version 3.3.0.)
    • > GET request to /wp-admin/admin.php?page=Our-products
    • > Notice in wp-content/plugins/rich-web-share-button/Share-Buttons.php+24
    Undefined variable: bare_url
    • > GET request to /wp-admin/admin.php?page=Our-products
    • > Notice in wp-content/plugins/rich-web-share-button/Share-Buttons.php+24
    Undefined variable: comment_id

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
Almost there! Just fix the following items
  • 4× PHP files trigger server-side errors or warnings when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/rich-web-share-button/Rich-Web-Share-Button-Ajax.php:2
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/rich-web-share-button/Rich-Web-Share-Button-Ajax.php:2
    • > PHP Fatal error
      Uncaught Error: Class 'WP_Widget' not found in wp-content/plugins/rich-web-share-button/Rich-Web-SB-Widget.php:2
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_shortcode() in wp-content/plugins/rich-web-share-button/Rich-Web-SB-Shortcode.php:9

User-side errors 0% from 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
These are user-side errors you should fix
    • > GET request to /wp-admin/admin.php?page=Rich-Web Share Buttons Admin?Rich_Web_ShButtons_Nonce=19a31cbc92
    • > Network (severe)
    wp-admin/admin.php?page=Rich-Web%20Share%20Buttons%20Admin?Rich_Web_ShButtons_Nonce=19a31cbc92 - Failed to load resource: the server responded with a status of 403 (Forbidden)

Optimizations

Plugin configuration 90% from 29 tests

readme.txt 94% from 16 tests

It's important to format your readme.txt file correctly as it is parsed for the public listing of your plugin
Attributes that require attention:
  • Tags: Please reduce the number of tags, currently 11 tag instead of maximum 10
You can take inspiration from this readme.txt

rich-web-share-button/Share-Buttons.php 85% from 13 tests

"Share Buttons – Social Media" version 1.0.2's primary PHP file adds more information about the plugin and serves as the entry point for WordPress
It is important to fix the following:
  • Main file name: Please rename the main PHP file in this plugin to the plugin slug ("rich-web-share-button.php" instead of "Share-Buttons.php")
  • Description: If Twitter did it, so should we! Keep the description under 140 characters (currently 176 characters long)

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short review of files and their extensions; it is not recommended to include executable files
There were no executable files found in this plugin3,828 lines of code in 16 files:
LanguageFilesBlank linesComment linesLines of code
PHP948341,805
JavaScript3750861
SVG100685
CSS3381477

PHP code Passed 2 tests

Analyzing logical lines of code, cyclomatic complexity, and other code metrics
This plugin has no cyclomatic complexity problems
Cyclomatic complexity
Average complexity per logical line of code0.69
Average class complexity5.00
▷ Minimum class complexity5.00
▷ Maximum class complexity5.00
Average method complexity2.33
▷ Minimum method complexity1.00
▷ Maximum method complexity5.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes1
▷ Abstract classes00.00%
▷ Concrete classes1100.00%
▷ Final classes00.00%
Methods3
▷ Static methods00.00%
▷ Public methods3100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions13
▷ Named functions13100.00%
▷ Anonymous functions00.00%
Constants0
▷ Global constants00.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
99 compressed PNG files occupy 0.34MB
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
Images/icons/su_icon_2.png1.40KB1.31KB▼ 6.62%
Images/icons/digg_icon_3.png1.88KB1.51KB▼ 19.55%
Images/icons/pi_icon_8.png1.45KB1.20KB▼ 17.17%
Images/icons/vk_icon_4.png0.95KB0.79KB▼ 17.06%
Images/icons/tw_icon_3.png1.83KB1.56KB▼ 14.60%