84% add2fav

Code Review | Add to Favorites Plugin (Add2Fav)

WordPress plugin Add to Favorites Plugin (Add2Fav) scored 84% from 54 tests.

About plugin

  • Plugin page: add2fav
  • Plugin version: 1.0
  • PHP version: 7.4.16
  • WordPress compatibility: 3.3-3.5.1
  • WordPress version: 5.9.2
  • First release: May 15, 2013
  • Latest release: Jun 6, 2013
  • Number of updates: 7
  • Update frequency: every 3.3 days
  • Top authors: christiansalazarh (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active / 1,248 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
Install script ran successfully

Server metrics [RAM: ▲0.08MB] [CPU: ▼317.24ms] Passed 4 tests

This is a short check of server-side resources used by Add to Favorites Plugin (Add2Fav)
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /3.69 ▲0.1758.81 ▲0.54
Dashboard /wp-admin3.52 ▲0.1145.34 ▲6.81
Posts /wp-admin/edit.php3.74 ▲0.1041.22 ▼4.74
Add New Post /wp-admin/post-new.php6.98 ▲0.0199.20 ▼1,260.83
Media Library /wp-admin/upload.php3.40 ▲0.1027.17 ▼3.91
Add2Fav /wp-admin/options-general.php?page=add2fav_uid3.3729.07

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

Analyzing filesystem and database footprints of this plugin
There were no storage issued detected upon installing this plugin
Filesystem: 16 new files
Database: no new tables, 2 new options
New WordPress options
widget_add2favwidget
widget_add2fav_list_widget

Browser metrics Passed 4 tests

An overview of browser requirements for Add to Favorites Plugin (Add2Fav)
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,913 ▲17116.25 ▲0.6011.96 ▲5.812.51 ▲0.33
Dashboard /wp-admin2,893 ▲356.01 ▼0.01113.93 ▼18.78152.00 ▼11.60
Posts /wp-admin/edit.php2,696 ▲263.24 ▼0.0062.29 ▼2.38143.99 ▲11.16
Add New Post /wp-admin/post-new.php1,664 ▼4716.13 ▼5.01419.82 ▼5.50158.00 ▲9.39
Media Library /wp-admin/upload.php1,706 ▲85.53 ▲0.01136.78 ▲1.49193.60 ▲11.22
Add2Fav /wp-admin/options-general.php?page=add2fav_uid1,0822.3751.61115.29

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

🔸 Tests weight: 35 | Verifying that this plugin uninstalls completely without leaving any traces
It is recommended to fix the following
  • Zombie WordPress options were found after uninstall: 2 options
    • widget_add2favwidget
    • widget_add2fav_list_widget

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a short smoke test looking for server-side errors
Good news, no errors were detected

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
Almost there! Just fix the following items
  • 4× PHP files trigger errors when accessed directly with GET requests:
    • > PHP Fatal error
      Uncaught Error: Class 'WP_Widget' not found in wp-content/plugins/add2fav/WPP_Widget.php:63
    • > PHP Fatal error
      Uncaught Error: Class 'WP_Widget' not found in wp-content/plugins/add2fav/WPP_Widget.php:63
    • > PHP Fatal error
      Uncaught Error: Class 'WP_Widget' not found in wp-content/plugins/add2fav/WPP_Widget.php:63
    • > PHP Fatal error
      Uncaught Error: Class 'WP_Widget' not found in wp-content/plugins/add2fav/WPP_Widget.php:63

User-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the browser (console and network errors and warnings)
Everything seems fine, but this is not an exhaustive test

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file describes your plugin functionality and requirements and it is parsed to prepare the your plugin's listing
Attributes that require attention:
  • Screenshots: Add images for these screenshots: #1 (Add to Favorites Widget), #2 (My Favorites Widget)
The official readme.txt is a good inspiration

add2fav/Add2favPlugin.php 92% from 13 tests

The main file in "Add to Favorites Plugin (Add2Fav)" v. 1.0 serves as a complement to information provided in readme.txt and as the entry point to the plugin
Please make the necessary changes and fix the following:
  • Main file name: Even though not officially enforced, the main plugin file should be the same as the plugin slug ("add2fav.php" instead of "Add2favPlugin.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | An overview of files in this plugin; executable files are not allowed
Everything looks great! No dangerous files found in this plugin636 lines of code in 7 files:
LanguageFilesBlank linesComment linesLines of code
PHP561137507
JavaScript120106
CSS13023

PHP code Passed 2 tests

An overview of cyclomatic complexity and code structure
All good! No complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.18
Average class complexity8.25
▷ Minimum class complexity2.00
▷ Maximum class complexity20.00
Average method complexity1.76
▷ Minimum method complexity1.00
▷ Maximum method complexity6.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes4
▷ Abstract classes125.00%
▷ Concrete classes375.00%
▷ Final classes00.00%
Methods38
▷ Static methods00.00%
▷ Public methods3181.58%
▷ Protected methods00.00%
▷ Private methods718.42%
Functions9
▷ Named functions9100.00%
▷ Anonymous functions00.00%
Constants0
▷ Global constants00.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Using a strong compression for your PNG files is a great way to speed-up your plugin
7 PNG files occupy 0.05MB with 0.01MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
heart.png0.73KB0.83KB0.00%
screenshot-1.png3.20KB2.05KB▼ 35.97%
star.png0.65KB0.72KB0.00%
screenshot-2.png19.79KB6.31KB▼ 68.10%
delete.png0.51KB0.42KB▼ 17.92%