56% book-press

Code Review | BookPress - For Book Authors

WordPress plugin BookPress - For Book Authors scored56%from 54 tests.

About plugin

  • Plugin page: book-press
  • Plugin version: 1.2.4
  • PHP version: 7.4.16
  • WordPress version: 6.3.1
  • First release: Dec 23, 2018
  • Latest release: May 22, 2023
  • Number of updates: 69
  • Update frequency: every 24.2 days
  • Top authors: blackandwhitedigital (85.51%)iqasim (13.04%)bdkabiruddin (4.35%)

Code review

54 tests

User reviews

5 reviews

Install metrics

200+ active /14,052 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.70MB] [CPU: ▲31.05ms] 50% from 4 tests

Server-side resources used by BookPress - For Book Authors
The following require your attention
  • CPU: You should keep total CPU usage under 500.00ms (currently 1,902.96ms on /wp-admin/admin.php?page=book-press-setting)
  • Extra RAM: Try to keep extra memory usage under 5MB (currently 5.70MB on /wp-admin/admin.php?page=freemius)
PageMemory (MB)CPU Time (ms)
Home /9.22 ▲5.7664.89 ▲28.60
Dashboard /wp-admin9.24 ▲5.9474.57 ▲27.09
Posts /wp-admin/edit.php9.24 ▲5.8883.10 ▲40.52
Add New Post /wp-admin/post-new.php11.11 ▲5.221,129.79 ▲1,044.43
Media Library /wp-admin/upload.php9.26 ▲6.0365.62 ▲27.98
Add New /wp-admin/post-new.php?post_type=book9.26566.41
All Books /wp-admin/edit.php?post_type=book9.2692.79
Account Settings /wp-admin/admin.php?page=book-press-setting9.261,902.96
Genres /wp-admin/edit-tags.php?taxonomy=genre&post_type=book9.2679.31
Freemius Debug [v.2.5.8] /wp-admin/admin.php?page=freemius9.2660.09

Server storage [IO: ▲4.41MB] [DB: ▲0.02MB] Passed 3 tests

Filesystem and database footprint
The plugin installed successfully
Filesystem: 217 new files
Database: no new tables, 12 new options
New WordPress options
fs_active_plugins
genre_children
initialized_genres
fs_debug_mode
theysaidso_admin_options
widget_book_press_widget
widget_recent-comments
fs_accounts
widget_recent-posts
widget_theysaidso_widget
...

Browser metrics Passed 4 tests

A check of browser resources used by BookPress - For Book Authors
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,293 ▲53217.25 ▲2.9158.79 ▲57.0632.44 ▼10.53
Dashboard /wp-admin2,271 ▲945.81 ▲0.1494.23 ▼7.4540.89 ▼21.49
Posts /wp-admin/edit.php2,158 ▲582.31 ▲0.3341.75 ▲6.7538.55 ▲1.26
Add New Post /wp-admin/post-new.php1,418 ▼10817.16 ▼5.95578.87 ▼86.3829.33 ▼29.58
Media Library /wp-admin/upload.php1,474 ▲744.27 ▲0.2091.01 ▼24.8247.31 ▼0.54
Add New /wp-admin/post-new.php?post_type=book4,4554.7198.1946.66
All Books /wp-admin/edit.php?post_type=book3,2232.4138.7932.97
Account Settings /wp-admin/admin.php?page=book-press-setting1,0382.1127.5158.46
Genres /wp-admin/edit-tags.php?taxonomy=genre&post_type=book2,8782.1732.9342.59
Freemius Debug [v.2.5.8] /wp-admin/admin.php?page=freemius1,1281.9829.6427.63

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

🔸 Tests weight: 35 | It is important to correctly uninstall your plugin, without leaving any traces
Please fix the following items
  • This plugin did not uninstall without warnings or errors
    • > Notice in wp-content/plugins/book-press/freemius/includes/class-freemius.php+8486
    Undefined property: stdClass::$plugins
  • Zombie WordPress options were found after uninstall: 13 options
    • widget_theysaidso_widget
    • widget_recent-comments
    • fs_accounts
    • widget_book_press_widget
    • my_plugin_do_activation_redirect
    • fs_debug_mode
    • widget_recent-posts
    • fs_active_plugins
    • initialized_genres
    • genre_children
    • ...

