68% countdowns

Code Review | Countdown

WordPress plugin Countdown scored68%from 54 tests.

About plugin

  • Plugin page: countdowns
  • Plugin version: 1.0.0
  • PHP compatiblity: 5.3+
  • PHP version: 7.4.16
  • WordPress compatibility: 3.8-4.9.4
  • WordPress version: 6.3.1
  • First release: Apr 6, 2018
  • Latest release: Apr 6, 2018
  • Number of updates: 2
  • Update frequency: N/A
  • Top authors: devmikelarson (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /617 total downloads

Benchmarks

Plugin footprint 65% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Verifying that this plugin installs correctly without errors
This plugin's installer ran successfully

Server metrics [RAM: ▼1.11MB] [CPU: ▼39.27ms] Passed 4 tests

This is a short check of server-side resources used by Countdown
Normal server usage
PageMemory (MB)CPU Time (ms)
Home /2.87 ▼0.5917.39 ▼26.98
Dashboard /wp-admin2.90 ▼0.4015.75 ▼31.87
Posts /wp-admin/edit.php2.91 ▼0.4518.16 ▼29.40
Add New Post /wp-admin/post-new.php2.90 ▼2.9817.70 ▼68.82
Media Library /wp-admin/upload.php2.90 ▼0.3218.88 ▼14.04
Countdown Types /wp-admin/edit.php?post_type=mcdcountdown&page=mcdcountdown3.3630.04
Add New /wp-admin/post-new.php?post_type=mcdcountdown3.4241.94
All Countdowns /wp-admin/edit.php?post_type=mcdcountdown3.4336.57

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

A short overview of filesystem and database impact
This plugin installed successfully
Filesystem: 26 new files
Database: no new tables, 6 new options
New WordPress options
can_compress_scripts
widget_theysaidso_widget
db_upgraded
widget_recent-posts
widget_recent-comments
theysaidso_admin_options

Browser metrics Passed 4 tests

An overview of browser requirements for Countdown
Normal browser usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,834 ▲9913.33 ▼0.971.69 ▼0.7542.30 ▼9.20
Dashboard /wp-admin2,237 ▲524.86 ▼1.00118.37 ▲1.2143.62 ▲0.99
Posts /wp-admin/edit.php2,120 ▲312.03 ▲0.0341.14 ▲4.9235.52 ▲0.58
Add New Post /wp-admin/post-new.php1,560 ▲4023.25 ▲0.06653.16 ▲19.0560.27 ▲9.13
Media Library /wp-admin/upload.php1,413 ▲224.19 ▲0.0195.86 ▼2.1141.31 ▼0.52
Countdown Types /wp-admin/edit.php?post_type=mcdcountdown&page=mcdcountdown8261.7926.6326.10
Add New /wp-admin/post-new.php?post_type=mcdcountdown2,0114.1463.2635.26
All Countdowns /wp-admin/edit.php?post_type=mcdcountdown1,0812.3831.8428.81

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

🔸 Tests weight: 35 | It is important to correctly uninstall your plugin, without leaving any traces
The following items require your attention
  • The plugin did not uninstall gracefully
    • > Notice in wp-content/plugins/countdowns/classes/RegisterPostType.php+46
    Undefined index: post_type
  • This plugin did not uninstall successfully, leaving 6 options in the database
    • widget_recent-comments
    • widget_theysaidso_widget
    • widget_recent-posts
    • db_upgraded
    • theysaidso_admin_options
    • can_compress_scripts

Smoke tests 50% 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)
Almost there, just fix the following server-side errors
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/post-new.php?post_type=mcdcountdown
    • > Notice in wp-content/plugins/countdowns/classes/countdown/Countdown.php+212
    Trying to access array offset on value of type bool
    • > GET request to /wp-admin/post-new.php?post_type=mcdcountdown
    • > Notice in wp-content/plugins/countdowns/assets/views/cricleMainView.php+5
    Undefined index: mcd_type
    • > GET request to /wp-admin/edit.php?post_type=mcdcountdown
    • > POST request to /wp-admin/admin-ajax.php
    • > Notice in wp-content/plugins/countdowns/classes/RegisterPostType.php+46
    Undefined index: post_type
    • > GET request to /wp-admin/edit.php?post_type=mcdcountdown
    • > POST request to /wp-admin/admin-ajax.php
    • > Notice in wp-content/plugins/countdowns/classes/RegisterPostType.php+46
    Undefined index: post

