10% post-views-stats-counter

Code Review | Post Views Stats Counter

WordPress plugin Post Views Stats Counter scored10%from 54 tests.

About plugin

  • Plugin page: post-views-stats-...
  • Plugin version: 1.1.7
  • PHP version: 7.4.16
  • WordPress version: 6.3.1
  • First release: Apr 26, 2019
  • Latest release: Apr 12, 2023
  • Number of updates: 85
  • Update frequency: every 17.0 days
  • Top authors: kazukiyanamoto (100%)

Code review

54 tests

User reviews

4 reviews

Install metrics

1,000+ active /17,619 total downloads

Benchmarks

Plugin footprint 23% from 16 tests

Installer 0% from 1 test

🔺 Critical test (weight: 50) | Verifying that this plugin installs correctly without errors
The following installer errors require your attention
  • Install procedure validation failed for this plugin
    • > User notice in wp-includes/functions.php+5905
    Function register_uninstall_hook was called incorrectly. Only a static class method or function can be used in an uninstall hook. Please see Debugging in WordPress for more information. (This message was added in version 3.1.0.)

Server metrics [RAM: ▼1.80MB] [CPU: ▼52.16ms] Passed 4 tests

Analyzing server-side resources used by Post Views Stats Counter
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /2.19 ▼1.275.18 ▼37.40
Dashboard /wp-admin2.21 ▼1.106.48 ▼39.42
Posts /wp-admin/edit.php2.21 ▼1.156.69 ▼41.55
Add New Post /wp-admin/post-new.php2.21 ▼3.687.05 ▼90.26
Media Library /wp-admin/upload.php2.21 ▼1.025.50 ▼29.08
View & Settings for Post Views Stats /wp-admin/options-general.php?page=post_views_stats_admin_menu2.216.26

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

Input-output and database impact of this plugin
The plugin installed successfully
Filesystem: 11 new files
Database: 1 new table, 19 new options
New tables
wp_pvs_counter
New WordPress options
pvs_counter_year_front_value
widget_recent-comments
can_compress_scripts
widget_my_widget
pvs_counter_title_value
pvs_counter_value_user_bots
pvs_counter_dayselect_value
pvs_counter_day_back_value
theysaidso_admin_options
widget_recent-posts
...

Browser metrics Passed 4 tests

Post Views Stats Counter: an overview of browser usage
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,804 ▲6914.70 ▲0.051.85 ▲0.1143.62 ▼2.93
Dashboard /wp-admin2,213 ▲254.84 ▼0.0498.04 ▼7.1238.45 ▼5.96
Posts /wp-admin/edit.php2,093 ▲11.96 ▼0.0335.93 ▼0.8133.23 ▲2.14
Add New Post /wp-admin/post-new.php1,537 ▲1823.03 ▼0.07677.96 ▲59.2055.02 ▼4.83
Media Library /wp-admin/upload.php1,386 ▲14.18 ▼0.0495.00 ▼4.6142.29 ▼1.09
View & Settings for Post Views Stats /wp-admin/options-general.php?page=post_views_stats_admin_menu1,6433.8158.3964.02

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

🔸 Tests weight: 35 | All plugins must uninstall correctly, removing their source code and extra database tables they might have created
It is recommended to fix the following
  • The plugin did not uninstall gracefully
    • > User notice in wp-includes/functions.php+5905
    Function register_uninstall_hook was called incorrectly. Only a static class method or function can be used in an uninstall hook. Please see Debugging in WordPress for more information. (This message was added in version 3.1.0.)
  • The uninstall procedure failed, leaving 1 table in the database
    • wp_pvs_counter
  • Zombie WordPress options were found after uninstall: 9 options
    • jal_db_version
    • widget_theysaidso_widget
    • widget_recent-posts
    • pvs_counter_value_user_bots
    • can_compress_scripts
    • db_upgraded
    • widget_recent-comments
    • widget_my_widget
    • theysaidso_admin_options

