83% buy-this-book

Code Review | Buy This Book

WordPress plugin Buy This Book scored83%from 54 tests.

About plugin

  • Plugin page: buy-this-book
  • Plugin version: 1.4
  • PHP version: 7.4.16
  • WordPress compatibility: 3.0-4.1
  • WordPress version: 6.3.1
  • First release: Oct 7, 2012
  • Latest release: Jul 5, 2016
  • Number of updates: 25
  • Update frequency: every 54.7 days
  • Top authors: raynfall (100%)

Code review

54 tests

User reviews

2 reviews

Install metrics

100+ active /6,886 total downloads


Plugin footprint 83% from 16 tests

Installer Passed 1 test

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

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

A check of server-side resources used by Buy This Book
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /3.51 ▲0.0536.94 ▼3.32
Dashboard /wp-admin3.36 ▲0.0544.80 ▼4.90
Posts /wp-admin/edit.php3.41 ▲0.0548.93 ▼0.28
Add New Post /wp-admin/post-new.php5.94 ▲0.0588.54 ▼12.82
Media Library /wp-admin/upload.php3.28 ▲0.0535.11 ▼0.46

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

A short overview of filesystem and database impact
This plugin installed successfully
Filesystem: 14 new files
Database: no new tables, 7 new options
New WordPress options

Browser metrics Passed 4 tests

A check of browser resources used by Buy This Book
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,908 ▲17313.97 ▼0.395.85 ▲4.0646.02 ▲5.11
Dashboard /wp-admin2,206 ▲184.81 ▼0.11109.25 ▲7.9241.34 ▼3.66
Posts /wp-admin/edit.php2,089 ▼01.99 ▼0.0642.94 ▼2.2835.36 ▼3.57
Add New Post /wp-admin/post-new.php1,514 ▼1917.45 ▼5.79622.56 ▼66.3159.91 ▲1.47
Media Library /wp-admin/upload.php1,379 ▼64.16 ▼0.0399.63 ▼3.5242.13 ▲1.56

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

🔸 Tests weight: 35 | It is important to correctly uninstall your plugin, without leaving any traces
It is recommended to fix the following
  • This plugin did not uninstall successfully, leaving 7 options in the database
    • widget_recent-comments
    • widget_buy_book
    • theysaidso_admin_options
    • widget_theysaidso_widget
    • widget_recent-posts
    • db_upgraded
    • can_compress_scripts

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 no errors were found, this is by no means 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
  • 1× PHP files trigger server errors when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Class 'WP_Widget' not found in wp-content/plugins/buy-this-book/buy-this-book.php:36

User-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
There were no browser issues found


Plugin configuration 90% from 29 tests

readme.txt 88% from 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
These attributes need to be fixed:
  • Tags: Please delete some tags, you are using 11 tag instead of maximum 10
  • Screenshots: These screenshots require images: #1 (Screenshot Buy This Book - Widget), #2 (Screenshot Buy This Book - Front end)
You can look at the official readme.txt

buy-this-book/buy-this-book.php 92% from 13 tests

This is the main PHP file of "Buy This Book" version 1.4, providing information about the plugin in the header fields and serving as the principal entry point to the plugin's functions
You should first fix the following items:
  • Description: Please don't use more than 140 characters for the plugin description (currently 447 characters long)

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 detected181 lines of code in 4 files:
LanguageFilesBlank linesComment linesLines of code

PHP code Passed 2 tests

Analyzing cyclomatic complexity and code structure
No cyclomatic complexity issues were detected for this plugin
Cyclomatic complexity
Average complexity per logical line of code0.28
Average class complexity27.00
▷ Minimum class complexity27.00
▷ Maximum class complexity27.00
Average method complexity7.50
▷ Minimum method complexity1.00
▷ Maximum method complexity15.00
Code structure
▷ Abstract classes00.00%
▷ Concrete classes1100.00%
▷ Final classes00.00%
▷ Static methods00.00%
▷ Public methods4100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
▷ Named functions3100.00%
▷ Anonymous functions00.00%
▷ Global constants00.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
7 PNG files occupy 0.02MB with 0.01MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
icons/iBooks.png2.26KB1.85KB▼ 18.09%
icons/Amazon.png4.28KB1.54KB▼ 64.10%
icons/Barnes and Noble.png4.42KB1.75KB▼ 60.42%
icons/Createspace.png2.01KB1.64KB▼ 18.34%