73% better-buttons

Code Review | Amazon Affiliate Buttons - Better Buttons

WordPress plugin Amazon Affiliate Buttons - Better Buttons scored73%from 54 tests.

About plugin

  • Plugin page: better-buttons
  • Plugin version: 1.0
  • PHP compatiblity: 5.0+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.0-4.9.4
  • WordPress version: 6.3.1
  • First release: Feb 21, 2018
  • Latest release: Apr 2, 2019
  • Number of updates: 10
  • Update frequency: every 40.5 days
  • Top authors: thomasadam (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /1,223 total downloads

Benchmarks

Plugin footprint 65% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | All plugins must install correctly, without throwing any errors, warnings, or notices
The plugin installed successfully, without throwing any errors or notices

Server metrics [RAM: ▲0.05MB] [CPU: ▼10.75ms] Passed 4 tests

This is a short check of server-side resources used by Amazon Affiliate Buttons - Better Buttons
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /3.53 ▲0.0739.38 ▲0.11
Dashboard /wp-admin3.36 ▲0.0244.40 ▼15.22
Posts /wp-admin/edit.php3.41 ▲0.0642.90 ▼15.84
Add New Post /wp-admin/post-new.php5.94 ▲0.0682.70 ▼12.04
Media Library /wp-admin/upload.php3.29 ▲0.0636.03 ▲3.42
Better Buttons Settings /wp-admin/options-general.php?page=betterbuttons3.2529.95

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

A short overview of filesystem and database impact
This plugin installed successfully
Filesystem: 26 new files
Database: 1 new table, 6 new options
New tables
wp_betterbuttons
New WordPress options
db_upgraded
widget_recent-posts
widget_recent-comments
theysaidso_admin_options
widget_theysaidso_widget
can_compress_scripts

Browser metrics Passed 4 tests

A check of browser resources used by Amazon Affiliate Buttons - Better Buttons
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,837 ▲10214.78 ▲0.482.02 ▲0.4537.28 ▼1.70
Dashboard /wp-admin2,213 ▲255.90 ▲1.0395.39 ▼10.6540.95 ▼1.23
Posts /wp-admin/edit.php2,093 ▲42.02 ▼0.0233.26 ▼3.9534.24 ▲1.84
Add New Post /wp-admin/post-new.php1,526 ▲15523.22 ▲6.42648.85 ▲54.9162.44 ▲13.94
Media Library /wp-admin/upload.php1,392 ▲44.19 ▼0.0293.33 ▼21.1942.67 ▼7.48
Better Buttons Settings /wp-admin/options-general.php?page=betterbuttons9202.0432.3328.15

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
Please fix the following items
  • The plugin did not uninstall successfully, leaving 1 table in the database
    • wp_betterbuttons
  • This plugin did not uninstall successfully, leaving 6 options in the database
    • theysaidso_admin_options
    • widget_recent-posts
    • db_upgraded
    • can_compress_scripts
    • widget_recent-comments
    • widget_theysaidso_widget

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the server (in the Apache logs)
Even though everything seems fine, this is not an exhaustive test

SRP 50% from 2 tests

🔹 Tests weight: 20 | SRP (Single-Responsibility Principle) - PHP files must act as libraries and never output text or perform any action when accessed directly in a browser
The following issues need your attention
  • 3× GET requests to PHP files trigger server-side errors or Error 500 responses:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/better-buttons/betterbuttons-settings.php:5
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_shortcode() in wp-content/plugins/better-buttons/betterbuttons-shortcodes.php:69
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_dir_path() in wp-content/plugins/better-buttons/betterbuttons.php:11

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
There were no browser issues found

Optimizations

Plugin configuration 90% from 29 tests

readme.txt 88% from 16 tests

The readme.txt file describes your plugin functionality and requirements and it is parsed to prepare the your plugin's listing
Please fix the following attributes:
  • Screenshots: No descriptions were found for these screenshots #1, #2, #3 in better-buttons/assets to your readme.txt
  • Donate link: Invalid url: "paypal.me/t0mad4m"
The official readme.txt is a good inspiration

better-buttons/betterbuttons.php 92% from 13 tests

The main PHP script in "Amazon Affiliate Buttons - Better Buttons" version 1.0 is automatically included on every request by WordPress
You should first fix the following items:
  • Main file name: Name the main plugin file the same as the plugin slug ("better-buttons.php" instead of "betterbuttons.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is a short overview of programming languages used in this plugin, detecting executable files
No dangerous file extensions were detected5,470 lines of code in 10 files:
LanguageFilesBlank linesComment linesLines of code
SVG30122,829
CSS3898192,014
HTML1470362
PHP35047265

PHP code Passed 2 tests

This plugin's cyclomatic complexity and code structure detailed below
No complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.29
Average class complexity0.00
▷ Minimum class complexity0.00
▷ Maximum class complexity0.00
Average method complexity0.00
▷ Minimum method complexity0.00
▷ Maximum method complexity0.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes0
▷ Abstract classes00.00%
▷ Concrete classes00.00%
▷ Final classes00.00%
Methods0
▷ Static methods00.00%
▷ Public methods00.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions12
▷ Named functions1083.33%
▷ Anonymous functions216.67%
Constants0
▷ Global constants00.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

PNG files should be compressed to save space and minimize bandwidth usage
3 PNG files occupy 0.10MB with 0.06MB in potential savings
Potential savings
Compression of 3 random PNG files using pngquant
FileSize - originalSize - compressedSavings
includes/imgs/short-code_example1.PNG29.17KB14.40KB▼ 50.64%
includes/imgs/settings-page.PNG24.60KB12.31KB▼ 49.98%
includes/imgs/short-code_example2.PNG48.97KB15.54KB▼ 68.28%