10% nmedia-mailchimp-widget

Code Review | N-Media MailChimp Subscription

WordPress plugin N-Media MailChimp Subscription scored10%from 54 tests.

About plugin

  • Plugin page: nmedia-mailchimp-...
  • Plugin version: 5.4
  • PHP version: 7.4.16
  • WordPress compatibility: 3.0-5.7
  • WordPress version: 6.3.1
  • First release: Jul 19, 2011
  • Latest release: Mar 16, 2021
  • Number of updates: 234
  • Update frequency: every 15.1 days
  • Top authors: nmedia (100%)

Code review

54 tests

User reviews

13 reviews

Install metrics

600+ active /74,484 total downloads

Benchmarks

Plugin footprint 23% from 16 tests

Installer 0% from 1 test

🔺 Critical test (weight: 50) | It is important to correctly install your plugin, without throwing errors or notices
You still need to fix the following installer errors
  • Install procedure had errors
    • > Deprecated in wp-content/plugins/nmedia-mailchimp-widget/classes/plugin.class.php+938
    Methods with the same name as their class will not be constructors in a future version of PHP; NMMailChimp_Widget has a deprecated constructor

Server metrics [RAM: ▼1.68MB] [CPU: ▼54.13ms] Passed 4 tests

Analyzing server-side resources used by N-Media MailChimp Subscription
This plugin has minimal impact on server resources
PageMemory (MB)CPU Time (ms)
Home /2.31 ▼1.155.37 ▼39.69
Dashboard /wp-admin2.33 ▼0.977.89 ▼42.34
Posts /wp-admin/edit.php2.33 ▼1.037.08 ▼40.43
Add New Post /wp-admin/post-new.php2.33 ▼3.568.94 ▼94.05
Media Library /wp-admin/upload.php2.33 ▼0.907.43 ▼26.32
Form Designer /wp-admin/admin.php?page=nm_mailchimp_form_designer2.336.26
Mailchimp Campaign /wp-admin/admin.php?page=nm_mailchimp2.337.08
Lists, Vars & Grouping /wp-admin/admin.php?page=nm_mailchimp_lists2.336.55
Campaign Manager /wp-admin/admin.php?page=nm_mailchimp_campaigns2.336.42
Subscription Forms /wp-admin/admin.php?page=nm_mailchimp_forms2.337.25

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

Input-output and database impact of this plugin
No storage issues were detected
Filesystem: 106 new files
Database: 1 new table, 10 new options
New tables
wp_mc_forms
New WordPress options
nm_mailchimp_hashcode
nm_mc_db_version
theysaidso_admin_options
widget_theysaidso_widget
db_upgraded
widget_recent-posts
widget_recent-comments
nm_mailchimp_apikey
widget_nmmailchimp_widget
can_compress_scripts

Browser metrics Passed 4 tests

This is an overview of browser requirements for N-Media MailChimp Subscription
There were no issues detected in relation to browser resource usage
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,934 ▲17313.85 ▼0.5010.47 ▲8.7043.05 ▼2.37
Dashboard /wp-admin2,217 ▲395.50 ▼0.2286.95 ▼24.2173.05 ▲27.94
Posts /wp-admin/edit.php2,137 ▲371.95 ▼0.0536.55 ▼2.4535.34 ▲0.16
Add New Post /wp-admin/post-new.php1,568 ▲4023.10 ▼0.10654.39 ▼40.53130.01 ▲78.35
Media Library /wp-admin/upload.php1,425 ▲254.22 ▲0.10110.57 ▼1.5180.36 ▲36.59
Form Designer /wp-admin/admin.php?page=nm_mailchimp_form_designer1,9415.54131.7893.30
Mailchimp Campaign /wp-admin/admin.php?page=nm_mailchimp1,4783.5750.27100.33
Lists, Vars & Grouping /wp-admin/admin.php?page=nm_mailchimp_lists1,7544.73108.1969.89
Campaign Manager /wp-admin/admin.php?page=nm_mailchimp_campaigns1,8824.2277.3579.18
Subscription Forms /wp-admin/admin.php?page=nm_mailchimp_forms1,1143.9159.4864.14

Uninstaller [IO: ▲0.00MB] [DB: ▲0.00MB] 25% 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
  • This plugin cannot be uninstalled
    • > Deprecated in wp-content/plugins/nmedia-mailchimp-widget/classes/plugin.class.php+938
    Methods with the same name as their class will not be constructors in a future version of PHP; NMMailChimp_Widget has a deprecated constructor
  • The plugin did not uninstall successfully, leaving 1 table in the database
    • wp_mc_forms
  • Zombie WordPress options detected upon uninstall: 10 options
    • widget_theysaidso_widget
    • can_compress_scripts
    • widget_nmmailchimp_widget
    • widget_recent-posts
    • db_upgraded
    • nm_mc_db_version
    • nm_mailchimp_hashcode
    • nm_mailchimp_apikey
    • widget_recent-comments
    • theysaidso_admin_options

