72% newspack-newsletters

Code Review | Newspack Newsletters

WordPress plugin Newspack Newsletters scored72%from 54 tests.

About plugin

  • Plugin page: newspack-newsletters
  • Plugin version: 2.6.0
  • PHP compatiblity: 5.6+
  • PHP version: 7.4.16
  • WordPress compatibility: 5.3-5.9.0
  • WordPress version: 6.3.1
  • First release: Feb 15, 2021
  • Latest release: Nov 27, 2023
  • Number of updates: 109
  • Update frequency: every 10.0 days
  • Top authors: newspack (91.74%)jboydston (9.17%)

Code review

54 tests

User reviews

1 review

Install metrics

1,000+ active /26,657 total downloads

Benchmarks

Plugin footprint 83% from 16 tests

Installer Passed 1 test

🔺 Critical test (weight: 50) | Checking the installer triggered no errors
This plugin's installer ran successfully

Server metrics [RAM: ▲2.49MB] [CPU: ▲14.07ms] Passed 4 tests

A check of server-side resources used by Newspack Newsletters
Server-side resource usage in normal parameters
PageMemory (MB)CPU Time (ms)
Home /5.94 ▲2.4859.43 ▲18.31
Dashboard /wp-admin5.80 ▲2.4665.03 ▲3.88
Posts /wp-admin/edit.php5.88 ▲2.5271.07 ▲21.00
Add New Post /wp-admin/post-new.php8.73 ▲2.84102.40 ▲13.57
Media Library /wp-admin/upload.php5.72 ▲2.4956.43 ▲20.53
Categories /wp-admin/edit-tags.php?taxonomy=category&post_type=newspack_nl_cpt5.7461.79
Tags /wp-admin/edit-tags.php?taxonomy=post_tag&post_type=newspack_nl_cpt5.7250.69
Advertisers /wp-admin/edit-tags.php?taxonomy=newspack_nl_advertiser&post_type=newspack_nl_cpt5.7252.28
Settings /wp-admin/edit.php?post_type=newspack_nl_cpt&page=newspack-newsletters-settings-admin5.7047.23
Ads /wp-admin/edit.php?post_type=newspack_nl_ads_cpt5.8057.54
Tracking /wp-admin/edit.php?post_type=newspack_nl_cpt&page=newspack-newsletters-tracking5.7046.48
All Newsletters /wp-admin/edit.php?post_type=newspack_nl_cpt5.8053.00
Add New /wp-admin/post-new.php?post_type=newspack_nl_cpt8.5099.91

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

Input-output and database impact of this plugin
This plugin installed successfully
Filesystem: 486 new files
Database: no new tables, 12 new options
New WordPress options
newspack_newsletters_has_flushed_rewrite_rules
widget_recent-comments
widget_recent-posts
newspack_newsletters_tracking_click_has_rewrite_rule
newspack_newsletters_tracking_pixel_has_rewrite_rule
can_compress_scripts
theysaidso_admin_options
newspack_newsletters_color_palette
db_upgraded
widget_theysaidso_widget
...

Browser metrics Passed 4 tests

Checking browser requirements for Newspack Newsletters
This plugin renders optimally with no browser resource issues detected
PageNodesMemory (MB)Script (ms)Layout (ms)
Home /2,881 ▲14514.31 ▼0.411.47 ▼0.4639.03 ▼6.73
Dashboard /wp-admin2,284 ▲1045.65 ▼0.0497.67 ▼0.5144.47 ▼3.01
Posts /wp-admin/edit.php2,191 ▲912.02 ▲0.0842.66 ▲2.7236.90 ▼2.01
Add New Post /wp-admin/post-new.php1,714 ▲18216.19 ▼7.00630.37 ▼45.9561.68 ▲10.39
Media Library /wp-admin/upload.php1,489 ▲954.25 ▲0.0598.75 ▼1.2841.88 ▲0.15
Categories /wp-admin/edit-tags.php?taxonomy=category&post_type=newspack_nl_cpt1,5412.3233.0335.39
Tags /wp-admin/edit-tags.php?taxonomy=post_tag&post_type=newspack_nl_cpt1,4052.3129.6131.97
Advertisers /wp-admin/edit-tags.php?taxonomy=newspack_nl_advertiser&post_type=newspack_nl_cpt1,3632.3126.8731.20
Settings /wp-admin/edit.php?post_type=newspack_nl_cpt&page=newspack-newsletters-settings-admin1,0051.9028.4025.16
Ads /wp-admin/edit.php?post_type=newspack_nl_ads_cpt1,3272.1437.9234.26
Tracking /wp-admin/edit.php?post_type=newspack_nl_cpt&page=newspack-newsletters-tracking9131.7727.6824.86
All Newsletters /wp-admin/edit.php?post_type=newspack_nl_cpt1,2922.1835.9632.76
Add New /wp-admin/post-new.php?post_type=newspack_nl_cpt6,77222.921,104.8744.42

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

