10% word-stats

Code Review | Word Stats

WordPress plugin Word Stats scored 10% from 54 tests.

About plugin

  • Plugin page: word-stats
  • Plugin version: 4.5.1
  • PHP version: 7.4.16
  • WordPress compatibility: 4.1.0-4.1.0
  • WordPress version: 5.8.1
  • First release: Dec 20, 2010
  • Latest release: Dec 21, 2014
  • Number of updates: 76
  • Update frequency: every 19.2 days
  • Top authors: Fran Ontanaya (100%)

Code review

54 tests

User reviews

10 reviews

Install metrics

1,000+ active / 30,996 total downloads

Benchmarks

Plugin footprint 40% from 16 tests

Installer 0% from 1 test

🔺 Critical test (weight: 50) | The install procedure must perform silently
It is recommended to fix the following installer errors
  • This plugin did not install gracefully
    • > Deprecated in wp-content/plugins/word-stats/word-stats.php+46
    Non-static method Word_Stats_Core::load_options() should not be called statically

Server metrics [RAM: ▼1.59MB] [CPU: ▼188.64ms] Passed 4 tests

A check of server-side resources used by Word Stats
This plugin does not affect your website's performance
PageMemory (MB)CPU Time (ms)
Home /2.04 ▼0.685.89 ▼13.10
Dashboard /wp-admin2.06 ▼0.997.11 ▼42.29
Posts /wp-admin/edit.php2.06 ▼1.048.17 ▼33.98
Add New Post /wp-admin/post-new.php2.06 ▼3.376.30 ▼650.26
Media Library /wp-admin/upload.php2.06 ▼0.946.82 ▼28.02
Word Stats /wp-admin/index.php?page=word-stats-graphs2.067.31
Word Stats /wp-admin/options-general.php?page=word-stats-options2.067.94

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

A short overview of filesystem and database impact
The plugin installed successfully
Filesystem: 120 new files
Database: no new tables, 3 new options
New WordPress options
widget_ws_word_counts
word_stats_options
word_stats_state

Browser metrics Passed 4 tests