Smoke tests 25% from 4 tests

Server-side errors 0% from 1 test

🔹 Test weight: 20 | A shallow check that no server-side errors were triggered
These server-side errors were triggered
  • 8 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=nm_mailchimp_forms
    • > Deprecated in wp-content/plugins/nmedia-mailchimp-widget/classes/plugin.class.php+938
    Methods with the same name as their class will not be constructors in a future version of PHP; NMMailChimp_Widget has a deprecated constructor
  • 7 occurences, only the last one shown
    • > GET request to /wp-admin/admin.php?page=nm_mailchimp
    • > Notice in wp-content/plugins/nmedia-mailchimp-widget/templates/admin/settings.php+67
    Trying to access array offset on value of type bool
    • > GET request to /wp-admin/admin.php?page=nm_mailchimp_lists
    • > Notice in wp-content/plugins/nmedia-mailchimp-widget/classes/plugin.class.php+231
    Trying to get property 'lists' of non-object
    • > GET request to /wp-admin/admin.php?page=nm_mailchimp_lists
    • > Error in wp-content/plugins/nmedia-mailchimp-widget/classes/plugin.class.php+231
    Uncaught Error: Call to a member function getList() on null in wp-content/plugins/nmedia-mailchimp-widget/classes/plugin.class.php:231
    Stack trace:
    #0 wp-includes/class-wp-hook.php(310): NMMailChimp->get_mc_list()
    #1 wp-includes/class-wp-hook.php(334): WP_Hook->apply_filters()
    #2 wp-includes/plugin.php(517): WP_Hook->do_action()
    #3 wp-admin/admin-ajax.php(188): do_action()
    #4 {main}
    thrown
    • > GET request to /wp-admin/admin.php?page=nm_mailchimp_campaigns
    • > Notice in wp-content/plugins/nmedia-mailchimp-widget/classes/plugin.class.php+365
    Trying to get property 'campaigns' of non-object
    • > GET request to /wp-admin/admin.php?page=nm_mailchimp_campaigns
    • > Error in wp-content/plugins/nmedia-mailchimp-widget/classes/plugin.class.php+365
    Uncaught Error: Call to a member function getList() on null in wp-content/plugins/nmedia-mailchimp-widget/classes/plugin.class.php:365
    Stack trace:
    #0 wp-includes/class-wp-hook.php(310): NMMailChimp->get_mc_campaigns_lists()
    #1 wp-includes/class-wp-hook.php(334): WP_Hook->apply_filters()
    #2 wp-includes/plugin.php(517): WP_Hook->do_action()
    #3 wp-admin/admin-ajax.php(188): do_action()
    #4 {main}
    thrown

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
  • 29× PHP files trigger errors when accessed directly with GET requests (only 10 are shown):
    • > PHP Notice
      Trying to get property 'plugin_meta' of non-object in wp-content/plugins/nmedia-mailchimp-widget/templates/admin/campaigns.php on line 11
    • > PHP Fatal error
      Uncaught Error: Call to undefined function get_option() in wp-content/plugins/nmedia-mailchimp-widget/templates/render.subscription-old.php:5
    • > PHP Fatal error
      Uncaught Error: Call to undefined function _e() in wp-content/plugins/nmedia-mailchimp-widget/templates/admin/campaigns.php:18
    • > PHP Fatal error
      Uncaught Error: Call to undefined function _e() in wp-content/plugins/nmedia-mailchimp-widget/templates/admin/lists.php:37
    • > PHP Notice
      Trying to get property 'lists' of non-object in wp-content/plugins/nmedia-mailchimp-widget/templates/admin/mailchimp-lists.php on line 6
    • > PHP Fatal error
      Uncaught Error: Call to undefined function untrailingslashit() in wp-content/plugins/nmedia-mailchimp-widget/index.php:15
    • > PHP Notice
      Trying to access array offset on value of type null in wp-content/plugins/nmedia-mailchimp-widget/templates/admin/campaigns.php on line 12
    • > PHP Fatal error
      Uncaught Error: Using $this when not in object context in wp-content/plugins/nmedia-mailchimp-widget/templates/admin/settings.php:7
    • > PHP Fatal error
      require(): Failed opening required 'NMMC_PATH/lib/mailchimp/vendor/autoload.php' (include_path='.:/usr/share/php') in wp-content/plugins/nmedia-mailchimp-widget/classes/plugin.class.php on line 6
    • > PHP Notice
      Trying to get property 'lists' of non-object in wp-content/plugins/nmedia-mailchimp-widget/templates/admin/woo-lists.php on line 6

User-side errors 0% from 1 test

