84% date-counter

Code Review | Date counter

WordPress plugin Date counter scored84%from 54 tests.

About plugin

  • Plugin page: date-counter
  • Plugin version: 2.0.3
  • PHP compatiblity: 5.3+
  • PHP version: 7.4.16
  • WordPress compatibility: 3.1-6.3
  • WordPress version: 6.3.1
  • First release: May 28, 2018
  • Latest release: Aug 7, 2023
  • Number of updates: 33
  • Update frequency: every 57.5 days
  • Top authors: pankratovkm (100%)

Code review

54 tests

User reviews

7 reviews

Install metrics

1,000+ active /14,389 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

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

Server metrics [RAM: ▲0.01MB] [CPU: ▼4.72ms] Passed 4 tests

A check of server-side resources used by Date counter
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /3.48 ▲0.0237.38 ▼8.01
Dashboard /wp-admin3.32 ▲0.0152.03 ▼2.81
Posts /wp-admin/edit.php3.37 ▲0.0147.98 ▼3.86
Add New Post /wp-admin/post-new.php5.90 ▲0.0197.40 ▼3.48
Media Library /wp-admin/upload.php3.24 ▲0.0135.99 ▼3.53

Server storage [IO: ▲0.01MB] [DB: ▲0.07MB] Passed 3 tests

How much does this plugin use your filesystem and database?
The plugin installed successfully
Filesystem: 7 new files
Database: no new tables, 6 new options
New WordPress options
theysaidso_admin_options
widget_recent-posts
can_compress_scripts
widget_theysaidso_widget
db_upgraded
widget_recent-comments

Browser metrics Passed 4 tests

Date counter: an overview of browser usage
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,789 ▲2814.35 ▼0.221.78 ▲0.1140.83 ▼4.69
Dashboard /wp-admin2,192 ▲185.51 ▼0.0283.97 ▼12.5437.07 ▼9.73
Posts /wp-admin/edit.php2,100 ▼01.98 ▲0.0339.53 ▼0.8835.69 ▼1.64
Add New Post /wp-admin/post-new.php1,526 ▼1123.13 ▲5.01669.60 ▼6.0953.57 ▼17.92
Media Library /wp-admin/upload.php1,400 ▼04.24 ▲0.05100.38 ▼6.0844.92 ▼2.07

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

🔸 Tests weight: 35 | It is important to correctly uninstall your plugin, without leaving any traces
It is recommended to fix the following
  • Zombie WordPress options detected upon uninstall: 6 options
    • theysaidso_admin_options
    • widget_recent-comments
    • db_upgraded
    • can_compress_scripts
    • widget_recent-posts
    • widget_theysaidso_widget

Smoke tests 75% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
Even though no errors were found, this is by no means an exhaustive test

SRP 50% from 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
Please take a closer look at the following
  • 5× PHP files trigger server errors when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Class 'AbstractDatetime' not found in wp-content/plugins/date-counter/Classes/DateCounter.php:3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_shortcode() in wp-content/plugins/date-counter/Classes/CurrentDatetime.php:21
    • > PHP Fatal error
      Uncaught Error: Class 'AbstractDatetime' not found in wp-content/plugins/date-counter/Classes/CurrentDatetime.php:4
    • > PHP Fatal error
      Uncaught Error: Class 'AbstractDatetime' not found in wp-content/plugins/date-counter/Classes/TotalDatetimeDifference.php:4
    • > PHP Fatal error
      Uncaught Error: Class 'AbstractDatetime' not found in wp-content/plugins/date-counter/Classes/DatetimeDifference.php:4

User-side errors Passed 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
Everything seems fine, but this is not an exhaustive test

Optimizations

Plugin configuration 93% from 29 tests

readme.txt Passed 16 tests

The readme.txt file is an important file in your plugin as it is parsed by WordPress.org to prepare the public listing of your plugin
10 plugin tags: minutes, counter, seconds, post date, hours...

date-counter/index.php 85% from 13 tests

"Date counter" version 2.0.3's primary PHP file adds more information about the plugin and serves as the entry point for WordPress
Please take the time to fix the following:
  • Description: Please don't use more than 140 characters for the plugin description (currently 169 characters long)
  • Main file name: Please rename the main PHP file in this plugin to the plugin slug ("date-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 detected237 lines of code in 6 files:
LanguageFilesBlank linesComment linesLines of code
PHP6488237

PHP code Passed 2 tests

An overview of cyclomatic complexity and code structure
No cyclomatic complexity issues were detected for this plugin
Cyclomatic complexity
Average complexity per logical line of code0.38
Average class complexity9.80
▷ Minimum class complexity3.00
▷ Maximum class complexity23.00
Average method complexity5.89
▷ Minimum method complexity1.00
▷ Maximum method complexity23.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes5
▷ Abstract classes120.00%
▷ Concrete classes480.00%
▷ Final classes00.00%
Methods10
▷ Static methods220.00%
▷ Public methods770.00%
▷ Protected methods330.00%
▷ Private methods00.00%
Functions0
▷ Named functions00.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
There are no PNG files in this plugin