74% toffeepress

Code Review | ToffeePress

WordPress plugin ToffeePress scored74%from 54 tests.

About plugin

  • Plugin page: toffeepress
  • Plugin version: 0.10.0
  • PHP compatiblity: 7.0+
  • PHP version: 7.4.16
  • WordPress compatibility: 5.0-5.3.2
  • WordPress version: 6.3.1
  • First release: Nov 27, 2019
  • Latest release: Dec 23, 2019
  • Number of updates: 12
  • Update frequency: every 2.3 days
  • Top authors: danrwalker (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /603 total downloads

Benchmarks

Plugin footprint 65% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
The plugin installed successfully, without throwing any errors or notices

Server metrics [RAM: ▼1.55MB] [CPU: ▼50.82ms] Passed 4 tests

Server-side resources used by ToffeePress
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /3.62 ▲0.1636.46 ▼4.52
Dashboard /wp-admin2.40 ▼0.916.55 ▼39.62
Posts /wp-admin/edit.php2.40 ▼0.967.35 ▼38.38
Add New Post /wp-admin/post-new.php2.40 ▼3.496.74 ▼95.84
Media Library /wp-admin/upload.php2.40 ▼0.835.97 ▼29.43
Cleaning /wp-admin/admin.php?page=toffeepress/cleanup2.407.76
Settings /wp-admin/admin.php?page=toffeepress/settings2.406.82
Compressing /wp-admin/admin.php?page=toffeepress/compress2.406.75
Restoring /wp-admin/admin.php?page=toffeepress/restore2.406.19
Overview /wp-admin/admin.php?page=toffeepress2.406.56

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

How much does this plugin use your filesystem and database?
No storage issues were detected
Filesystem: 9 new files
Database: no new tables, 9 new options
New WordPress options
toffeepress_quality
toffeepress_api_key
can_compress_scripts
db_upgraded
widget_theysaidso_widget
toffeepress_keep_originals
widget_recent-comments
theysaidso_admin_options
widget_recent-posts

Browser metrics Passed 4 tests

An overview of browser requirements for ToffeePress
This plugin has a minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,826 ▲8013.25 ▼0.951.64 ▼0.3441.46 ▼2.55
Dashboard /wp-admin2,229 ▲415.80 ▼0.0193.79 ▼12.8974.72 ▲37.01
Posts /wp-admin/edit.php2,112 ▲232.01 ▲0.0435.18 ▼0.9932.22 ▼3.86
Add New Post /wp-admin/post-new.php1,691 ▲17222.01 ▼1.31715.07 ▲27.1455.45 ▼0.18
Media Library /wp-admin/upload.php1,411 ▲264.13 ▼0.0795.98 ▼5.7868.83 ▲20.32
Cleaning /wp-admin/admin.php?page=toffeepress/cleanup6831.146.4013.04
Settings /wp-admin/admin.php?page=toffeepress/settings1,0712.0724.5431.70
Compressing /wp-admin/admin.php?page=toffeepress/compress6921.537.5322.16
Restoring /wp-admin/admin.php?page=toffeepress/restore6871.146.8018.47
Overview /wp-admin/admin.php?page=toffeepress9492.0724.2141.22

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
The following items require your attention
  • The plugin did not uninstall gracefully
    • > User notice in wp-includes/functions.php+5905
    Function wp_register_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 toffeepress-style handle. Please see Debugging in WordPress for more information. (This message was added in version 3.3.0.)
  • Zombie WordPress options detected upon uninstall: 9 options
    • can_compress_scripts
    • widget_recent-posts
    • theysaidso_admin_options
    • db_upgraded
    • toffeepress_keep_originals
    • widget_recent-comments
    • widget_theysaidso_widget
    • toffeepress_api_key
    • toffeepress_quality

Smoke tests 75% 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
  • 5 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=toffeepress
    • > User notice in wp-includes/functions.php+5905
    Function wp_register_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 toffeepress-style handle. Please see Debugging in WordPress for more information. (This message was added in version 3.3.0.)
  • 5 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=toffeepress
    • > 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 toffeepress-style handle. Please see Debugging in WordPress for more information. (This message was added in version 3.3.0.)
  • 5 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=toffeepress
    • > User notice in wp-includes/functions.php+5905
    Function wp_register_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 toffeepress-script handle. Please see Debugging in WordPress for more information. (This message was added in version 3.3.0.)
  • 5 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=toffeepress
    • > User notice in wp-includes/functions.php+5905
    Function wp_enqueue_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 toffeepress-script handle. Please see Debugging in WordPress for more information. (This message was added in version 3.3.0.)
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=toffeepress
    • > Notice in wp-content/plugins/toffeepress/toffeepress.php+196
    Undefined index: results
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=toffeepress
    • > Notice in wp-content/plugins/toffeepress/toffeepress.php+196
    Trying to access array offset on value of type null
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=toffeepress
    • > Notice in wp-content/plugins/toffeepress/toffeepress.php+196
    Undefined index: ping
  • 3 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=toffeepress
    • > Warning in wp-content/plugins/toffeepress/toffeepress.php+158
    Division by zero

SRP Passed 2 tests

🔹 Tests weight: 20 | A shallow check of the single-responsibility principle; PHP files should perform no action - including output of placeholder text - and trigger no errors when accessed directly
The SRP test was a success

User-side errors Passed 1 test

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

Optimizations

Plugin configuration 96% from 29 tests

readme.txt Passed 16 tests

Often overlooked, readme.txt is one of the most important files in your plugin
9 plugin tags: optimise, media, images, compress, compression...

toffeepress/toffeepress.php 92% from 13 tests

The main PHP script in "ToffeePress" version 0.10.0 is automatically included on every request by WordPress
It is important to fix the following:
  • Description: Keep the plugin description shorter than 140 characters (currently 146 characters long)

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
No dangerous file extensions were detected2,774 lines of code in 3 files:
LanguageFilesBlank linesComment linesLines of code
CSS14311,713
PHP120863874
JavaScript1422187

PHP code Passed 2 tests

This plugin's cyclomatic complexity and code structure detailed below
This plugin has no cyclomatic complexity problems
Cyclomatic complexity
Average complexity per logical line of code0.39
Average class complexity125.00
▷ Minimum class complexity125.00
▷ Maximum class complexity125.00
Average method complexity5.77
▷ Minimum method complexity1.00
▷ Maximum method complexity19.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes1
▷ Abstract classes00.00%
▷ Concrete classes1100.00%
▷ Final classes00.00%
Methods26
▷ Static methods00.00%
▷ Public methods2492.31%
▷ Protected methods27.69%
▷ Private methods00.00%
Functions0
▷ Named functions00.00%
▷ Anonymous functions00.00%
Constants0
▷ 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
4 PNG files occupy 0.09MB with 0.04MB in potential savings
Potential savings
Compression of 4 random PNG files using pngquant
FileSize - originalSize - compressedSavings
images/tp-logo-square.png56.30KB23.10KB▼ 58.98%
images/twistphp.png2.23KB1.11KB▼ 50.15%
images/tp-logo.png32.57KB13.29KB▼ 59.18%
images/menu-icon.png0.87KB0.70KB▼ 19.78%