🔹 Test weight: 20 | A shallow check that no browser errors were triggered
There are user-side issues you should fix
    • > GET request to /wp-admin/admin.php?page=nm_mailchimp
    • > Network (severe)
    wp-content/plugins/nmedia-mailchimp-widget/js/chosen/chosen.min.css?ver=6.3.1 - Failed to load resource: the server responded with a status of 404 (Not Found)
    • > GET request to /wp-admin/admin.php?page=nm_mailchimp
    • > Network (severe)
    wp-content/plugins/nmedia-mailchimp-widget/js/chosen/chosen.jquery.min.js?ver=4 - Failed to load resource: the server responded with a status of 404 (Not Found)
    • > GET request to /wp-admin/admin.php?page=nm_mailchimp
    • > Console-api (warning) in unknown
    /wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils,moxiejs,plupload&ver=6.3.1 1:28609 "jQuery.Deferred exception: $(...).chosen is not a function" "TypeError: $(...).chosen is not a function\n at HTMLDocument.\u003Canonymous> (/wp-content/plugins/nmedia-mailchimp-widget/js/admin.js?ver=4:28:22)\n at e (/wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils,moxiejs,plupload&ver=6.3.1:2:26990)\n at t (/wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils,moxiejs,plupload&ver=6.3.1:2:27292)" undefined
    • > GET request to /wp-admin/admin.php?page=nm_mailchimp
    • > Javascript (severe) in unknown
    /wp-admin/load-scripts.php?c=0&load%5Bchunk_0%5D=jquery-core,jquery-migrate,utils,moxiejs,plupload&ver=6.3.1 1:28721 Uncaught TypeError: $(...).chosen is not a function
    • > GET request to /wp-admin/admin.php?page=nm_mailchimp_lists
    • > Network (severe)
    wp-admin/admin-ajax.php?action=nm_mailchimp_get_mc_list - Failed to load resource: the server responded with a status of 500 (Internal Server Error)
    • > GET request to /wp-admin/admin.php?page=nm_mailchimp_campaigns
    • > Javascript (severe) in unknown
    /wp-admin/admin.php?page=nm_mailchimp_campaigns 669:39 Uncaught TypeError: jQuery(...).live is not a function
    • > GET request to /wp-admin/admin.php?page=nm_mailchimp_campaigns
    • > Network (severe)
    wp-admin/admin-ajax.php?action=nm_mailchimp_get_mc_campaigns_lists - Failed to load resource: the server responded with a status of 500 (Internal Server Error)

Optimizations

Plugin configuration 90% from 29 tests

readme.txt 94% from 16 tests

Often overlooked, readme.txt is one of the most important files in your plugin
Attributes that require attention: The official readme.txt might help

nmedia-mailchimp-widget/index.php 85% from 13 tests

"N-Media MailChimp Subscription" version 5.4's main PHP file describes plugin functionality and also serves as the entry point to any WordPress functionality
Please make the necessary changes and fix the following:
  • Text Domain: If you choose to specify the text domain, it must be the same as the plugin slug; optional since WordPress version 4.6
  • Main file name: It is recommended to name the main PHP file as the plugin slug ("nmedia-mailchimp-widget.php" instead of "index.php")

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | This is a short overview of programming languages used in this plugin, detecting executable files
Success! There were no dangerous files found in this plugin9,091 lines of code in 72 files:
LanguageFilesBlank linesComment linesLines of code
PHP441,6353,1424,707
PO File56388101,634
CSS7125831,562
JavaScript7200192585
Markdown31630387
HTML3330138
JSON32078

PHP code Passed 2 tests

A short review of cyclomatic complexity and code structure
This plugin has no cyclomatic complexity problems
Cyclomatic complexity
Average complexity per logical line of code0.25
Average class complexity3.40
▷ Minimum class complexity1.00
▷ Maximum class complexity70.00
Average method complexity2.07
▷ Minimum method complexity1.00
▷ Maximum method complexity38.00
Code structure
Namespaces2
Interfaces0
Traits0
Classes120
▷ Abstract classes00.00%
▷ Concrete classes120100.00%
▷ Final classes00.00%
Methods268
▷ Static methods93.36%
▷ Public methods25996.64%
▷ Protected methods00.00%
▷ Private methods93.36%
Functions6
▷ Named functions6100.00%
▷ Anonymous functions00.00%
Constants2
▷ Global constants2100.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
18 PNG files occupy 0.05MB with 0.02MB in potential savings
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
js/ui/css/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png0.26KB0.15KB▼ 42.37%
images/down_32.png4.15KB1.42KB▼ 65.73%
js/ui/css/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png0.21KB0.08KB▼ 58.96%
js/ui/css/smoothness/images/ui-icons_2e83ff_256x240.png4.44KB4.17KB▼ 6.02%
js/ui/css/smoothness/images/ui-icons_222222_256x240.png6.76KB4.17KB▼ 38.24%