10% book-previewer

Code Review | Book Previewer

WordPress plugin Book Previewer scored 10% from 54 tests.

About plugin

  • Plugin page: book-previewer
  • Plugin version: 1.0.6
  • PHP compatiblity: 5.6+
  • PHP version: 7.4.16
  • WordPress compatibility: 3.6-5.3
  • WordPress version: 6.3.1
  • First release: Sep 3, 2014
  • Latest release: Jan 26, 2020
  • Number of updates: 38
  • Update frequency: every 51.9 days
  • Top authors: jhanbackjr (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active / 2,647 total downloads

Benchmarks

Plugin footprint 40% from 16 tests

Installer 0% from 1 test

🔺 Critical test (weight: 50) | All plugins must install correctly, without throwing any errors, warnings, or notices
These installer errors require your attention
  • The plugin did not install without errors
    • > Deprecated in wp-content/plugins/book-previewer/jhbpclasses.php+746
    Function create_function() is deprecated

Server metrics [RAM: ▼1.63MB] [CPU: ▼51.69ms] Passed 4 tests

A check of server-side resources used by Book Previewer
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /2.36 ▼1.105.50 ▼33.22
Dashboard /wp-admin2.38 ▼0.927.51 ▼47.06
Posts /wp-admin/edit.php2.38 ▼0.977.55 ▼38.43
Add New Post /wp-admin/post-new.php2.38 ▼3.516.88 ▼88.06
Media Library /wp-admin/upload.php2.38 ▼0.857.56 ▼26.62
Usage /wp-admin/admin.php?page=bookpreviewer-usages2.387.75
Book Previewer /wp-admin/options-general.php?page=bookpreviewer-options2.387.40

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

Filesystem and database footprint
No storage issues were detected
Filesystem: 12 new files
Database: no new tables, 8 new options
New WordPress options
widget_recent-posts
can_compress_scripts
widget_recent-comments
widget_theysaidso_widget
bookpreviewer-clearcache
theysaidso_admin_options
db_upgraded
widget_jhbp_widget

Browser metrics Passed 4 tests

A check of browser resources used by Book Previewer
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,968 ▲23314.14 ▼0.2512.46 ▲10.9236.72 ▼9.49
Dashboard /wp-admin2,210 ▲224.88 ▼1.03110.80 ▼36.0244.69 ▼11.22
Posts /wp-admin/edit.php2,093 ▲42.02 ▲0.0135.29 ▼6.2031.40 ▼4.89
Add New Post /wp-admin/post-new.php1,668 ▲15418.75 ▲1.04589.32 ▼32.8153.71 ▲7.28
Media Library /wp-admin/upload.php1,395 ▲104.18 ▲0.0097.57 ▲0.8843.87 ▲1.03
Usage /wp-admin/admin.php?page=bookpreviewer-usages8952.0224.6932.96
Book Previewer /wp-admin/options-general.php?page=bookpreviewer-options1,0892.0327.4226.16

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

🔸 Tests weight: 35 | The uninstall procedure must remove all plugin files and extra database tables
The following items require your attention
  • This plugin did not uninstall without warnings or errors
    • > Deprecated in wp-content/plugins/book-previewer/jhbpclasses.php+746
    Function create_function() is deprecated
  • This plugin does not fully uninstall, leaving 7 options in the database
    • theysaidso_admin_options
    • db_upgraded
    • widget_jhbp_widget
    • widget_theysaidso_widget
    • widget_recent-posts
    • widget_recent-comments
    • can_compress_scripts

Smoke tests 50% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | A shallow check that no server-side errors were triggered
Smoke test failed, please fix the following
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/options-general.php?page=bookpreviewer-options
    • > Deprecated in wp-content/plugins/book-previewer/jhbpclasses.php+746
    Function create_function() is deprecated

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
Please fix the following items
  • 5× PHP files output non-empty strings when accessed directly via GET requests:
    • > /wp-content/plugins/book-previewer/index.php
    • > /wp-content/plugins/book-previewer/jhbpclasses.php
    • > /wp-content/plugins/book-previewer/lang/index.php
    • > /wp-content/plugins/book-previewer/js/index.php
    • > /wp-content/plugins/book-previewer/book-previewer.php

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
Everything seems fine on the user side

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 94% 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
Attributes that need to be fixed:
  • Screenshots: These screenshots do not have images: #1 (The Book Previewer Settings page), #2 (The shortcode in a post), #3 (The plugin in action as a popup button)
You can look at the official readme.txt

book-previewer/book-previewer.php 92% from 13 tests

The primary PHP file in "Book Previewer" version 1.0.6 is used by WordPress to initiate all plugin functionality
Please take the time to fix the following:
  • Text Domain: The text domain must be the same as the plugin slug, although optional since WordPress version 4.6

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | Executable files are not allowed as they can serve as attack vectors
Everything looks great! No dangerous files found in this plugin916 lines of code in 6 files:
LanguageFilesBlank linesComment linesLines of code
PHP510291885
JavaScript182431

PHP code Passed 2 tests

A short review of cyclomatic complexity and code structure
No complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.29
Average class complexity44.00
▷ Minimum class complexity33.00
▷ Maximum class complexity55.00
Average method complexity2.54
▷ Minimum method complexity1.00
▷ Maximum method complexity17.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes2
▷ Abstract classes00.00%
▷ Concrete classes2100.00%
▷ Final classes00.00%
Methods56
▷ Static methods00.00%
▷ Public methods4682.14%
▷ Protected methods00.00%
▷ Private methods1017.86%
Functions0
▷ Named functions00.00%
▷ Anonymous functions00.00%
Constants0
▷ Global constants00.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size 50% from 2 tests

Image compression 50% from 2 tests

Using a strong compression for your PNG files is a great way to speed-up your plugin
3 PNG files occupy 0.63MB with 0.29MB in potential savings
Potential savings
Compression of 3 random PNG files using pngquant
FileSize - originalSize - compressedSavings
screenshot-3.png389.48KB178.57KB▼ 54.15%
screenshot-2.png131.73KB74.82KB▼ 43.21%
screenshot-1.png127.95KB78.89KB▼ 38.35%