diff --git a/.distignore b/.distignore index 7dacb1d..f242837 100644 --- a/.distignore +++ b/.distignore @@ -4,7 +4,6 @@ /.wordpress-org /node_modules /tests -/vendor # Files to ignore /.* diff --git a/.gitattributes b/.gitattributes index 541a824..0324b53 100644 --- a/.gitattributes +++ b/.gitattributes @@ -2,7 +2,6 @@ /.wordpress-org export-ignore /node_modules export-ignore /tests export-ignore -/vendor export-ignore /.* export-ignore /CHANGELOG.md export-ignore diff --git a/.github/workflows/build-release-zip.yml b/.github/workflows/build-release-zip.yml index ffdb3b6..597a51b 100644 --- a/.github/workflows/build-release-zip.yml +++ b/.github/workflows/build-release-zip.yml @@ -35,11 +35,21 @@ jobs: if: steps.cache-node-modules.outputs.cache-hit != 'true' run: npm ci --no-optional + - name: Install Composer dependencies and dump autoload + run: | + composer install --no-dev --optimize-autoloader + composer dump-autoload + - name: Build plugin run: | npm run build + - name: Install SVN + run: | + sudo apt-get update + sudo apt-get install subversion + - name: Generate ZIP file uses: 10up/action-wordpress-plugin-build-zip@stable env: - SLUG: mailchimp + SLUG: mailchimp \ No newline at end of file diff --git a/.github/workflows/wordpress-plugin-asset-update.yml b/.github/workflows/wordpress-plugin-asset-update.yml index c923dd2..da145a7 100644 --- a/.github/workflows/wordpress-plugin-asset-update.yml +++ b/.github/workflows/wordpress-plugin-asset-update.yml @@ -20,6 +20,11 @@ jobs: node-version-file: .nvmrc cache: npm + - name: Install Composer dependencies and dump autoload + run: | + composer install --no-dev --optimize-autoloader + composer dump-autoload + - name: Build run: | npm ci --no-optional diff --git a/.github/workflows/wordpress-plugin-deploy.yml b/.github/workflows/wordpress-plugin-deploy.yml index b37771b..903301a 100644 --- a/.github/workflows/wordpress-plugin-deploy.yml +++ b/.github/workflows/wordpress-plugin-deploy.yml @@ -8,6 +8,7 @@ jobs: tag: name: New release runs-on: ubuntu-latest + if: ${{ !github.event.release.prerelease }} # Skip job if it is a pre-release steps: - name: Checkout code @@ -19,6 +20,11 @@ jobs: node-version-file: '.nvmrc' cache: 'npm' + - name: Install Composer dependencies and dump autoload + run: | + composer install --no-dev --optimize-autoloader + composer dump-autoload + - name: Build run: | npm ci --no-optional @@ -34,12 +40,11 @@ jobs: SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }} SLUG: mailchimp - - name: Upload release asset - uses: actions/upload-release-asset@v1.0.2 + - name: Attach the wordpress.org plugin files to the Github release + uses: softprops/action-gh-release@v2 + with: + files: ${{ steps.deploy.outputs.zip-path }} + body: | + This release contains the latest updates for the WordPress plugin. env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ github.event.release.upload_url }} - asset_path: ${{ steps.deploy.outputs.zip-path }} - asset_name: mailchimp.zip - asset_content_type: application/zip diff --git a/.gitignore b/.gitignore index 62369c7..10f5851 100644 --- a/.gitignore +++ b/.gitignore @@ -14,3 +14,6 @@ tests/cypress/reports tests/cypress/downloads mailchimp.zip + +# IDE +.vscode \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index e0419ce..6c1739e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,28 @@ All notable changes to this project will be documented in this file, per [the Ke ## [Unreleased] - TBD +## [1.6.3] - 2025-01-30 +### Added +- Transform the `mailchimp_sf_shortcode` shortcode to the Mailchimp List Subscribe Form block (props [@MaxwellGarceau](https://github.com/MaxwellGarceau), [@jeffpaul](https://github.com/jeffpaul), [@dkotter](https://github.com/dkotter), [@qasumitbagthariya](https://github.com/qasumitbagthariya) via [#84](https://github.com/mailchimp/wordpress/pull/84)). + +### Removed +- Deprecated Sopresto code (props [@MaxwellGarceau](https://github.com/MaxwellGarceau), [@jeffpaul](https://github.com/jeffpaul), [@dkotter](https://github.com/dkotter) via [#98](https://github.com/mailchimp/wordpress/pull/98)). + +### Fixed +- Fatal PHP error that would occur when the phone merge field was set to US format, but the merge field was not included in the Mailchimp plugin (props [@MaxwellGarceau](https://github.com/MaxwellGarceau), [@jeffpaul](https://github.com/jeffpaul), [@dkotter](https://github.com/dkotter), [@qasumitbagthariya](https://github.com/qasumitbagthariya) via [#108](https://github.com/mailchimp/wordpress/pull/108)). +- Bug causing merge fields on the Mailchimp WP admin page to incorrectly display as not required when they were, in fact, required (props [@MaxwellGarceau](https://github.com/MaxwellGarceau), [@jeffpaul](https://github.com/jeffpaul), [@dkotter](https://github.com/dkotter), [@qasumitbagthariya](https://github.com/qasumitbagthariya) via [#109](https://github.com/mailchimp/wordpress/pull/109)). +- Fix an issue that allows a user to select merge fields that were not selected as visible in the Mailchimp account (props [@MaxwellGarceau](https://github.com/MaxwellGarceau), [@jeffpaul](https://github.com/jeffpaul), [@dkotter](https://github.com/dkotter), [@qasumitbagthariya](https://github.com/qasumitbagthariya) via [#110](https://github.com/mailchimp/wordpress/pull/110)). +- Bug causing all new subscribers to receive a double opt-in email (props Nathan Tetzlaff, [@MaxwellGarceau](https://github.com/MaxwellGarceau), [@jeffpaul](https://github.com/jeffpaul), [@dkotter](https://github.com/dkotter), [@qasumitbagthariya](https://github.com/qasumitbagthariya) via [#115](https://github.com/mailchimp/wordpress/pull/115)). +- Bug causing contacts with any Mailchimp status (subscribed, unsubscribed, pending, etc.) to be able to submit the sign-up form even if "Update Existing Subscriber?" was disabled (props [@MaxwellGarceau](https://github.com/MaxwellGarceau), [@jeffpaul](https://github.com/jeffpaul), [@dkotter](https://github.com/dkotter), [@qasumitbagthariya](https://github.com/qasumitbagthariya) via [#115](https://github.com/mailchimp/wordpress/pull/115)). +- Pending contacts will now still be required to confirm their original confirmation email if they try to update their contact while "Update Existing Subscribers?" and "Double Opt-in" are both enabled (props [@MaxwellGarceau](https://github.com/MaxwellGarceau), [@jeffpaul](https://github.com/jeffpaul), [@dkotter](https://github.com/dkotter), [@qasumitbagthariya](https://github.com/qasumitbagthariya) via [#115](https://github.com/mailchimp/wordpress/pull/115)). + +### Security +- Bump `nanoid` from 3.3.7 to 3.3.8 (props [@dependabot](https://github.com/apps/dependabot), [@iamdharmesh](https://github.com/iamdharmesh) via [#111](https://github.com/mailchimp/wordpress/pull/111)). + +### Developer +- Add autoloading using composer (props [@MaxwellGarceau](https://github.com/MaxwellGarceau), [@jeffpaul](https://github.com/jeffpaul), [@dkotter](https://github.com/dkotter), [@qasumitbagthariya](https://github.com/qasumitbagthariya) via [#95](https://github.com/mailchimp/wordpress/pull/95)). +- Updated GitHub Action step for generating the release assets (props [@MaxwellGarceau](https://github.com/MaxwellGarceau), [@jeffpaul](https://github.com/jeffpaul), [@dkotter](https://github.com/dkotter) via [#97](https://github.com/mailchimp/wordpress/pull/97)). + ## [1.6.2] - 2024-11-12 **Note that this release bumps the WordPress minimum version from 6.1 to 6.3.** @@ -192,6 +214,7 @@ All notable changes to this project will be documented in this file, per [the Ke - Security and various other improvements [Unreleased]: https://github.com/mailchimp/wordpress/compare/main...develop +[1.6.3]: https://github.com/mailchimp/wordpress/compare/1.6.2...1.6.3 [1.6.2]: https://github.com/mailchimp/wordpress/compare/1.6.1...1.6.2 [1.6.1]: https://github.com/mailchimp/wordpress/compare/1.6.0...1.6.1 [1.6.0]: https://github.com/mailchimp/wordpress/tree/1.6.0 diff --git a/CREDITS.md b/CREDITS.md index 5d1bb25..4e7da9b 100644 --- a/CREDITS.md +++ b/CREDITS.md @@ -12,7 +12,7 @@ The following individuals are responsible for curating the list of issues, respo Thank you to all the people who have already contributed to this repository via bug reports, code, design, ideas, project management, translation, testing, etc. -[Mailchimp (@mailchimp)](https://github.com/mailchimp), [Crowd Favorite (@crowdfavorite)](https://github.com/crowdfavorite), [Matthew Richmond (@bigdawggi)](https://github.com/bigdawggi), [Devin Reams (@devinreams)](https://github.com/devinreams), [Alex King (@alexkingorg)](https://github.com/alexkingorg), [Jesse (@jessedp)](https://github.com/jessedp), [Andrew Ellis](awellis@me.com), [Evan Anderson (@ejdanderson)](https://github.com/ejdanderson), [Webb Henderson (@emerywebster)](https://github.com/emerywebster), [Steven Mathias (@ssmathias)](https://github.com/ssmathias), [Jonathan D. Johnson (@jondavidjohn)](https://github.com/jondavidjohn), [Ross Tweedie (@digitales)](https://github.com/digitales), [(@mcwill)](https://github.com/mcwill), [Andrew Austin (@andrewjaustin)](https://github.com/andrewjaustin), [Marc Queralt i Bassa (@MarcQueralt)](https://github.com/MarcQueralt), [Chris Mospaw (@mospaw)](https://github.com/mospaw), [Jonas Stensved (@jstensved)](https://github.com/jstensved), [netboy](netboy@netboy.pl), [Lenin](lenin@tasawr.com), [Bauke Zwaan (@baukezwaan)](https://github.com/baukezwaan), [Jascha Ehrenreich (@jaeh)](https://github.com/jaeh), [Chris Wilcoxson (@slushman)](https://github.com/slushman), [Luke Watts (@thisislawatts)](https://github.com/thisislawatts), [Glenn Ansley (@glennansley)](https://github.com/glennansley), [SiteGround](http://www.siteground.com/wordpress-hosting.htm), [Peter Kahoun](http://kahi.cz/), [Jan Lund](), [Michael Jaekel](), [Ιωάννης Δημοφέρλιας (John Dimoferlias)](), [Tomás Nader](), [Claudia Mansilla](http://cricava.com/), [Helen Urbanik](http://www.motomaania.ee/), [Maxime Toulliou](http://www.maximetoulliou.com/), [שגיב בית](http://www.sagive.co.il), [Okostobi](), [Stefan Des](http://www.stefandes.com), [백선기 (SK Baek)](), [Alexander Roterud aka Defrag](http://www.tigerpews.com), [Filip Stas](http://suddenelfilio.net/), [Maria Manoela Porto](), [Tiago Faria](http://xroot.org), [Alexandru Armin Roșu](), [Илья](http://fatcow.com), [Sebastian Johnsson](http://www.agiley.se/), [Hakan E.](http://kazancexpert.com/), [Josh Grosser (@jgrosser-intuit)](https://github.com/jgrosser-intuit), [10up (@10up)](https://github.com/10up), [Nate Conley (@nateconley)](https://github.com/nateconley), [Darin Kotter (@dkotter)](https://github.com/dkotter), [Jeffrey Paul (@jeffpaul)](https://github.com/jeffpaul), [Eddie Shrake (@eddieshrake)](https://github.com/eddieshrake), [Sumit Bagthariya (@qasumitbagthariya)](https://github.com/qasumitbagthariya), [Vikram Moparthy (@vikrampm1)](https://github.com/vikrampm1), [Dharmesh Patel (@iamdharmesh)](https://github.com/iamdharmesh), [GitHub Dependabot (@dependabot)](https://github.com/apps/dependabot), [Jer Clarke (@jerclarke)](https://github.com/jerclarke). +[Mailchimp (@mailchimp)](https://github.com/mailchimp), [Crowd Favorite (@crowdfavorite)](https://github.com/crowdfavorite), [Matthew Richmond (@bigdawggi)](https://github.com/bigdawggi), [Devin Reams (@devinreams)](https://github.com/devinreams), [Alex King (@alexkingorg)](https://github.com/alexkingorg), [Jesse (@jessedp)](https://github.com/jessedp), [Andrew Ellis](awellis@me.com), [Evan Anderson (@ejdanderson)](https://github.com/ejdanderson), [Webb Henderson (@emerywebster)](https://github.com/emerywebster), [Steven Mathias (@ssmathias)](https://github.com/ssmathias), [Jonathan D. Johnson (@jondavidjohn)](https://github.com/jondavidjohn), [Ross Tweedie (@digitales)](https://github.com/digitales), [(@mcwill)](https://github.com/mcwill), [Andrew Austin (@andrewjaustin)](https://github.com/andrewjaustin), [Marc Queralt i Bassa (@MarcQueralt)](https://github.com/MarcQueralt), [Chris Mospaw (@mospaw)](https://github.com/mospaw), [Jonas Stensved (@jstensved)](https://github.com/jstensved), [netboy](netboy@netboy.pl), [Lenin](lenin@tasawr.com), [Bauke Zwaan (@baukezwaan)](https://github.com/baukezwaan), [Jascha Ehrenreich (@jaeh)](https://github.com/jaeh), [Chris Wilcoxson (@slushman)](https://github.com/slushman), [Luke Watts (@thisislawatts)](https://github.com/thisislawatts), [Glenn Ansley (@glennansley)](https://github.com/glennansley), [SiteGround](http://www.siteground.com/wordpress-hosting.htm), [Peter Kahoun](http://kahi.cz/), [Jan Lund](), [Michael Jaekel](), [Ιωάννης Δημοφέρλιας (John Dimoferlias)](), [Tomás Nader](), [Claudia Mansilla](http://cricava.com/), [Helen Urbanik](http://www.motomaania.ee/), [Maxime Toulliou](http://www.maximetoulliou.com/), [שגיב בית](http://www.sagive.co.il), [Okostobi](), [Stefan Des](http://www.stefandes.com), [백선기 (SK Baek)](), [Alexander Roterud aka Defrag](http://www.tigerpews.com), [Filip Stas](http://suddenelfilio.net/), [Maria Manoela Porto](), [Tiago Faria](http://xroot.org), [Alexandru Armin Roșu](), [Илья](http://fatcow.com), [Sebastian Johnsson](http://www.agiley.se/), [Hakan E.](http://kazancexpert.com/), [Josh Grosser (@jgrosser-intuit)](https://github.com/jgrosser-intuit), [10up (@10up)](https://github.com/10up), [Nate Conley (@nateconley)](https://github.com/nateconley), [Darin Kotter (@dkotter)](https://github.com/dkotter), [Jeffrey Paul (@jeffpaul)](https://github.com/jeffpaul), [Eddie Shrake (@eddieshrake)](https://github.com/eddieshrake), [Sumit Bagthariya (@qasumitbagthariya)](https://github.com/qasumitbagthariya), [Vikram Moparthy (@vikrampm1)](https://github.com/vikrampm1), [Dharmesh Patel (@iamdharmesh)](https://github.com/iamdharmesh), [GitHub Dependabot (@dependabot)](https://github.com/apps/dependabot), [Jer Clarke (@jerclarke)](https://github.com/jerclarke), [Max Garceau (@MaxwellGarceau)](https://github.com/MaxwellGarceau), [Nathan Tetzlaff](). ## Libraries diff --git a/composer.json b/composer.json index 2f2b77a..9965490 100644 --- a/composer.json +++ b/composer.json @@ -18,6 +18,14 @@ "10up/phpcs-composer": "^3.0", "sirbrillig/phpcs-changed": "^2.11" }, + "autoload": { + "psr-4": { + "Mailchimp\\WordPress\\": "src/" + }, + "classmap": [ + "includes" + ] + }, "config": { "allow-plugins": { "dealerdirect/phpcodesniffer-composer-installer": true @@ -26,4 +34,4 @@ "scripts": { "lint": "phpcs --standard=./phpcs.xml -p -s ." } -} +} \ No newline at end of file diff --git a/includes/blocks/mailchimp/index.js b/includes/blocks/mailchimp/index.js index 98b1f18..3538f28 100644 --- a/includes/blocks/mailchimp/index.js +++ b/includes/blocks/mailchimp/index.js @@ -6,6 +6,17 @@ import Icon from './icon'; registerBlockType(metadata, { icon: Icon, + transforms: { + from: [ + { + type: 'shortcode', + tag: 'mailchimpsf_form', + attributes: { + // No attributes, but attributes property is required + }, + }, + ], + }, edit: BlockEdit, save: () => null, }); diff --git a/mailchimp.php b/mailchimp.php index f9870e5..34464dc 100644 --- a/mailchimp.php +++ b/mailchimp.php @@ -4,7 +4,7 @@ * Plugin URI: https://mailchimp.com/help/connect-or-disconnect-list-subscribe-for-wordpress/ * Description: Add a Mailchimp signup form block, widget or shortcode to your WordPress site. * Text Domain: mailchimp - * Version: 1.6.2 + * Version: 1.6.3 * Requires at least: 6.3 * Requires PHP: 7.0 * PHP tested up to: 8.3 @@ -34,8 +34,38 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ +// Check if the autoload file exists +if ( is_readable( __DIR__ . '/vendor/autoload.php' ) ) { + require_once __DIR__ . '/vendor/autoload.php'; +} else { + add_action( + 'admin_notices', + function () { + ?> +
+ composer install, 2: Support URL, e.g., https://wordpress.org/support/plugin/mailchimp/. */
+ __( 'The composer autoload file is not found or not readable. Please contact support if you\'re a user. Please run %1$s if you\'re a developer in a development environment.', 'mailchimp' ),
+ 'composer install
',
+ 'https://wordpress.org/support/plugin/mailchimp/'
+ )
+ );
+ ?>
+