77% democracy-poll

Code Review | Democracy Poll

WordPress plugin Democracy Poll scored77%from 54 tests.

About plugin

  • Plugin page: democracy-poll
  • Plugin version: 5.6.0
  • PHP compatiblity: 5.6+
  • PHP version: 7.4.16
  • WordPress compatibility: 4.6-5.9
  • WordPress version: 6.3.1
  • First release: Feb 2, 2015
  • Latest release: Dec 12, 2022
  • Number of updates: 315
  • Update frequency: every 9.1 days
  • Top authors: Tkama (100%)

Code review

54 tests

User reviews

75 reviews

Install metrics

10,000+ active /153,943 total downloads

Benchmarks

Plugin footprint 83% 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.55MB] [CPU: ▲5.05ms] Passed 4 tests

An overview of server-side resources used by Democracy Poll
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /4.03 ▲0.5744.65 ▲4.06
Dashboard /wp-admin3.89 ▲0.5851.13 ▼0.00
Posts /wp-admin/edit.php3.94 ▲0.5856.22 ▲4.71
Add New Post /wp-admin/post-new.php6.42 ▲0.52108.98 ▲11.71
Media Library /wp-admin/upload.php3.75 ▲0.5253.25 ▲11.43
Democracy Poll /wp-admin/options-general.php?page=democracy-poll3.7432.69

Server storage [IO: ▲0.68MB] [DB: ▲0.02MB] Passed 3 tests

Analyzing filesystem and database footprints of this plugin
There were no storage issued detected upon installing this plugin
Filesystem: 97 new files
Database: 3 new tables, 9 new options
New tables
wp_democracy_a
wp_democracy_q
wp_democracy_log
New WordPress options
can_compress_scripts
db_upgraded
democracy_options
democracy_css
widget_democracy
widget_recent-posts
theysaidso_admin_options
widget_theysaidso_widget
widget_recent-comments

Browser metrics Passed 4 tests

Democracy Poll: an overview of browser usage
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,859 ▲12414.44 ▲0.412.36 ▲0.1742.99 ▼0.31
Dashboard /wp-admin2,239 ▲484.83 ▼1.05105.33 ▲0.0341.18 ▼4.62
Posts /wp-admin/edit.php2,125 ▲332.06 ▲0.0344.56 ▲6.5737.09 ▼1.10
Add New Post /wp-admin/post-new.php1,562 ▲4320.47 ▼2.43728.24 ▲76.6764.58 ▲9.24
Media Library /wp-admin/upload.php1,421 ▲394.19 ▼0.01113.95 ▲0.7548.21 ▲1.12
Democracy Poll /wp-admin/options-general.php?page=democracy-poll1,2722.3034.5136.92

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

🔸 Tests weight: 35 | The uninstall procedure must remove all plugin files and extra database tables
It is recommended to fix the following
  • Zombie WordPress options detected upon uninstall: 6 options
    • can_compress_scripts
    • widget_theysaidso_widget
    • widget_recent-posts
    • theysaidso_admin_options
    • widget_recent-comments
    • db_upgraded

Smoke tests 50% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | A shallow check that no server-side errors were triggered
Smoke test failed, please fix the following
    • > GET request to /wp-admin/options-general.php?page=democracy-poll
    • > Notice in wp-content/plugins/democracy-poll/classes/Admin/Dem_List_Table_Polls.php+29
    Undefined index: s
  • 5 occurences, only the last one shown
    • > GET request to /wp-admin/options-general.php?page=democracy-poll
    • > POST request to /wp-cron.php?doing_wp_cron=1696658530.1360850334167480468750
    • > Notice in wp-content/plugins/pressforward/Core/Utility/Retrieval.php+204
    Undefined offset: 0
  • 5 occurences, only the last one shown
    • > GET request to /wp-admin/options-general.php?page=democracy-poll
    • > POST request to /wp-cron.php?doing_wp_cron=1696658530.1360850334167480468750
    • > Notice in wp-content/plugins/pressforward/Core/Utility/Retrieval.php+205
    Trying to get property 'guid' of non-object
  • 20 occurences, only the last one shown
    • > GET request to /wp-admin/options-general.php?page=democracy-poll
    • > POST request to /wp-cron.php?doing_wp_cron=1696658530.1360850334167480468750
    • > Notice in wp-content/plugins/pressforward/Core/Utility/Retrieval.php+221
    Trying to get property 'ID' of non-object
  • 5 occurences, only the last one shown
    • > GET request to /wp-admin/options-general.php?page=democracy-poll
    • > POST request to /wp-cron.php?doing_wp_cron=1696658530.1360850334167480468750
    • > Notice in wp-content/plugins/pressforward/Core/Utility/Retrieval.php+222
    Trying to get property 'post_title' of non-object