🔸 Tests weight: 35 | Checking the uninstaller removed all traces of the plugin
The following items require your attention
  • This plugin does not fully uninstall, leaving 13 options in the database
    • category_children
    • db_upgraded
    • theysaidso_admin_options
    • newspack_newsletters_tracking_click_has_rewrite_rule
    • newspack_newsletters_tracking_pixel_log_file
    • widget_recent-comments
    • _newspack_newsletters_lists_migrated
    • widget_recent-posts
    • newspack_newsletters_has_flushed_rewrite_rules
    • newspack_newsletters_tracking_pixel_has_rewrite_rule
    • ...

Smoke tests 25% from 4 tests

Server-side errors Passed 1 test

🔹 Test weight: 20 | A smoke test targeting server-side errors
Everything seems fine, however this is by no means an exhaustive test

SRP 0% 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
  • 96× GET requests to PHP files return non-empty strings (only 10 are shown):
    • > /wp-content/plugins/newspack-newsletters/vendor/campaignmonitor/createsend-php/samples/subscriber/get_history.php
    • > /wp-content/plugins/newspack-newsletters/vendor/campaignmonitor/createsend-php/samples/authentication/auth_with_oauth.php
    • > /wp-content/plugins/newspack-newsletters/vendor/campaignmonitor/createsend-php/samples/campaign/get_opens.php
    • > /wp-content/plugins/newspack-newsletters/vendor/campaignmonitor/createsend-php/samples/campaign/send_preview.php
    • > /wp-content/plugins/newspack-newsletters/vendor/campaignmonitor/createsend-php/samples/client/get_templates.php
    • > /wp-content/plugins/newspack-newsletters/vendor/campaignmonitor/createsend-php/samples/client/suppress.php
    • > /wp-content/plugins/newspack-newsletters/vendor/campaignmonitor/createsend-php/samples/transactional/smart_details.php
    • > /wp-content/plugins/newspack-newsletters/vendor/campaignmonitor/createsend-php/samples/segment/add_rule.php
    • > /wp-content/plugins/newspack-newsletters/vendor/campaignmonitor/createsend-php/samples/campaign/get_unsubscribes.php
    • > /wp-content/plugins/newspack-newsletters/vendor/campaignmonitor/createsend-php/samples/client/set_payg_billing.php
  • 58× PHP files trigger server-side errors or warnings when accessed directly (only 10 are shown):
    • > PHP Fatal error
      require_once(): Failed opening required 'wp-content/plugins/newspack-newsletters/vendor/campaignmonitor/createsend-php/tests/../vendor/autoload.php' (include_path='.:/usr/share/php') in wp-content/plugins/newspack-newsletters/vendor/campaignmonitor/createsend-php/tests/csrest_events_test.php on line 3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function Newspack_Newsletters\\Tracking\\add_action() in wp-content/plugins/newspack-newsletters/includes/tracking/class-data-events.php:18
    • > PHP Notice
      Undefined variable: title in wp-content/plugins/newspack-newsletters/includes/email-template.mjml.php on line 13
    • > PHP Fatal error
      require_once(): Failed opening required 'wp-content/plugins/newspack-newsletters/vendor/campaignmonitor/createsend-php/tests/../vendor/autoload.php' (include_path='.:/usr/share/php') in wp-content/plugins/newspack-newsletters/vendor/campaignmonitor/createsend-php/tests/csrest_lists_test.php on line 3
    • > PHP Warning
      require_once(wp-content/plugins/newspack-newsletters/vendor/campaignmonitor/createsend-php/tests/../vendor/autoload.php): failed to open stream: No such file or directory in wp-content/plugins/newspack-newsletters/vendor/campaignmonitor/createsend-php/tests/csrest_campaigns_test.php on line 3
    • > PHP Warning
      require_once(wp-content/plugins/newspack-newsletters/vendor/campaignmonitor/createsend-php/tests/../vendor/autoload.php): failed to open stream: No such file or directory in wp-content/plugins/newspack-newsletters/vendor/campaignmonitor/createsend-php/tests/csrest_people_test.php on line 3
    • > PHP Fatal error
      Uncaught Error: Call to undefined function add_action() in wp-content/plugins/newspack-newsletters/includes/tracking/class-click.php:20
    • > PHP Notice
      Trying to get property 'DuplicateEmailsInSubmission' of non-object in wp-content/plugins/newspack-newsletters/vendor/campaignmonitor/createsend-php/samples/subscriber/import.php on line 70
    • > PHP Fatal error
      require_once(): Failed opening required 'wp-content/plugins/newspack-newsletters/vendor/campaignmonitor/createsend-php/tests/../vendor/autoload.php' (include_path='.:/usr/share/php') in wp-content/plugins/newspack-newsletters/vendor/campaignmonitor/createsend-php/tests/csrest_template_test.php on line 3
    • > PHP Warning
      require_once(wp-content/plugins/newspack-newsletters/vendor/campaignmonitor/createsend-php/tests/../vendor/autoload.php): failed to open stream: No such file or directory in wp-content/plugins/newspack-newsletters/vendor/campaignmonitor/createsend-php/tests/csrest_journey_emails_test.php on line 3

