78% mg-donations

Code Review | mg Donations

WordPress plugin mg Donations scored78%from 54 tests.

About plugin

  • Plugin page: mg-donations
  • Plugin version: 1.1
  • PHP version: 7.4.16
  • WordPress compatibility: 3.1-3.9.2
  • WordPress version: 6.3.1
  • First release: Aug 23, 2014
  • Latest release: Aug 26, 2014
  • Number of updates: 3
  • Update frequency: every 1.3 days
  • Top authors: giuliom (100%)

Code review

54 tests

User reviews

1 review

Install metrics

10+ active /623 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | All plugins must install correctly, without throwing any errors, warnings, or notices
The plugin installed gracefully, with no errors

Server metrics [RAM: ▲0.07MB] [CPU: ▼8.68ms] Passed 4 tests

An overview of server-side resources used by mg Donations
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /3.54 ▲0.0838.60 ▲3.11
Dashboard /wp-admin3.39 ▲0.0443.24 ▼18.56
Posts /wp-admin/edit.php3.45 ▲0.0945.83 ▼10.70
Add New Post /wp-admin/post-new.php5.97 ▲0.0888.91 ▼5.65
Media Library /wp-admin/upload.php3.31 ▲0.0832.29 ▲0.21
About /wp-admin/admin.php?page=mg_dn_about3.2728.62
Donation Causes /wp-admin/edit.php?post_type=mg_donation_cause3.3635.11
Donations /wp-admin/edit.php?post_type=mg_donation3.3633.98
Site Info /wp-admin/admin.php?page=mg_dn_site_info3.2728.70
Settings /wp-admin/admin.php?page=mg_dn_settings3.2730.66

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

Analyzing filesystem and database footprints of this plugin
This plugin was installed successfully
Filesystem: 28 new files
Database: no new tables, 8 new options
New WordPress options
mg_dn
widget_recent-comments
widget_recent-posts
can_compress_scripts
widget_mg_dn_widget_donation_cause
theysaidso_admin_options
db_upgraded
widget_theysaidso_widget

Browser metrics Passed 4 tests

mg Donations: an overview of browser usage
Minimal impact on browser resources
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,877 ▲13113.16 ▼1.221.87 ▲0.1439.09 ▼1.03
Dashboard /wp-admin2,250 ▲644.90 ▼0.0398.90 ▼8.1439.13 ▼1.85
Posts /wp-admin/edit.php2,133 ▲412.06 ▲0.0639.17 ▼2.2634.62 ▼0.81
Add New Post /wp-admin/post-new.php1,565 ▲3722.95 ▲4.72570.84 ▼32.0748.71 ▼0.81
Media Library /wp-admin/upload.php1,432 ▲444.24 ▲0.0895.89 ▼2.8841.34 ▼4.70
About /wp-admin/admin.php?page=mg_dn_about8132.0322.5825.82
Donation Causes /wp-admin/edit.php?post_type=mg_donation_cause1,1141.9630.9326.36
Donations /wp-admin/edit.php?post_type=mg_donation1,0872.1032.6227.73
Site Info /wp-admin/admin.php?page=mg_dn_site_info7952.1823.3222.27
Settings /wp-admin/admin.php?page=mg_dn_settings9452.0523.4525.05

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

🔸 Tests weight: 35 | It is important to correctly uninstall your plugin, without leaving any traces
You still need to fix the following
  • Zombie WordPress options were found after uninstall: 7 options
    • widget_recent-comments
    • db_upgraded
    • theysaidso_admin_options
    • widget_theysaidso_widget
    • widget_mg_dn_widget_donation_cause
    • can_compress_scripts
    • widget_recent-posts

Smoke tests 50% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | This is a short smoke test looking for server-side errors
Good news, no errors were detected

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
Almost there! Just fix the following items
  • 4× GET requests to PHP files return non-empty strings:
    • > /wp-content/plugins/mg-donations/mg-dn-templates/buttons/paypal-1.php
    • > /wp-content/plugins/mg-donations/mg-dn-templates/buttons/paypal-3.php
    • > /wp-content/plugins/mg-donations/mg-dn-templates/buttons/paypal-2.php
    • > /wp-content/plugins/mg-donations/mg-dn-templates/buttons/paypal-4.php
  • 5× GET requests to PHP files have triggered server-side errors or warnings:
    • > PHP Fatal error
      Uncaught Error: Call to undefined function esc_html() in wp-content/plugins/mg-donations/mg-dn-templates/buttons/default.php:2
    • > PHP Fatal error
      Uncaught Error: Call to undefined function has_post_thumbnail() in wp-content/plugins/mg-donations/mg-dn-templates/widgets/donation-cause.php:11
    • > PHP Fatal error
      Uncaught Error: Call to undefined function has_post_thumbnail() in wp-content/plugins/mg-donations/mg-dn-templates/shortcodes/donation-cause.php:12
    • > PHP Notice
      Undefined variable: show_title in wp-content/plugins/mg-donations/mg-dn-templates/widgets/donation-cause.php on line 1
    • > PHP Notice
      Undefined variable: show_title in wp-content/plugins/mg-donations/mg-dn-templates/shortcodes/donation-cause.php on line 2

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 90% from 29 tests

readme.txt 94% from 16 tests

The readme.txt file uses markdown syntax to describe your plugin to the world
These attributes need to be fixed:
  • Donate link: Please fix this invalid URI: ""
The official readme.txt might help

mg-donations/plugin.php 85% from 13 tests

This is the main PHP file of "mg Donations" version 1.1, 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:
  • Description: A good plugin description is longer than 10 characters (currently 9 characters long)
  • Main file name: The principal plugin file should be the same as the plugin slug ("mg-donations.php" instead of "plugin.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | Executable files are considered dangerous and should not be included with any WordPress plugin
Good job! No executable or dangerous file extensions detected1,183 lines of code in 27 files:
LanguageFilesBlank linesComment linesLines of code
PHP263411021,176
CSS1477

PHP code Passed 2 tests

Analyzing logical lines of code, cyclomatic complexity, and other code metrics
Everything seems fine, there were no complexity issues found
Cyclomatic complexity
Average complexity per logical line of code0.20
Average class complexity5.11
▷ Minimum class complexity1.00
▷ Maximum class complexity18.00
Average method complexity1.98
▷ Minimum method complexity1.00
▷ Maximum method complexity8.00
Code structure
Namespaces0
Interfaces0
Traits0
Classes19
▷ Abstract classes00.00%
▷ Concrete classes19100.00%
▷ Final classes00.00%
Methods80
▷ Static methods78.75%
▷ Public methods7087.50%
▷ Protected methods00.00%
▷ Private methods1012.50%
Functions2
▷ Named functions2100.00%
▷ Anonymous functions00.00%
Constants3
▷ Global constants00.00%
▷ Class constants3100.00%
▷ Public constants3100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

All PNG images should be compressed to minimize bandwidth usage for end users
There are no PNG files in this plugin