Smoke tests 50% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | This is a short smoke test looking for server-side errors
These errors were triggered by the plugin
    • > GET request to /wp-admin/options-general.php?page=post_views_stats_admin_menu
    • > User notice in wp-includes/functions.php+5905
    Function register_uninstall_hook was called incorrectly. Only a static class method or function can be used in an uninstall hook. Please see Debugging in WordPress for more information. (This message was added in version 3.1.0.)
    • > GET request to /wp-admin/options-general.php?page=post_views_stats_admin_menu
    • > Notice in wp-content/plugins/post-views-stats-counter/manage/admin.php+30
    Undefined index: Pvs_Counter_save
    • > GET request to /wp-admin/options-general.php?page=post_views_stats_admin_menu
    • > Notice in wp-content/plugins/post-views-stats-counter/manage/admin.php+480
    Undefined property: stdClass::$time
    • > GET request to /wp-admin/options-general.php?page=post_views_stats_admin_menu
    • > Notice in wp-content/plugins/post-views-stats-counter/manage/admin.php+480
    Undefined property: stdClass::$total_access
    • > GET request to /wp-admin/options-general.php?page=post_views_stats_admin_menu
    • > Notice in wp-content/plugins/post-views-stats-counter/manage/admin.php+480
    Undefined property: stdClass::$url
    • > GET request to /wp-admin/options-general.php?page=post_views_stats_admin_menu
    • > Warning in wp-content/plugins/post-views-stats-counter/manage/admin.php+571
    Use of undefined constant pvs_counter_schedule_check - assumed 'pvs_counter_schedule_check' (this will throw an Error in a future version of PHP)
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/options-general.php?page=post_views_stats_admin_menu
    • > Warning in wp-content/plugins/post-views-stats-counter/manage/admin.php+717
    Use of undefined constant pvs_counter_value_user - assumed 'pvs_counter_value_user' (this will throw an Error in a future version of PHP)
    • > GET request to /wp-admin/options-general.php?page=post_views_stats_admin_menu
    • > Warning in wp-content/plugins/post-views-stats-counter/manage/admin.php+670
    Use of undefined constant pvs_counter_value_admin - assumed 'pvs_counter_value_admin' (this will throw an Error in a future version of PHP)

SRP Passed 2 tests

🔹 Tests weight: 20 | The single-responsibility principle: PHP files have to remain inert when accessed directly, throwing no errors and performing no actions
Congratulations! This plugin passed the SRP test

User-side errors 0% from 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
Please fix the following user-side errors
    • > GET request to /wp-admin/options-general.php?page=post_views_stats_admin_menu
    • > Security (warning) in unknown
    security - Error with Permissions-Policy header: Unrecognized feature: 'ambient-light-sensor'.
    • > GET request to /wp-admin/options-general.php?page=post_views_stats_admin_menu
    • > Security (warning) in unknown
    security - Error with Permissions-Policy header: Unrecognized feature: 'bluetooth'.

Optimizations

Plugin configuration 79% from 29 tests

readme.txt 75% from 16 tests

Perhaps the most important file in your plugin readme.txt gets parsed in order to generate the public listing of your plugin
These attributes need to be fixed:
  • Requires at least: Invalid version format
  • Screenshots: These screenshots require images: #1 (View posts and pages by date, access, title, permalinks, etc.), #2 (Exclude admin user and login users + Ignore bots and useragents), #3 (Add "Most Popular Articles" to the widget section)
  • Tags: Please delete some tags, you are using 14 tag instead of maximum 10
  • Plugin Name: Please specify the plugin name on the first line ( === post-views-stats-counter === )
The official readme.txt might help

post-views-stats-counter/wp_pvscounter.php 85% from 13 tests

The main PHP script in "Post Views Stats Counter" version 1.1.7 is automatically included on every request by WordPress
The following require your attention:
  • Description: Keep the plugin description shorter than 140 characters (currently 368 characters long)
  • Main file name: Even though not officially enforced, the main plugin file should be the same as the plugin slug ("post-views-stats-counter.php" instead of "wp_pvscounter.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is an overview of programming languages used in this plugin; dangerous file extensions are not allowed
No dangerous file extensions were detected916 lines of code in 3 files:
LanguageFilesBlank linesComment linesLines of code
PHP3210150916

PHP code Passed 2 tests

An overview of cyclomatic complexity and code structure
Everything seems fine, there were no complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.29
Average class complexity13.50
▷ Minimum class complexity4.00
▷ Maximum class complexity23.00
Average method complexity2.79
▷ Minimum method complexity1.00
▷ Maximum method complexity16.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes2
▷ Abstract classes00.00%
▷ Concrete classes2100.00%
▷ Final classes00.00%
Methods15
▷ Static methods00.00%
▷ Public methods15100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions9
▷ Named functions888.89%
▷ Anonymous functions111.11%
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
4 PNG files occupy 0.21MB with 0.13MB in potential savings
Potential savings
Compression of 4 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/icon-256x256.png20.26KB8.29KB▼ 59.08%
screenshot-2.png41.88KB16.37KB▼ 60.92%
screenshot-3.png79.14KB29.50KB▼ 62.72%
screenshot-1.png69.37KB25.52KB▼ 63.22%