User-side errors 0% from 1 test

🔹 Test weight: 20 | This is just a short smoke test looking for browser issues
Please fix the following user-side errors
    • > GET request to /wp-admin/post-new.php?post_type=newspack_nl_cpt
    • > Javascript (severe) in unknown
    /wp-includes/js/mediaelement/mediaelement-and-player.min.js?ver=4.2.17 11:21594 Uncaught TypeError: Cannot set properties of undefined (setting 'mejs')
    • > GET request to /wp-admin/post-new.php?post_type=newspack_nl_cpt
    • > Javascript (severe) in unknown
    /wp-includes/js/mediaelement/mediaelement-migrate.min.js?ver=6.3.1 0:13 Uncaught ReferenceError: mejs is not defined
  • 2 occurences, only the last one shown
    • > GET request to /wp-admin/post-new.php?post_type=newspack_nl_cpt
    • > Console-api (warning) in wp-includes/js/dist/blocks.min.js?ver=b5d3b99262dfb659bd26+9:967
    The block \"newspack-newsletters/ad\" is registered with an invalid category \"newspack\".
    • > GET request to /wp-admin/post-new.php?post_type=newspack_nl_cpt
    • > 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: n(...).not(...).filter(...).mediaelementplayer is not a function" "TypeError: n(...).not(...).filter(...).mediaelementplayer is not a function\n at HTMLDocument.initialize (/wp-includes/js/mediaelement/wp-mediaelement.min.js?ver=6.3.1:1:1035)\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/post-new.php?post_type=newspack_nl_cpt
    • > 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: n(...).not(...).filter(...).mediaelementplayer is not a function

Optimizations

Plugin configuration 96% from 29 tests

readme.txt Passed 16 tests

The readme.txt file describes your plugin functionality and requirements and it is parsed to prepare the your plugin's listing
6 plugin tags: mailchimp, constant contact, wordpresscom, newsletters, newspack...

newspack-newsletters/newspack-newsletters.php 92% from 13 tests

The entry point to "Newspack Newsletters" version 2.6.0 is a PHP file that has certain tags in its header comment area
The following require your attention:
  • Domain Path: The domain path points to an invalid folder, "/languages" does not exist

Code Analysis Passed 3 tests

File types Passed 1 test

🔸 Test weight: 35 | A short check of programming languages and file extensions; no executable files are allowed
Everything looks great! No dangerous files found in this plugin22,585 lines of code in 423 files:
LanguageFilesBlank linesComment linesLines of code
PHP2033,4308,93919,269
Markdown41,17101,536
JSON64001,482
JavaScript13112156157
CSS181610123
Bourne Shell14011
Bourne Again Shell1206
SVG1001

PHP code Passed 2 tests

This is a short overview of cyclomatic complexity and code structure for this plugin
No cyclomatic complexity issues were detected for this plugin
Cyclomatic complexity
Average complexity per logical line of code0.32
Average class complexity16.77
▷ Minimum class complexity1.00
▷ Maximum class complexity217.00
Average method complexity2.57
▷ Minimum method complexity1.00
▷ Maximum method complexity67.00
Code structure
Namespaces7
Interfaces2
Traits1
Classes113
▷ Abstract classes1412.39%
▷ Concrete classes9987.61%
▷ Final classes1919.19%
Methods1,021
▷ Static methods30930.26%
▷ Public methods94992.95%
▷ Protected methods00.00%
▷ Private methods727.05%
Functions58
▷ Named functions1525.86%
▷ Anonymous functions4374.14%
Constants67
▷ Global constants3856.72%
▷ Class constants2943.28%
▷ Public constants29100.00%

Plugin size Passed 2 tests

Image compression Passed 2 tests

It is recommended to compress PNG files in your plugin to minimize bandwidth usage
22 compressed PNG files occupy 1.06MB
Potential savings
Compression of 5 random PNG files using pngquant
FileSize - originalSize - compressedSavings
assets/black-tumblr.png0.42KB0.46KB0.00%
assets/white-tiktok.png0.77KB0.85KB0.00%
assets/black-linkedin.png0.49KB0.52KB0.00%
assets/white-facebook.png0.80KB0.88KB0.00%
wporg-assets/banner-772x250.png102.09KB87.45KB▼ 14.34%