SRP 50% from 2 tests

🔹 Tests weight: 20 | It is important to ensure that your PHP files perform no action when accessed directly, respecting the single-responsibility principle
Almost there! Just fix the following items
  • 4× PHP files trigger server-side errors or warnings when accessed directly:
    • > PHP Fatal error
      Uncaught Error: Class 'Democracy_Poll' not found in wp-content/plugins/democracy-poll/classes/Admin/Democracy_Poll_Admin.php:4
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/democracy-poll/widget_democracy.php:7
    • > PHP Fatal error
      Uncaught Error: Class 'WP_List_Table' not found in wp-content/plugins/democracy-poll/classes/Admin/Dem_List_Table_Logs.php:4
    • > PHP Fatal error
      Uncaught Error: Class 'WP_List_Table' not found in wp-content/plugins/democracy-poll/classes/Admin/Dem_List_Table_Polls.php:3

User-side errors Passed 1 test

🔹 Test weight: 20 | Just a short smoke test targeting errors on the browser (console and network errors and warnings)
Everything seems fine on the user side

Optimizations

Plugin configuration 87% from 29 tests

readme.txt 88% from 16 tests

Don't ignore readme.txt as it is the file that instructs WordPress.org on how to present your plugin to the world
These attributes need your attention:
  • Tags: You are using too many tags: 30 tag instead of maximum 10
  • Plugin Name: "Plugin Name" should be replaced with the name of your plugin on the first line ( === democracy-poll === )
The official readme.txt is a good inspiration

democracy-poll/democracy.php 85% from 13 tests

"Democracy Poll" version 5.6.0's main PHP file describes plugin functionality and also serves as the entry point to any WordPress functionality
The following require your attention:
  • Requires at least: The required version number must match the one declared in readme.txt ("3.6" instead of "4.6")
  • Main file name: Even though not officially enforced, the main plugin file should be the same as the plugin slug ("democracy-poll.php" instead of "democracy.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | There should be no dangerous file extensions present in any WordPress plugin
No dangerous file extensions were detected8,336 lines of code in 70 files:
LanguageFilesBlank linesComment linesLines of code
PHP181,2701,4024,173
CSS282201101,842
PO File26431,1501,186
JavaScript5231131665
SVG1700470

PHP code Passed 2 tests

An short overview of logical lines of code, cyclomatic complexity, and other code metrics
No complexity issues detected
Cyclomatic complexity
Average complexity per logical line of code0.51
Average class complexity55.91
▷ Minimum class complexity1.00
▷ Maximum class complexity161.00
Average method complexity4.15
▷ Minimum method complexity1.00
▷ Maximum method complexity28.00
Code structure
Namespaces1
Interfaces0
Traits0
Classes11
▷ Abstract classes00.00%
▷ Concrete classes11100.00%
▷ Final classes00.00%
Methods157
▷ Static methods3421.66%
▷ Public methods12478.98%
▷ Protected methods106.37%
▷ Private methods2314.65%
Functions52
▷ Named functions3465.38%
▷ Anonymous functions1834.62%
Constants10
▷ Global constants440.00%
▷ Class constants660.00%
▷ Public constants6100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
7 PNG files occupy 0.11MB with 0.03MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
admin/css/images/ui-icons_cc0000_256x240.png4.44KB4.17KB▼ 6.02%
admin/css/images/ui-icons_555555_256x240.png6.82KB4.17KB▼ 38.82%
admin/country_flags/flags.png78.01KB25.86KB▼ 66.85%
admin/css/images/ui-icons_777620_256x240.png4.44KB4.17KB▼ 6.02%
admin/css/images/ui-icons_777777_256x240.png6.83KB4.17KB▼ 38.92%