Smoke tests 0% 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
    • > GET request to /wp-admin/post-new.php?post_type=book
    • > Notice in wp-content/plugins/book-press/admin/class-book-press-admin.php+1427
    Undefined variable: navigation_color

SRP 0% from 2 tests

🔹 Tests weight: 20 | It is important to ensure that your PHP files perform no action when accessed directly, respecting the single-responsibility principle
Please fix the following
  • 2× PHP files output text when accessed directly:
    • > /wp-content/plugins/book-press/admin/partials/book-press-admin-display.php
    • > /wp-content/plugins/book-press/public/partials/book-press-public-display.php
  • 5× PHP files trigger errors when accessed directly with GET requests:
    • > PHP Fatal error
      Uncaught Error: Class 'WP_Widget' not found in wp-content/plugins/book-press/includes/class-book-press-widget.php:7
    • > PHP Fatal error
      Uncaught Error: Call to undefined function language_attributes() in wp-content/plugins/book-press/public/book-single-js-old.php:10
    • > PHP Fatal error
      Uncaught Error: Call to undefined function language_attributes() in wp-content/plugins/book-press/public/book-single.php:11
    • > PHP Fatal error
      Uncaught Error: Class 'WP_Widget' not found in wp-content/plugins/book-press/includes/class-book-press-pro-widget.php:7
    • > PHP Fatal error
      Uncaught Error: Call to undefined function language_attributes() in wp-content/plugins/book-press/public/book-single-old.php:10

User-side errors 0% from 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the browser (console and network errors and warnings)
Please fix the following user-side errors
  • 5 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=freemius
    • > Javascript (severe) in unknown
    /wp-content/plugins/book-press/admin/js/book-press-admin.js?ver=1.2.4 35:38 Uncaught TypeError: $(...).dialog is not a function

Optimizations

Plugin configuration 97% 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
Please fix the following attributes:
  • Requires at least: The plugin version is formatted incorrectly
The official readme.txt might help

book-press/book-press.php Passed 13 tests

The primary PHP file in "BookPress - For Book Authors" version 1.2.4 is used by WordPress to initiate all plugin functionality
71 characters long description:
Tools for authors to write and display their books easily on WordPress.

Code Analysis 97% from 3 tests

File types Passed 1 test

🔸 Test weight: 35 | There should be no dangerous file extensions present in any WordPress plugin
Everything looks great! No dangerous files found in this plugin47,136 lines of code in 168 files:
LanguageFilesBlank linesComment linesLines of code
PHP1348,50717,96537,233
JavaScript101,6681,0868,062
PO File75205561,140
CSS168420487
Markdown1680214

PHP code 50% from 2 tests

This is a short overview of cyclomatic complexity and code structure for this plugin
Please tend to the following items
  • Please reduce cyclomatic complexity of classes to less than 1000 (currently 3,079)
Cyclomatic complexity
Average complexity per logical line of code0.62
Average class complexity87.40
▷ Minimum class complexity1.00
▷ Maximum class complexity3,079.00
Average method complexity4.70
▷ Minimum method complexity1.00
▷ Maximum method complexity94.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes57
▷ Abstract classes23.51%
▷ Concrete classes5596.49%
▷ Final classes00.00%
Methods1,356
▷ Static methods19914.68%
▷ Public methods96270.94%
▷ Protected methods171.25%
▷ Private methods37727.80%
Functions101
▷ Named functions10099.01%
▷ Anonymous functions10.99%
Constants147
▷ Global constants10068.03%
▷ Class constants4731.97%
▷ 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
3 PNG files occupy 0.03MB with 0.02MB in potential savings
Potential savings
Compression of 3 random PNG files using pngquant
FileSize - originalSize - compressedSavings
freemius/assets/img/book-press.png12.77KB4.63KB▼ 63.71%
freemius/assets/img/plugin-icon.png9.16KB5.26KB▼ 42.58%
freemius/assets/img/theme-icon.png10.97KB5.78KB▼ 47.37%