SRP 50% from 2 tests

🔹 Tests weight: 20 | The single-responsibility principle applies for WordPress plugins as well - please make sure your PHP files perform no actions when accessed directly
Almost there! Just fix the following items
  • 12× PHP files trigger server errors when accessed directly (only 10 are shown):
    • > PHP Warning
      require_once(MCD_HELPERS_PATHScriptsIncluder.php): failed to open stream: No such file or directory in wp-content/plugins/countdowns/CountdownInit.php on line 32
    • > PHP Fatal error
      Uncaught Error: Call to undefined function apply_filters() in wp-content/plugins/countdowns/config/optionsConfig.php:8
    • > PHP Fatal error
      Uncaught Error: Class 'mcd\\Countdown' not found in wp-content/plugins/countdowns/classes/countdown/CircleCountdown.php:4
    • > PHP Warning
      Use of undefined constant MCD_HELPERS_PATH - assumed 'MCD_HELPERS_PATH' (this will throw an Error in a future version of PHP) in wp-content/plugins/countdowns/CountdownInit.php on line 32
    • > PHP Fatal error
      require_once(): Failed opening required 'MCD_HELPERS_PATHScriptsIncluder.php' (include_path='.:/usr/share/php') in wp-content/plugins/countdowns/CountdownInit.php on line 32
    • > PHP Fatal error
      Uncaught Error: Call to undefined function mcd\\add_action() in wp-content/plugins/countdowns/assets/css/Css.php:12
    • > PHP Fatal error
      Uncaught Error: Call to a member function getOptionValue() on null in wp-content/plugins/countdowns/assets/views/cricleMainView.php:2
    • > PHP Notice
      Undefined variable: typeObj in wp-content/plugins/countdowns/assets/views/cricleMainView.php on line 2
    • > PHP Fatal error
      Uncaught Error: Call to undefined function wp_die() in wp-content/plugins/countdowns/countdown.php:13
    • > PHP Fatal error
      Uncaught Error: Call to undefined function admin_url() in wp-content/plugins/countdowns/config/config.php:11

User-side errors Passed 1 test

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

Optimizations

Plugin configuration 96% 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
3 plugin tags: countdown timer, timer, countdown

countdowns/countdown.php 92% from 13 tests

This is the main PHP file of "Countdown" version 1.0.0, providing information about the plugin in the header fields and serving as the principal entry point to the plugin's functions
Please make the necessary changes and fix the following:
  • Main file name: The principal plugin file should be the same as the plugin slug ("countdowns.php" instead of "countdown.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
There were no executable files found in this plugin8,391 lines of code in 24 files:
LanguageFilesBlank linesComment linesLines of code
CSS46226,889
JavaScript312180786
PHP1718574716

PHP code Passed 2 tests

Analyzing logical lines of code, cyclomatic complexity, and other code metrics
Although this was not an exhaustive test, there were no cyclomatic complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.21
Average class complexity5.69
▷ Minimum class complexity1.00
▷ Maximum class complexity29.00
Average method complexity1.74
▷ Minimum method complexity1.00
▷ Maximum method complexity9.00
Code structure
Namespaces1
Interfaces0
Traits0
Classes13
▷ Abstract classes17.69%
▷ Concrete classes1292.31%
▷ Final classes00.00%
Methods83
▷ Static methods1922.89%
▷ Public methods7691.57%
▷ Protected methods11.20%
▷ Private methods67.23%
Functions0
▷ Named functions00.00%
▷ Anonymous functions00.00%
Constants3
▷ Global constants3100.00%
▷ Class constants00.00%
▷ Public constants00.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

PNG files should be compressed to save space and minimize bandwidth usage
1 PNG file occupies 0.01MB with 0.01MB in potential savings
Potential savings
Compression of 1 random PNG file using pngquant
FileSize - originalSize - compressedSavings
assets/img/Cricle.png9.99KB4.32KB▼ 56.80%