68% posts-unique-view-counter

Code Review | Posts Unique View Counter

WordPress plugin Posts Unique View Counter scored68%from 54 tests.

About plugin

  • Plugin page: posts-unique-view...
  • Plugin version: 1.4.0
  • PHP compatiblity: 7.2+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.8.5-5.9.0
  • WordPress version: 6.3.1
  • First release: Mar 29, 2018
  • Latest release: Feb 12, 2022
  • Number of updates: 21
  • Update frequency: every 67.4 days
  • Top authors: dcangulo (100%)

Code review

54 tests

User reviews

2 reviews

Install metrics

80+ active /1,717 total downloads

Benchmarks

Plugin footprint 65% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
Installer ran successfully

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

Server-side resources used by Posts Unique View Counter
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /3.63 ▲0.1737.95 ▲0.67
Dashboard /wp-admin3.34 ▲0.0449.00 ▲4.21
Posts /wp-admin/edit.php3.39 ▲0.0445.08 ▼3.70
Add New Post /wp-admin/post-new.php5.92 ▲0.0382.16 ▼4.41
Media Library /wp-admin/upload.php3.26 ▲0.0336.30 ▲2.79
Posts Unique View Counter /wp-admin/options-general.php?page=puvc_plugin_settings3.2328.60

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

How much does this plugin use your filesystem and database?
This plugin was installed successfully
Filesystem: 15 new files
Database: 1 new table, 6 new options
New tables
wp_puvc
New WordPress options
widget_recent-posts
db_upgraded
can_compress_scripts
widget_recent-comments
widget_theysaidso_widget
theysaidso_admin_options

Browser metrics Passed 4 tests

An overview of browser requirements for Posts Unique View Counter
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,793 ▲3214.35 ▲0.141.70 ▲0.1943.32 ▲0.59
Dashboard /wp-admin2,193 ▲165.57 ▼0.0884.78 ▲0.4135.37 ▼5.75
Posts /wp-admin/edit.php2,117 ▲172.00 ▼0.0136.04 ▲1.9332.78 ▼1.31
Add New Post /wp-admin/post-new.php1,531 ▲523.22 ▲0.18631.66 ▼57.3663.01 ▲11.87
Media Library /wp-admin/upload.php1,407 ▲74.23 ▼0.0194.81 ▲1.2540.48 ▼5.78
Posts Unique View Counter /wp-admin/options-general.php?page=puvc_plugin_settings8012.0024.9325.67

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

🔸 Tests weight: 35 | All plugins must uninstall correctly, removing their source code and extra database tables they might have created
You still need to fix the following
  • This plugin does not fully uninstall, leaving 1 table in the database
    • wp_puvc
  • Zombie WordPress options detected upon uninstall: 6 options
    • widget_recent-comments
    • db_upgraded
    • can_compress_scripts
    • widget_theysaidso_widget
    • theysaidso_admin_options
    • widget_recent-posts

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no server-side errors were triggered
The smoke test was a success, however most plugin functionality was not tested

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 take a closer look at the following
  • 1× GET requests to PHP files return non-empty strings:
    • > /wp-content/plugins/posts-unique-view-counter/views/puvc_view_message.php
  • 7× PHP files trigger server-side errors or warnings when accessed directly:
    • > PHP Warning
      require_once(ABSPATHwp-admin/includes/upgrade.php): failed to open stream: No such file or directory in wp-content/plugins/posts-unique-view-counter/index.php on line 28
    • > PHP Fatal error
      Uncaught Error: Call to undefined function plugin_dir_path() in wp-content/plugins/posts-unique-view-counter/constants.php:4
    • > PHP Fatal error
      Uncaught Error: Call to undefined function settings_fields() in wp-content/plugins/posts-unique-view-counter/views/puvc_settings.php:5
    • > PHP Notice
      Undefined variable: view_count in wp-content/plugins/posts-unique-view-counter/views/puvc_view_message.php on line 1
    • > PHP Warning
      Use of undefined constant ABSPATH - assumed 'ABSPATH' (this will throw an Error in a future version of PHP) in wp-content/plugins/posts-unique-view-counter/index.php on line 28
    • > PHP Fatal error
      require_once(): Failed opening required 'ABSPATHwp-admin/includes/upgrade.php' (include_path='.:/usr/share/php') in wp-content/plugins/posts-unique-view-counter/index.php on line 28
    • > PHP Notice
      Undefined variable: times in wp-content/plugins/posts-unique-view-counter/views/puvc_view_message.php on line 1

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 96% from 29 tests

readme.txt Passed 16 tests

It's important to format your readme.txt file correctly as it is parsed for the public listing of your plugin
8 plugin tags: counter, post, views, post views, post hits...

posts-unique-view-counter/index.php 92% from 13 tests

Analyzing the main PHP file in "Posts Unique View Counter" version 1.4.0
It is important to fix the following:
  • Main file name: It is recommended to name the main PHP file as the plugin slug ("posts-unique-view-counter.php" instead of "index.php")

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
Good job! No executable or dangerous file extensions detected153 lines of code in 7 files:
LanguageFilesBlank linesComment linesLines of code
PHP53322110
Markdown19028
Ruby13015

PHP code Passed 2 tests

A brief analysis of cyclomatic complexity and code structure for this plugin
All good! No complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.24
Average class complexity12.00
▷ Minimum class complexity12.00
▷ Maximum class complexity12.00
Average method complexity2.22
▷ Minimum method complexity1.00
▷ Maximum method complexity7.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes1
▷ Abstract classes00.00%
▷ Concrete classes1100.00%
▷ Final classes00.00%
Methods9
▷ Static methods00.00%
▷ Public methods9100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions0
▷ Named functions00.00%
▷ Anonymous functions00.00%
Constants5
▷ Global constants5100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

Often times overlooked, PNG files can occupy unnecessary space in your plugin
No PNG images were found in this plugin