This is an overview of browser requirements for Word Stats
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /3,711 ▲10515.87 ▲0.2612.25 ▲3.5345.81 ▼1.93
Dashboard /wp-admin3,002 ▲685.93 ▼0.09141.26 ▼13.37107.77 ▼0.73
Posts /wp-admin/edit.php2,767 ▲282.71 ▼0.0165.97 ▲0.27107.07 ▲10.28
Add New Post /wp-admin/post-new.php1,623 ▲12521.42 ▲2.57291.56 ▼123.01102.14 ▼9.73
Media Library /wp-admin/upload.php1,834 ▲245.05 ▲0.02157.83 ▲2.29118.33 ▲4.68
Word Stats /wp-admin/index.php?page=word-stats-graphs1,4833.51100.23110.24
Word Stats /wp-admin/options-general.php?page=word-stats-options1,4102.1854.2099.39

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
The following items require your attention
  • This plugin cannot be uninstalled
    • > Deprecated in wp-content/plugins/word-stats/word-stats.php+46
    Non-static method Word_Stats_Core::load_options() should not be called statically
  • This plugin does not fully uninstall, leaving 1 option in the database
    • widget_ws_word_counts

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)
Almost there, just fix the following server-side errors
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/options-general.php?page=word-stats-options
    • > Deprecated in wp-content/plugins/word-stats/word-stats.php+46
    Non-static method Word_Stats_Core::load_options() should not be called statically
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/options-general.php?page=word-stats-options
    • > Deprecated in wp-content/plugins/word-stats/word-stats.php+96
    Function create_function() is deprecated
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/options-general.php?page=word-stats-options
    • > Deprecated in wp-content/plugins/word-stats/word-counts-widget.php+12
    Methods with the same name as their class will not be constructors in a future version of PHP; widget_ws_word_counts has a deprecated constructor
  • 5 occurences, only the last one shown
    • > GET request to /wp-admin/options-general.php?page=word-stats-options
    • > Deprecated in wp-content/plugins/word-stats/word-stats.php+799
    Non-static method Word_Stats_State::is_worker_needed() should not be called statically
  • 5 occurences, only the last one shown
    • > GET request to /wp-admin/options-general.php?page=word-stats-options
    • > Deprecated in wp-content/plugins/word-stats/word-stats.php+140
    Non-static method Word_Stats_Core::get_uncached_posts_ids() should not be called statically
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/options-general.php?page=word-stats-options
    • > User deprecated in wp-includes/functions.php+5304
    The called constructor method for WP_Widget in widget_ws_word_counts is deprecated since version 4.3.0! Use __construct() instead.
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/options-general.php?page=word-stats-options
    • > Deprecated in wp-includes/class-wp-hook.php+303
    Non-static method Word_Stats_Core::style_column() should not be called statically
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/options-general.php?page=word-stats-options
    • > Deprecated in wp-includes/class-wp-hook.php+303
    Non-static method Word_Stats_Admin::init_settings() should not be called statically
    • > GET request to /wp-admin/index.php?page=word-stats-graphs
    • > Deprecated in wp-includes/class-wp-hook.php+303
    Non-static method Word_Stats_Admin::reports_page() should not be called statically
    • > GET request to /wp-admin/index.php?page=word-stats-graphs
    • > Deprecated in wp-content/plugins/word-stats/word-stats.php+743
    Non-static method Word_Stats_Admin::load_report_stats() should not be called statically
    • > GET request to /wp-admin/index.php?page=word-stats-graphs
    • > Deprecated in wp-content/plugins/word-stats/word-stats.php+545
    Non-static method Word_Stats_Core::get_ignored_keywords() should not be called statically
    • > GET request to /wp-admin/index.php?page=word-stats-graphs
    • > Notice in wp-content/plugins/word-stats/word-stats.php+484
    Undefined variable: word_stats_ignore
    • > GET request to /wp-admin/index.php?page=word-stats-graphs
    • > Notice in wp-content/plugins/word-stats/word-stats.php+484
    Trying to access array offset on value of type null
  • 11 occurences, only the last one shown
    • > GET request to /wp-admin/index.php?page=word-stats-graphs
    • > Deprecated in wp-content/plugins/word-stats/word-stats.php+551
    Non-static method Word_Stats_Core::is_content_type() should not be called statically
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/index.php?page=word-stats-graphs
    • > Deprecated in wp-content/plugins/word-stats/word-stats.php+571
    Non-static method Word_Stats_Core::add_to_all() should not be called statically
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/index.php?page=word-stats-graphs
    • > Deprecated in wp-content/plugins/word-stats/word-stats.php+616
    Non-static method Word_Stats_Core::calc_ws_index() should not be called statically
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/index.php?page=word-stats-graphs
    • > Deprecated in wp-content/plugins/word-stats/word-stats.php+635
    Non-static method Word_Stats_Admin::diagnostics_row() should not be called statically
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/index.php?page=word-stats-graphs
    • > Notice in wp-content/plugins/word-stats/view-report-graphs.php+121
    Undefined index: page
    • > GET request to /wp-admin/index.php?page=word-stats-graphs
    • > Notice in wp-content/plugins/word-stats/word-stats.php+593
    Undefined index: like
  • 3 occurences, only the last one shown
    • > GET request to /wp-admin/index.php?page=word-stats-graphs
    • > Deprecated in wp-content/plugins/word-stats/word-stats.php+666
    Non-static method Word_Stats_Core::safe_ksort() should not be called statically
    • > GET request to /wp-admin/index.php?page=word-stats-graphs
    • > Deprecated in wp-content/plugins/word-stats/word-stats.php+755
    Non-static method Word_Stats_Admin::diagnostics_tables() should not be called statically
    • > GET request to /wp-admin/index.php?page=word-stats-graphs
    • > Notice in wp-content/plugins/word-stats/word-stats.php+699
    Undefined index: spammed_keywords
  • 4 occurences, only the last one shown
    • > GET request to /wp-admin/index.php?page=word-stats-graphs
    • > Warning in wp-content/plugins/word-stats/word-stats.php+715
    count(): Parameter must be an array or an object that implements Countable
    • > GET request to /wp-admin/index.php?page=word-stats-graphs
    • > Notice in wp-content/plugins/word-stats/word-stats.php+709
    Undefined index: no_keywords
    • > GET request to /wp-admin/index.php?page=word-stats-graphs
    • > Notice in wp-content/plugins/word-stats/word-stats.php+711
    Undefined index: too_difficult
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/index.php?page=word-stats-graphs
    • > Deprecated in wp-content/plugins/word-stats/word-stats.php+718
    Non-static method Word_Stats_Admin::diagnostics_table() should not be called statically
    • > GET request to /wp-admin/index.php?page=word-stats-graphs
    • > Notice in wp-content/plugins/word-stats/word-stats.php+715
    Undefined index: too_long
    • > GET request to /wp-admin/index.php?page=word-stats-graphs
    • > Notice in wp-content/plugins/word-stats/view-report-graphs.php+32
    Undefined index: author-tab
    • > GET request to /wp-admin/index.php?page=word-stats-graphs
    • > Notice in wp-content/plugins/word-stats/view-report-graphs.php+54
    Undefined index: view-all
    • > GET request to /wp-admin/index.php?page=word-stats-graphs
    • > Notice in wp-content/plugins/word-stats/view-report-graphs.php+121
    Undefined variable: total_per_type
    • > GET request to /wp-admin/index.php?page=word-stats-graphs
    • > Notice in wp-content/plugins/word-stats/view-report-graphs.php+121
    Undefined index: post
    • > GET request to /wp-admin/index.php?page=word-stats-graphs
    • > Notice in wp-content/plugins/word-stats/view-report-graphs.php+126
    Undefined variable: data
    • > GET request to /wp-admin/index.php?page=word-stats-graphs
    • > Notice in wp-content/plugins/word-stats/view-report-graphs.php+126
    Undefined offset: 1
    • > GET request to /wp-admin/index.php?page=word-stats-graphs
    • > Notice in wp-content/plugins/word-stats/view-report-graphs.php+126
    Undefined offset: 2
    • > GET request to /wp-admin/index.php?page=word-stats-graphs
    • > Notice in wp-content/plugins/word-stats/view-report-graphs.php+143
    Undefined variable: total_sum
    • > GET request to /wp-admin/index.php?page=word-stats-graphs
    • > Notice in wp-content/plugins/word-stats/view-report-graphs.php+188
    Undefined variable: kw_data
    • > GET request to /wp-admin/index.php?page=word-stats-graphs
    • > Notice in wp-content/plugins/word-stats/view-report-graphs.php+189
    Undefined variable: var_kw_ticks
    • > GET request to /wp-admin/index.php?page=word-stats-graphs
    • > Notice in wp-content/plugins/word-stats/view-report-graphs.php+187
    Undefined variable: kw_ticks
    • > GET request to /wp-admin/options-general.php?page=word-stats-options
    • > Deprecated in wp-includes/class-wp-hook.php+303
    Non-static method Word_Stats_Admin::settings_page() should not be called statically
  • 5 occurences, only the last one shown
    • > GET request to /wp-admin/options-general.php?page=word-stats-options
    • > Deprecated in wp-content/plugins/word-stats/view-settings.php+38
    Non-static method Word_Stats_Admin::options_section() should not be called statically
  • 13 occurences, only the last one shown
    • > GET request to /wp-admin/options-general.php?page=word-stats-options
    • > Deprecated in wp-content/plugins/word-stats/view-settings.php+36
    Non-static method Word_Stats_Admin::options_field() should not be called statically

