84% p2-likes

Code Review | P2 Likes

WordPress plugin P2 Likes scored84%from 54 tests.

About plugin

  • Plugin page: p2-likes
  • Plugin version: 1.0.7
  • PHP version: 7.4.16
  • WordPress compatibility: 4.1-4.1
  • WordPress version: 6.3.1
  • First release: Apr 26, 2012
  • Latest release: Jan 17, 2015
  • Number of updates: 17
  • Update frequency: every 58.6 days
  • Top authors: scottbasgaard (100%)

Code review

54 tests

User reviews

4 reviews

Install metrics

70+ active /8,335 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | It is important to correctly install your plugin, without throwing errors or notices
Installer ran successfully

Server metrics [RAM: ▲0.02MB] [CPU: ▼2.20ms] Passed 4 tests

This is a short check of server-side resources used by P2 Likes
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /3.49 ▲0.0239.92 ▼3.88
Dashboard /wp-admin3.33 ▲0.0256.37 ▲0.92
Posts /wp-admin/edit.php3.38 ▲0.0250.45 ▲0.92
Add New Post /wp-admin/post-new.php5.91 ▲0.0289.50 ▼5.63
Media Library /wp-admin/upload.php3.25 ▲0.0237.02 ▼0.21

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

Filesystem and database footprint
The plugin installed successfully
Filesystem: 6 new files
Database: no new tables, 6 new options
New WordPress options
widget_recent-posts
widget_recent-comments
widget_theysaidso_widget
theysaidso_admin_options
can_compress_scripts
db_upgraded

Browser metrics Passed 4 tests

An overview of browser requirements for P2 Likes
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,875 ▲11413.84 ▼0.719.04 ▲7.2641.55 ▲2.94
Dashboard /wp-admin2,195 ▲275.57 ▼0.0782.51 ▼11.7541.07 ▼1.41
Posts /wp-admin/edit.php2,100 ▲31.98 ▼0.0435.81 ▼2.3137.00 ▲2.95
Add New Post /wp-admin/post-new.php1,528 ▲223.03 ▼0.03683.01 ▼14.7551.04 ▼0.92
Media Library /wp-admin/upload.php1,403 ▲124.29 ▲0.0697.28 ▼18.1342.24 ▼1.65

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

🔸 Tests weight: 35 | The uninstall procedure must remove all plugin files and extra database tables
These items require your attention
  • Zombie WordPress options detected upon uninstall: 6 options
    • db_upgraded
    • widget_recent-posts
    • can_compress_scripts
    • widget_recent-comments
    • widget_theysaidso_widget
    • theysaidso_admin_options

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
Even though everything seems fine, this is not 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
Please take a closer look at the following
  • 2× GET requests to PHP files trigger server-side errors or Error 500 responses:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_dir_url() in wp-content/plugins/p2-likes/p2-likes.php:29
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/p2-likes/ajax.php:33

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)
No browser issues were found

Optimizations

Plugin configuration 97% from 29 tests

readme.txt 94% from 16 tests

You should put a lot of thought into formatting readme.txt as it is used by WordPress.org to prepare the public listing of your plugin
These attributes need to be fixed:
  • Screenshots: Screenshot #1 (P2 Likes on a clean P2 install.) image missing
You can look at the official readme.txt

p2-likes/p2-likes.php Passed 13 tests

The primary PHP file in "P2 Likes" version 1.0.7 is used by WordPress to initiate all plugin functionality
78 characters long description:
"P2 Likes" is a way to give positive feedback on threads you care about on P2.

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 detected174 lines of code in 4 files:
LanguageFilesBlank linesComment linesLines of code
PHP23132105
CSS16035
JavaScript112034

PHP code Passed 2 tests

Analyzing logical lines of code, cyclomatic complexity, and other code metrics
Although this was not an exhaustive test, there were no cyclomatic complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.35
Average class complexity0.00
▷ Minimum class complexity0.00
▷ Maximum class complexity0.00
Average method complexity0.00
▷ Minimum method complexity0.00
▷ Maximum method complexity0.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes0
▷ Abstract classes00.00%
▷ Concrete classes00.00%
▷ Final classes00.00%
Methods0
▷ Static methods00.00%
▷ Public methods00.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions9
▷ Named functions9100.00%
▷ Anonymous functions00.00%
Constants2
▷ Global constants2100.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
1 PNG file occupies 0.05MB with 0.03MB in potential savings
Potential savings
Compression of 1 random PNG file using pngquant
FileSize - originalSize - compressedSavings
screenshot-1.png54.56KB18.96KB▼ 65.25%