62% hits-counter

Code Review | Post Hits Counter

WordPress plugin Post Hits Counter scored62%from 54 tests.

About plugin

  • Plugin page: hits-counter
  • Plugin version: 2.8.23
  • PHP version: 7.4.16
  • WordPress compatibility: 5.1-6.3
  • WordPress version: 6.3.1
  • First release: Nov 13, 2017
  • Latest release: Aug 18, 2023
  • Number of updates: 24
  • Update frequency: every 87.7 days
  • Top authors: amit_ratio (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /1,088 total downloads

Benchmarks

Plugin footprint 65% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
The plugin installed gracefully, with no errors

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

This is a short check of server-side resources used by Post Hits Counter
No issues were detected with server-side resource usage
PageMemory (MB)CPU Time (ms)
Home /3.48 ▲0.0241.76 ▲0.58
Dashboard /wp-admin3.32 ▲0.0246.00 ▼1.91
Posts /wp-admin/edit.php3.37 ▲0.0245.56 ▲1.00
Add New Post /wp-admin/post-new.php5.90 ▲0.0290.23 ▲6.80
Media Library /wp-admin/upload.php3.24 ▲0.0232.96 ▲0.65
Hits Counter /wp-admin/admin.php?page=post_hit_counter3.2331.74
Hits Counter Setting /wp-admin/admin.php?page=hit_counter_setting3.2129.57
Keyword Searches /wp-admin/admin.php?page=keyword_searches3.1829.00

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

Analyzing filesystem and database footprints of this plugin
No storage issues were detected
Filesystem: 10 new files
Database: 1 new table, 8 new options
New tables
wp_hitsCount
New WordPress options
phc_version_
theysaidso_admin_options
db_upgraded
widget_theysaidso_widget
recovery_mode_email_last_sent
widget_recent-comments
widget_recent-posts
can_compress_scripts

Browser metrics Passed 4 tests

This is an overview of browser requirements for Post Hits Counter
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,830 ▲8414.75 ▲0.441.68 ▼0.1946.24 ▲1.75
Dashboard /wp-admin2,236 ▲485.88 ▲0.07102.59 ▼12.9940.74 ▼4.09
Posts /wp-admin/edit.php2,116 ▲242.06 ▲0.0534.54 ▼1.3933.61 ▼2.74
Add New Post /wp-admin/post-new.php1,563 ▲4423.52 ▲0.32594.39 ▼91.0251.33 ▲2.08
Media Library /wp-admin/upload.php1,409 ▲214.16 ▲0.0197.23 ▼1.9043.56 ▼0.19
Hits Counter /wp-admin/admin.php?page=post_hit_counter8642.0628.7729.30
Hits Counter Setting /wp-admin/admin.php?page=hit_counter_setting7932.0523.6824.50
Keyword Searches /wp-admin/admin.php?page=keyword_searches7011.537.0622.06

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

🔸 Tests weight: 35 | The uninstall procedure must remove all plugin files and extra database tables
You still need to fix the following
  • The plugin did not uninstall successfully, leaving 1 table in the database
    • wp_hitsCount
  • Zombie WordPress options were found after uninstall: 8 options
    • db_upgraded
    • can_compress_scripts
    • theysaidso_admin_options
    • recovery_mode_email_last_sent
    • widget_recent-posts
    • widget_theysaidso_widget
    • phc_version_
    • widget_recent-comments

Smoke tests 25% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the server (in the Apache logs)
Please fix the following server-side errors
    • > GET request to /wp-admin/admin.php?page=keyword_searches
    • > Error in wp-content/plugins/hits-counter/admin/PostHitCountClass.php+261
    Uncaught Error: Call to undefined function handlePostData() in wp-content/plugins/hits-counter/admin/PostHitCountClass.php:261
    Stack trace:
    #0 wp-content/plugins/hits-counter/admin/PostHitCountClass.php(212): PostHitCount->fectchKeyword()
    #1 wp-includes/class-wp-hook.php(310): PostHitCount->phcKeywordSearches()
    #2 wp-includes/class-wp-hook.php(334): WP_Hook->apply_filters()
    #3 wp-includes/plugin.php(517): WP_Hook->do_action()
    #4 wp-admin/admin.php(259): do_action()
    #5 {main}
    thrown

SRP 0% from 2 tests

🔹 Tests weight: 20 | A shallow check of the single-responsibility principle; PHP files should perform no action - including output of placeholder text - and trigger no errors when accessed directly
The following issues need your attention
  • 1× PHP files output text when accessed directly:
    • > /wp-content/plugins/hits-counter/templates/phcKeywordSearches.php
  • 4× GET requests to PHP files have triggered server-side errors or warnings:
    • > PHP Fatal error
      Uncaught Error: Class 'phcDataBaseClass' not found in wp-content/plugins/hits-counter/admin/ShowPostListingClass.php:3
    • > PHP Warning
      Invalid argument supplied for foreach() in wp-content/plugins/hits-counter/templates/phcKeywordSearches.php on line 12
    • > PHP Fatal error
      Uncaught Error: Call to undefined function site_url() in wp-content/plugins/hits-counter/templates/phc-records-panel.php:28
    • > PHP Notice
      Undefined variable: result in wp-content/plugins/hits-counter/templates/phcKeywordSearches.php on line 12

User-side errors Passed 1 test

🔹 Test weight: 20 | This is a shallow check for browser errors
No browser issues were found

Optimizations

Plugin configuration 97% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file is important because it is parsed by WordPress.org for the public listing of your plugin
Attributes that need to be fixed:
  • Plugin Name: Write the name of your plugin instead of "Plugin Name" on the first line ( === hits-counter === )
The official readme.txt might help

hits-counter/hits-counter.php Passed 13 tests

The primary PHP file in "Post Hits Counter" version 2.8.23 is used by WordPress to initiate all plugin functionality
123 characters long description:
A simple plugin for capturing hits on posts of your wordpress blog. Install it and see the hit records in your Admin Panel.

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is an overview of file extensions present in this plugin and a short test that no dangerous files are bundled with this plugin
No dangerous file extensions were detected564 lines of code in 8 files:
LanguageFilesBlank linesComment linesLines of code
PHP78758561
Markdown1103

PHP code Passed 2 tests

This is a short overview of cyclomatic complexity and code structure for this plugin
No cyclomatic complexity issues were detected for this plugin
Cyclomatic complexity
Average complexity per logical line of code0.40
Average class complexity18.33
▷ Minimum class complexity5.00
▷ Maximum class complexity29.00
Average method complexity3.60
▷ Minimum method complexity1.00
▷ Maximum method complexity9.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes3
▷ Abstract classes00.00%
▷ Concrete classes3100.00%
▷ Final classes00.00%
Methods20
▷ Static methods00.00%
▷ Public methods1365.00%
▷ Protected methods15.00%
▷ Private methods630.00%
Functions3
▷ Named functions3100.00%
▷ Anonymous functions00.00%
Constants0
▷ Global constants00.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

It is recommended to compress PNG files in your plugin to minimize bandwidth usage
No PNG images were found in this plugin