SRP 50% from 2 tests

🔹 Tests weight: 20 | SRP (Single-Responsibility Principle) - PHP files must act as libraries and never output text or perform any action when accessed directly in a browser
Please fix the following items
  • 31× PHP files trigger server errors when accessed directly (only 10 are shown):
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_admin_url() in wp-content/plugins/word-stats/donate.php:4
    • > PHP Notice
      Undefined variable: word_stats_options in wp-content/plugins/word-stats/view-live-stats.php on line 56
    • > PHP Fatal error
      Uncaught Error: Class 'WP_Widget' not found in wp-content/plugins/word-stats/word-counts-widget.php:12
    • > PHP Notice
      Trying to access array offset on value of type null in wp-content/plugins/word-stats/view-live-stats.php on line 72
    • > PHP Notice
      Trying to access array offset on value of type null in wp-content/plugins/word-stats/view-live-stats.php on line 56
    • > PHP Warning
      Use of undefined constant WP_UNINSTALL_PLUGIN - assumed 'WP_UNINSTALL_PLUGIN' (this will throw an Error in a future version of PHP) in wp-content/plugins/word-stats/uninstall.php on line 4
    • > PHP Warning
      Use of undefined constant WS_CURRENT_VERSION - assumed 'WS_CURRENT_VERSION' (this will throw an Error in a future version of PHP) in wp-content/plugins/word-stats/view-settings.php on line 3
    • > PHP Notice
      Undefined variable: word_stats_options in wp-content/plugins/word-stats/view-live-stats.php on line 49
    • > PHP Notice
      Trying to access array offset on value of type null in wp-content/plugins/word-stats/view-live-stats.php on line 50
    • > PHP Fatal error
      Uncaught Error: Call to undefined function wp_clear_scheduled_hook() in wp-content/plugins/word-stats/uninstall.php:11

