68% product-view-counter

Code Review | Product View Counter

WordPress plugin Product View Counter scored68%from 54 tests.

About plugin

  • Plugin page: product-view-counter
  • Plugin version: 1.1.0
  • PHP compatiblity: 5.6+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.2-5.8
  • WordPress version: 6.3.1
  • First release: Jul 10, 2015
  • Latest release: Sep 16, 2021
  • Number of updates: 4
  • Update frequency: every 565.0 days
  • Top authors: aihimel (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /2,387 total downloads

Benchmarks

Plugin footprint 65% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | All plugins must install correctly, without throwing any errors, warnings, or notices
The plugin installed gracefully, with no errors

Server metrics [RAM: ▲0.03MB] [CPU: ▼0.54ms] Passed 4 tests

Server-side resources used by Product View Counter
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /3.50 ▲0.0447.15 ▲2.19
Dashboard /wp-admin3.34 ▲0.0450.01 ▼1.12
Posts /wp-admin/edit.php3.39 ▲0.0350.98 ▲0.08
Add New Post /wp-admin/post-new.php5.92 ▲0.0397.27 ▲5.26
Media Library /wp-admin/upload.php3.26 ▲0.0337.08 ▼3.32
Product View Counter /wp-admin/admin.php?page=product-view-counter3.2332.48

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

A short overview of filesystem and database impact
There were no storage issued detected upon installing this plugin
Filesystem: 10 new files
Database: 1 new table, 8 new options
New tables
wp_product_view_counter
New WordPress options
widget_recent-posts
db_upgraded
can_compress_scripts
theysaidso_admin_options
widget_theysaidso_widget
product-view-counter__available-to-all
product-view-counter__count-admin
widget_recent-comments

Browser metrics Passed 4 tests

This is an overview of browser requirements for Product View Counter
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,816 ▲5514.17 ▼0.182.04 ▲0.3147.10 ▲1.81
Dashboard /wp-admin2,195 ▲215.63 ▲0.06100.86 ▼3.8750.38 ▲5.88
Posts /wp-admin/edit.php2,100 ▲31.96 ▼0.0039.27 ▲1.6233.06 ▼3.49
Add New Post /wp-admin/post-new.php1,528 ▲222.96 ▼0.39636.94 ▼19.8550.13 ▼5.08
Media Library /wp-admin/upload.php1,400 ▼04.18 ▼0.0198.03 ▼18.1743.65 ▼5.58
Product View Counter /wp-admin/admin.php?page=product-view-counter8252.0225.8928.97

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
Please fix the following items
  • This plugin does not fully uninstall, leaving 1 table in the database
    • wp_product_view_counter
  • This plugin does not fully uninstall, leaving 6 options in the database
    • can_compress_scripts
    • widget_recent-comments
    • widget_recent-posts
    • theysaidso_admin_options
    • widget_theysaidso_widget
    • db_upgraded

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the server (in the Apache logs)
The smoke test was a success, however most plugin functionality was not tested

SRP 0% 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
  • 3× PHP files output text when accessed directly:
    • > /wp-content/plugins/product-view-counter/404.php
    • > /wp-content/plugins/product-view-counter/view.php
    • > /wp-content/plugins/product-view-counter/product-view-counter.php
  • 1× PHP files trigger server errors when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Using $this when not in object context in wp-content/plugins/product-view-counter/admin-contorl-form.php:6

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a smoke test targeting browser errors/issues
Everything seems fine on the user side

Optimizations

Plugin configuration 97% from 29 tests

readme.txt 94% from 16 tests

Don't ignore readme.txt as it is the file that instructs WordPress.org on how to present your plugin to the world
Attributes that require attention:
  • Screenshots: Please add images for these screenshots: #1 (View in single product page.), #2 (Plugin options.)
Please take inspiration from this readme.txt

product-view-counter/product-view-counter.php Passed 13 tests

Analyzing the main PHP file in "Product View Counter" version 1.1.0
106 characters long description:
A simple plugin to keep track of your product view. Has simplified configuration options and view options.

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short check of programming languages and file extensions; no executable files are allowed
There were no executable files found in this plugin178 lines of code in 7 files:
LanguageFilesBlank linesComment linesLines of code
PHP66746168
CSS13410

PHP code Passed 2 tests

Analyzing cyclomatic complexity and code structure
There were no cyclomatic complexity issued detected
Cyclomatic complexity
Average complexity per logical line of code0.21
Average class complexity14.00
▷ Minimum class complexity14.00
▷ Maximum class complexity14.00
Average method complexity2.08
▷ Minimum method complexity1.00
▷ Maximum method complexity6.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes1
▷ Abstract classes00.00%
▷ Concrete classes1100.00%
▷ Final classes00.00%
Methods12
▷ Static methods00.00%
▷ Public methods975.00%
▷ Protected methods00.00%
▷ Private methods325.00%
Functions1
▷ Named functions1100.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
2 PNG files occupy 0.10MB with 0.06MB in potential savings
Potential savings
Compression of 2 random PNG files using pngquant
FileSize - originalSize - compressedSavings
screenshot-1.png43.82KB16.14KB▼ 63.17%
screenshot-2.png57.51KB22.83KB▼ 60.31%