User-side errors 0% from 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
These are user-side errors you should fix
    • > GET request to /wp-admin/index.php?page=word-stats-graphs
    • > Javascript (severe) in unknown
    /wp-content/plugins/word-stats/js/flot/jquery.flot.pie.js 409:24 Uncaught TypeError: Cannot read properties of undefined (reading 'msie')

Optimizations

Plugin configuration 93% from 29 tests

readme.txt 88% from 16 tests

The readme.txt file describes your plugin functionality and requirements and it is parsed to prepare the your plugin's listing
These attributes need your attention:
  • Plugin Name: Write the name of your plugin instead of "Plugin Name" on the first line ( === word-stats === )
  • Screenshots: These screenshots require images: #1 (Analytics page.), #2 (Total word counts in the dashboard.), #3 (Live stats for the post being edited.), #4 (Extra column showing an aggregate of the readability indexes.)
The official readme.txt is a good inspiration

word-stats/word-stats.php Passed 13 tests

"Word Stats" version 4.5.1's main PHP file describes plugin functionality and also serves as the entry point to any WordPress functionality
82 characters long description:
A suite of word counters, keyword counters and readability analysis for your blog.

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
Everything looks great! No dangerous files found in this plugin26,547 lines of code in 82 files:
LanguageFilesBlank linesComment linesLines of code
JavaScript324,7303,40521,989
HTML24321232,208
PHP102082881,530
PO File2204256440
CSS578299
Markdown14049
JSON70028
make1324

PHP code Passed 2 tests

This is a short overview of cyclomatic complexity and code structure for this plugin
This plugin has no cyclomatic complexity problems
Cyclomatic complexity
Average complexity per logical line of code0.37
Average class complexity22.00
▷ Minimum class complexity1.00
▷ Maximum class complexity59.00
Average method complexity3.62
▷ Minimum method complexity1.00
▷ Maximum method complexity34.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes5
▷ Abstract classes00.00%
▷ Concrete classes5100.00%
▷ Final classes00.00%
Methods40
▷ Static methods00.00%
▷ Public methods40100.00%
▷ Protected methods00.00%
▷ Private methods00.00%
Functions27
▷ Named functions27100.00%
▷ Anonymous functions00.00%
Constants3
▷ Global constants3100.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
18 PNG files occupy 0.21MB with 0.08MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
js/ui/css/custom/images/ui-bg_glass_55_fbf9ee_1x400.png0.12KB0.14KB0.00%
js/ui/css/custom/images/ui-bg_glass_65_ffffff_1x400.png0.10KB0.10KB▼ 5.71%
screenshot-4.png37.41KB14.20KB▼ 62.06%
screenshot-2.png19.68KB6.41KB▼ 67.44%
screenshot-1.png77.29KB26.16KB▼ 66.15%