diff --git a/.github/workflows/dependency-review.yml b/.github/workflows/dependency-review.yml index 070280083..9aef07465 100644 --- a/.github/workflows/dependency-review.yml +++ b/.github/workflows/dependency-review.yml @@ -1,6 +1,6 @@ # Dependency Review Action # -# This Action will scan dependency manifest files that change as part of a Pull Reqest, surfacing known-vulnerable versions of the packages declared or updated in the PR. Once installed, if the workflow run is marked as required, PRs introducing known-vulnerable packages will be blocked from merging. +# This Action will scan dependency manifest files that change as part of a Pull Request, surfacing known-vulnerable versions of the packages declared or updated in the PR. Once installed, if the workflow run is marked as required, PRs introducing known-vulnerable packages will be blocked from merging. # # Source repository: https://github.com/actions/dependency-review-action # Public documentation: https://docs.github.com/en/code-security/supply-chain-security/understanding-your-software-supply-chain/about-dependency-review#dependency-review-enforcement diff --git a/CHANGELOG.md b/CHANGELOG.md index adc753703..cdd75aaea 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,17 @@ All notable changes to this project will be documented in this file, per [the Ke ## [Unreleased] - TBD +## [2.0.3] - 2024-01-18 +### Added +- New filter, `dt_post_to_pull`, that allows modifying the post to be pulled (props [@leogermani](https://github.com/leogermani), [@peterwilsoncc](https://github.com/peterwilsoncc), [@dkotter](https://github.com/dkotter) via [#1181](https://github.com/10up/distributor/pull/1181)). + +### Fixed +- Ensure the code snippet for keeping the original post date is correct (props [@leogermani](https://github.com/leogermani), [@peterwilsoncc](https://github.com/peterwilsoncc) via [#1160](https://github.com/10up/distributor/pull/1160)). + +### Security +- Bump `tj-actions/changed-files` from 36 to 41 (props [@dependabot[bot]](https://github.com/apps/dependabot), [@peterwilsoncc](https://github.com/peterwilsoncc) via [#1172](https://github.com/10up/distributor/pull/1172)). +- Bump `@wordpress/scripts` from 26.6.0 to 26.19.0 (props [@dependabot[bot]](https://github.com/apps/dependabot), [@iamdharmesh](https://github.com/iamdharmesh) via [#1174](https://github.com/10up/distributor/pull/1174)). + ## [2.0.2] - 2023-11-29 ### Added - New snippet detailing how to disable automatic content updates (props [@dkotter](https://github.com/dkotter), [@peterwilsoncc](https://github.com/peterwilsoncc) via [#1145](https://github.com/10up/distributor/pull/1145)). @@ -14,7 +25,7 @@ All notable changes to this project will be documented in this file, per [the Ke - Bump WordPress "tested up to" version 6.4 (props [@severine-pozzo](https://github.com/severine-pozzo), [@QAharshalkadu](https://github.com/QAharshalkadu), [@jeffpaul](https://github.com/jeffpaul), [@dkotter](https://github.com/dkotter) via [#1151](https://github.com/10up/distributor/pull/1151)). ### Fixed -- Copy the htaccess file when initilizing the E2E test environment (props [@peterwilsoncc](https://github.com/peterwilsoncc), [@theskinnyghost](https://github.com/theskinnyghost), [@dkotter](https://github.com/dkotter) via [#1143](https://github.com/10up/distributor/pull/1143)). +- Copy the htaccess file when initializing the E2E test environment (props [@peterwilsoncc](https://github.com/peterwilsoncc), [@theskinnyghost](https://github.com/theskinnyghost), [@dkotter](https://github.com/dkotter) via [#1143](https://github.com/10up/distributor/pull/1143)). - Prevent early publishing of scheduled posts when pulled internally (props [@peterwilsoncc](https://github.com/peterwilsoncc), [@jeffpaul](https://github.com/jeffpaul), [@dkotter](https://github.com/dkotter), [@maxledoux](https://github.com/maxledoux), [@pcrumm](https://github.com/pcrumm) via [#1156](https://github.com/10up/distributor/pull/1156)). - Avoid a PHP fatal error when pulling content that has previously been pulled into a different network site (props [@dkotter](https://github.com/dkotter), [@jeffpaul](https://github.com/jeffpaul), [@peterwilsoncc](https://github.com/peterwilsoncc) via [#1159](https://github.com/10up/distributor/pull/1159)). @@ -504,6 +515,7 @@ This adds a post type selector when viewing the Pull Content list for both exter - Initial closed release. [Unreleased]: https://github.com/10up/distributor/compare/trunk...develop +[2.0.3]: https://github.com/10up/distributor/compare/2.0.2...2.0.3 [2.0.2]: https://github.com/10up/distributor/compare/2.0.1...2.0.2 [2.0.1]: https://github.com/10up/distributor/compare/2.0.0...2.0.1 [2.0.0]: https://github.com/10up/distributor/compare/1.9.1...2.0.0 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e354e2dfe..d0e76b3f0 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -29,6 +29,6 @@ The `develop` branch is the development branch which means it contains the next ## Release instructions 1. Branch: Starting from `develop`, create a release branch named `release/X.Y.Z` for your changes. -2. Follow pull request checklist: A draft release pull request will be created once you push your branch to Github. Follow the steps in the pull request. +2. Follow pull request checklist: A draft release pull request will be created once you push your branch to GitHub. Follow the steps in the pull request. Should the pull request fail to be created, a pull request can be manually created using the [template file](https://github.com/10up/distributor/blob/develop/.github/release-pull-request-template.md) containing each of the steps. diff --git a/CREDITS.md b/CREDITS.md index f03b1c67a..003c23580 100644 --- a/CREDITS.md +++ b/CREDITS.md @@ -10,7 +10,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. -[10up (@10up)](https://github.com/10up), [Taylor Lovett (@tlovett1)](https://github.com/tlovett1), [Zane Matthew (@zanematthew)](https://github.com/zanematthew), [Aaron Brazell (@technosailor)](https://github.com/technosailor), [Marco Pereirinha (@pereirinha)](https://github.com/pereirinha), [Joshua Abenazer (@joshuaabenazer)](https://github.com/joshuaabenazer), [Adam Silverstein (@adamsilverstein)](https://github.com/adamsilverstein), [Helen Hou-Sandí (@helen)](https://github.com/helen), [Chris Marslender (@cmmarslender)](https://github.com/cmmarslender), [Tom J Nowell (@tomjn)](https://github.com/tomjn), [Tim Nolte (@timnolte)](https://github.com/timnolte), [(@sericgoran)](https://github.com/sericgoran), [Jason Bahl (@jasonbahl)](https://github.com/jasonbahl), [Barry Ceelen (@barryceelen)](https://github.com/barryceelen), [Ryan Welcher (@ryanwelcher)](https://github.com/ryanwelcher), [Ben Greeley (@bengreeley)](https://github.com/bengreeley), [Robbie Trencheny (@robbiet480)](https://github.com/robbiet480), [Jake Goldman (@jakemgold)](https://github.com/jakemgold), [Stephanie Leary (@sillybean)](https://github.com/sillybean), [Darin Kotter (@dkotter)](https://github.com/dkotter), [Echo (@ChaosExAnima)](https://github.com/ChaosExAnima), [Burhan Nasir (@burhandodhy)](https://github.com/burhandodhy), [Rebecca Hum (@rebeccahum)](https://github.com/rebeccahum), [Sean Hayes (@seanchayes)](https://github.com/seanchayes), [Jeremy Felt (@jeremyfelt)](https://github.com/jeremyfelt), [Gago (@madmax3365)](https://github.com/madmax3365), [Ivan Kruchkoff(@)](https://github.com/ivankruchkoff), [Sérgio Santos (@s3rgiosan)](https://github.com/s3rgiosan), [Ravi Chandra (@ravichdev)](https://github.com/ravichdev), [Jay Hoffmann (@JasonHoffmann)](https://github.com/JasonHoffmann), [Arsen Dovlatyan (@arsendovlatyan)](https://github.com/arsendovlatyan), [Jeroen Sormani (@JeroenSormani)](https://github.com/JeroenSormani), [Ritesh Patel (@Ritesh-patel)](https://github.com/Ritesh-patel), [Gary Thayer (@gthayer)](https://github.com/gthayer), [Evan Mattson (@aaemnnosttv)](https://github.com/aaemnnosttv), [Nate Allen (@nate-allen)](https://github.com/nate-allen), [Michael Phillips (@mphillips)](https://github.com/mphillips), [Jay Wood (@JayWood)](https://github.com/JayWood), [Dreb Bits (@drebbits)](https://github.com/drebbits), [Jeffrey Paul (@jeffpaul)](https://github.com/jeffpaul), [Matthew McAchran (@mmcachran)](https://github.com/mmcachran), [Ulrich Pogson (@grappler)](https://github.com/grappler), [(@avag-novembit)](https://github.com/avag-novembit), [Manuel Razzari (@mrazzari)](https://github.com/mrazzari), [Moe Browne (@moebrowne)](https://github.com/moebrowne), [Dave McHale (@dmchale)](https://github.com/dmchale), [Tommy Ferry (@tommyferry)](https://github.com/tommyferry), [Pete Nelson (@petenelson)](https://github.com/petenelson), [Alexander Berthelsen (@lakrisgubben)](https://github.com/lakrisgubben), [John Watkins (@johnwatkins0)](https://github.com/johnwatkins0), [Tung Du (@dinhtungdu)](https://github.com/dinhtungdu), [Darío Hereñú (@kant)](https://github.com/kant), [Arman Hovhannisyan (@ahovhannissian)](https://github.com/ahovhannissian), [John Spellman (@jspellman814)](https://github.com/jspellman814), [Oszkar Nagy (@oszkarnagy)](https://github.com/oszkarnagy), [Sami Keijonen (@samikeijonen)](https://github.com/samikeijonen), [(@PaddyWhacks)](https://github.com/PaddyWhacks), [(@eriktad)](https://github.com/eriktad), [(@dmaslogh)](https://github.com/dmaslogh), [Kevin Pudlo (@Kpudlo)](https://github.com/Kpudlo), [Barrett Golding (@hearvox)](https://github.com/hearvox), [Rob Marscher (@rmarscher)](https://github.com/rmarscher), [Ivan Lopez (@ivanlopez)](https://github.com/ivanlopez), [Catherine Cavanagh (@biggiebangle)](https://github.com/biggiebangle), [Tommy Ferry (@pragmatic-tf)](https://github.com/pragmatic-tf), [Joshua Walker (@jshwlkr)](https://github.com/jshwlkr), [Caleb Burks (@WPprodigy)](https://github.com/WPprodigy), [(@jonny-bull)](https://github.com/jonny-bull), [Ricky Lee Whittemore (@rickalee)](https://github.com/rickalee), [Rob Cain (@robcain)](https://github.com/robcain), [(@j0HnC0untry)](https://github.com/j0HnC0untry), [(@dfardon)](https://github.com/dfardon), [(@anilpainuly121)](https://github.com/anilpainuly121), [(@vimalagarwalasentech)](https://github.com/vimalagarwalasentech), [Chris Wieber (@cdwieber)](https://github.com/cdwieber), [Dhanendran Rajagopal (@dhanendran)](https://github.com/dhanendran), [Andrew Ortolano (@andrewortolano)](https://github.com/andrewortolano), [(@xyralothep)](https://github.com/xyralothep), [Garth Gutenberg (@ggutenberg)](https://github.com/ggutenberg), [Jaime Martínez (@jmslbam)](https://github.com/jmslbam), [Francisco Domo (@francisco-domo)](https://github.com/francisco-domo), [Elliott Stocks (@elliott-stocks)](https://github.com/elliott-stocks), [David Purdy (@davidmpurdy)](https://github.com/davidmpurdy), [(@zacnboat)](https://github.com/zacnboat), [Spencer Brower (@sbrow)](https://github.com/sbrow), [Ross Pickerill (@rosspbauer)](https://github.com/rosspbauer), [Jackie Kjome (@JackieKjome)](https://github.com/JackieKjome), [SieBer15 (@SieBer15)](https://github.com/SieBer15), [Pascal Knecht (@pascalknecht)](https://github.com/pascalknecht), [Justin Young (@justiny)](https://github.com/justiny), [Johan Pretorius (@Drmzindec)](https://github.com/Drmzindec), [Clayton Collie (@claytoncollie)](https://github.com/claytoncollie), [Max Lyuchin (@cadic)](https://github.com/cadic), [Joe Grainger (@jjgrainger)](https://github.com/jjgrainger), [Lily Bonney](https://www.linkedin.com/in/lilybonney/), [Mollie Pugh](https://www.linkedin.com/in/molliepugh/), [Martina Haines](https://www.linkedin.com/in/martinahaines/), [Luca Ricci (@theskinnyghost)](https://github.com/theskinnyghost), [Lucy Bowe (@LucyTurtle)](https://github.com/LucyTurtle), [Dharmesh Patel (@iamdharmesh)](https://github.com/iamdharmesh), [(@jmstew3)](https://github.com/jmstew3), [Phil Crumm (@pcrumm)](https://github.com/pcrumm), [Faisal Alvi (@faisal-alvi)](https://github.com/faisal-alvi), [Siddharth Thevaril (@Sidsector9)](https://github.com/Sidsector9), [Will Skora (@skorasaurus)](https://github.com/skorasaurus), [Mohit Dadhich (@mohitwp)](https://github.com/mohitwp), [Will Howat-Comandré (@willhowat)](https://github.com/willhowat), [@Borkent](https://github.com/Borkent), [Dishit Pala (@dishitpala)](https://github.com/dishitpala), [@markusvisse](https://github.com/markusvisse), [@MonsterKing](https://github.com/MonsterKing), [James Morrison (@jamesmorrison)](https://github.com/jamesmorrison), [Mehul Kaklotar (@mehulkaklotar)](https://github.com/mehulkaklotar), [@espechtcfe](https://github.com/espechtcfe), [@romeowski](https://github.com/romeowski), [@vlastaw](https://github.com/vlastaw), [Jamie Adams (@jadamsbit)](https://github.com/jadamsbit), [Yoni Bee (@ybalkind)](https://github.com/ybalkind), [Akshit Sethi (@akshitsethi)](https://github.com/akshitsethi), [Vikram (@vikrampm1)](https://github.com/vikrampm1), [Josh Wilson (@joshwilsondotme)](https://github.com/joshwilsondotme), [Groupe-Mgel (@Groupe-Mgel)](https://github.com/Groupe-Mgel), [Emma (@emmawenger)](https://github.com/emmawenger), [@bcobin](https://github.com/bcobin), [@alexwolk](https://github.com/alexwolk), [Maxime Freschard (@ligne13)](https://github.com/ligne13), [Shazahan Kabir Saju (@sksaju)](https://github.com/sksaju), [Peter Wilson (@peterwilsoncc)](https://github.com/peterwilsoncc), [@Pitemedia](https://github.com/Pitemedia), [Michal Letavka (@michalletavka)](https://github.com/michalletavka), [@shu05](https://github.com/shu05), [Lukas Pawlik (@lukaspawlik)](https://github.com/lukaspawlik), [Amal Ajith PM (@amalajith)](https://github.com/amalajith), [Paul de Wouters (@pdewouters)](https://github.com/pdewouters), [Andre Gagnon (@andygagnon)](https://github.com/andygagnon), [Ravinder Kumar (@ravinderk)](https://github.com/ravinderk), [mapamond (@mapamond)](https://github.com/mapamond), [Giorgos Sarigiannidis (@gsarig)](https://github.com/gsarig), [Dan Maby (@danmaby)](https://github.com/danmaby), [Tim Gieseking (@timstl)](https://github.com/timstl), [David Chandra Purnama (@turtlepod)](https://github.com/turtlepod), [Manolo Bevia (@manolobevia)](https://github.com/manolobevia), [madriverweb (@madriverweb)](https://github.com/madriverweb), [ale8521 (@ale8521)](https://github.com/ale8521), [roshniahuja (@roshniahuja)](https://github.com/roshniahuja), [Jayedul K. (@jayedul)](https://github.com/jayedul), [Konstantinos Galanakis (@kmgalanakis-sage)](https://github.com/kmgalanakis-sage), [Seth Rubenstein (@sethrubenstein)](https://github.com/sethrubenstein), [Harshal Kadu (@QAharshalkadu)](https://github.com/QAharshalkadu), [Joe McGill (@joemcgill)](https://github.com/joemcgill), [Margaret Schneider (@margaretschneider)](https://github.com/margaretschneider), [Anton Vanyukov (@av3nger)](https://github.com/av3nger), [Zach Adams (@zach-adams)](https://github.com/zach-adams), [Severine Pozzo (@severine-pozzo)](https://github.com/severine-pozzo), [Maxim Ledoux (@maxledoux)](https://github.com/maxledoux). +[10up (@10up)](https://github.com/10up), [Taylor Lovett (@tlovett1)](https://github.com/tlovett1), [Zane Matthew (@zanematthew)](https://github.com/zanematthew), [Aaron Brazell (@technosailor)](https://github.com/technosailor), [Marco Pereirinha (@pereirinha)](https://github.com/pereirinha), [Joshua Abenazer (@joshuaabenazer)](https://github.com/joshuaabenazer), [Adam Silverstein (@adamsilverstein)](https://github.com/adamsilverstein), [Helen Hou-Sandí (@helen)](https://github.com/helen), [Chris Marslender (@cmmarslender)](https://github.com/cmmarslender), [Tom J Nowell (@tomjn)](https://github.com/tomjn), [Tim Nolte (@timnolte)](https://github.com/timnolte), [(@sericgoran)](https://github.com/sericgoran), [Jason Bahl (@jasonbahl)](https://github.com/jasonbahl), [Barry Ceelen (@barryceelen)](https://github.com/barryceelen), [Ryan Welcher (@ryanwelcher)](https://github.com/ryanwelcher), [Ben Greeley (@bengreeley)](https://github.com/bengreeley), [Robbie Trencheny (@robbiet480)](https://github.com/robbiet480), [Jake Goldman (@jakemgold)](https://github.com/jakemgold), [Stephanie Leary (@sillybean)](https://github.com/sillybean), [Darin Kotter (@dkotter)](https://github.com/dkotter), [Echo (@ChaosExAnima)](https://github.com/ChaosExAnima), [Burhan Nasir (@burhandodhy)](https://github.com/burhandodhy), [Rebecca Hum (@rebeccahum)](https://github.com/rebeccahum), [Sean Hayes (@seanchayes)](https://github.com/seanchayes), [Jeremy Felt (@jeremyfelt)](https://github.com/jeremyfelt), [Gago (@madmax3365)](https://github.com/madmax3365), [Ivan Kruchkoff(@)](https://github.com/ivankruchkoff), [Sérgio Santos (@s3rgiosan)](https://github.com/s3rgiosan), [Ravi Chandra (@ravichdev)](https://github.com/ravichdev), [Jay Hoffmann (@JasonHoffmann)](https://github.com/JasonHoffmann), [Arsen Dovlatyan (@arsendovlatyan)](https://github.com/arsendovlatyan), [Jeroen Sormani (@JeroenSormani)](https://github.com/JeroenSormani), [Ritesh Patel (@Ritesh-patel)](https://github.com/Ritesh-patel), [Gary Thayer (@gthayer)](https://github.com/gthayer), [Evan Mattson (@aaemnnosttv)](https://github.com/aaemnnosttv), [Nate Allen (@nate-allen)](https://github.com/nate-allen), [Michael Phillips (@mphillips)](https://github.com/mphillips), [Jay Wood (@JayWood)](https://github.com/JayWood), [Dreb Bits (@drebbits)](https://github.com/drebbits), [Jeffrey Paul (@jeffpaul)](https://github.com/jeffpaul), [Matthew McAchran (@mmcachran)](https://github.com/mmcachran), [Ulrich Pogson (@grappler)](https://github.com/grappler), [(@avag-novembit)](https://github.com/avag-novembit), [Manuel Razzari (@mrazzari)](https://github.com/mrazzari), [Moe Browne (@moebrowne)](https://github.com/moebrowne), [Dave McHale (@dmchale)](https://github.com/dmchale), [Tommy Ferry (@tommyferry)](https://github.com/tommyferry), [Pete Nelson (@petenelson)](https://github.com/petenelson), [Alexander Berthelsen (@lakrisgubben)](https://github.com/lakrisgubben), [John Watkins (@johnwatkins0)](https://github.com/johnwatkins0), [Tung Du (@dinhtungdu)](https://github.com/dinhtungdu), [Darío Hereñú (@kant)](https://github.com/kant), [Arman Hovhannisyan (@ahovhannissian)](https://github.com/ahovhannissian), [John Spellman (@jspellman814)](https://github.com/jspellman814), [Oszkar Nagy (@oszkarnagy)](https://github.com/oszkarnagy), [Sami Keijonen (@samikeijonen)](https://github.com/samikeijonen), [(@PaddyWhacks)](https://github.com/PaddyWhacks), [(@eriktad)](https://github.com/eriktad), [(@dmaslogh)](https://github.com/dmaslogh), [Kevin Pudlo (@Kpudlo)](https://github.com/Kpudlo), [Barrett Golding (@hearvox)](https://github.com/hearvox), [Rob Marscher (@rmarscher)](https://github.com/rmarscher), [Ivan Lopez (@ivanlopez)](https://github.com/ivanlopez), [Catherine Cavanagh (@biggiebangle)](https://github.com/biggiebangle), [Tommy Ferry (@pragmatic-tf)](https://github.com/pragmatic-tf), [Joshua Walker (@jshwlkr)](https://github.com/jshwlkr), [Caleb Burks (@WPprodigy)](https://github.com/WPprodigy), [(@jonny-bull)](https://github.com/jonny-bull), [Ricky Lee Whittemore (@rickalee)](https://github.com/rickalee), [Rob Cain (@robcain)](https://github.com/robcain), [(@j0HnC0untry)](https://github.com/j0HnC0untry), [(@dfardon)](https://github.com/dfardon), [(@anilpainuly121)](https://github.com/anilpainuly121), [(@vimalagarwalasentech)](https://github.com/vimalagarwalasentech), [Chris Wieber (@cdwieber)](https://github.com/cdwieber), [Dhanendran Rajagopal (@dhanendran)](https://github.com/dhanendran), [Andrew Ortolano (@andrewortolano)](https://github.com/andrewortolano), [(@xyralothep)](https://github.com/xyralothep), [Garth Gutenberg (@ggutenberg)](https://github.com/ggutenberg), [Jaime Martínez (@jmslbam)](https://github.com/jmslbam), [Francisco Domo (@francisco-domo)](https://github.com/francisco-domo), [Elliott Stocks (@elliott-stocks)](https://github.com/elliott-stocks), [David Purdy (@davidmpurdy)](https://github.com/davidmpurdy), [(@zacnboat)](https://github.com/zacnboat), [Spencer Brower (@sbrow)](https://github.com/sbrow), [Ross Pickerill (@rosspbauer)](https://github.com/rosspbauer), [Jackie Kjome (@JackieKjome)](https://github.com/JackieKjome), [SieBer15 (@SieBer15)](https://github.com/SieBer15), [Pascal Knecht (@pascalknecht)](https://github.com/pascalknecht), [Justin Young (@justiny)](https://github.com/justiny), [Johan Pretorius (@Drmzindec)](https://github.com/Drmzindec), [Clayton Collie (@claytoncollie)](https://github.com/claytoncollie), [Max Lyuchin (@cadic)](https://github.com/cadic), [Joe Grainger (@jjgrainger)](https://github.com/jjgrainger), [Lily Bonney](https://www.linkedin.com/in/lilybonney/), [Mollie Pugh](https://www.linkedin.com/in/molliepugh/), [Martina Haines](https://www.linkedin.com/in/martinahaines/), [Luca Ricci (@theskinnyghost)](https://github.com/theskinnyghost), [Lucy Bowe (@LucyTurtle)](https://github.com/LucyTurtle), [Dharmesh Patel (@iamdharmesh)](https://github.com/iamdharmesh), [(@jmstew3)](https://github.com/jmstew3), [Phil Crumm (@pcrumm)](https://github.com/pcrumm), [Faisal Alvi (@faisal-alvi)](https://github.com/faisal-alvi), [Siddharth Thevaril (@Sidsector9)](https://github.com/Sidsector9), [Will Skora (@skorasaurus)](https://github.com/skorasaurus), [Mohit Dadhich (@mohitwp)](https://github.com/mohitwp), [Will Howat-Comandré (@willhowat)](https://github.com/willhowat), [@Borkent](https://github.com/Borkent), [Dishit Pala (@dishitpala)](https://github.com/dishitpala), [@markusvisse](https://github.com/markusvisse), [@MonsterKing](https://github.com/MonsterKing), [James Morrison (@jamesmorrison)](https://github.com/jamesmorrison), [Mehul Kaklotar (@mehulkaklotar)](https://github.com/mehulkaklotar), [@espechtcfe](https://github.com/espechtcfe), [@romeowski](https://github.com/romeowski), [@vlastaw](https://github.com/vlastaw), [Jamie Adams (@jadamsbit)](https://github.com/jadamsbit), [Yoni Bee (@ybalkind)](https://github.com/ybalkind), [Akshit Sethi (@akshitsethi)](https://github.com/akshitsethi), [Vikram (@vikrampm1)](https://github.com/vikrampm1), [Josh Wilson (@joshwilsondotme)](https://github.com/joshwilsondotme), [Groupe-Mgel (@Groupe-Mgel)](https://github.com/Groupe-Mgel), [Emma (@emmawenger)](https://github.com/emmawenger), [@bcobin](https://github.com/bcobin), [@alexwolk](https://github.com/alexwolk), [Maxime Freschard (@ligne13)](https://github.com/ligne13), [Shazahan Kabir Saju (@sksaju)](https://github.com/sksaju), [Peter Wilson (@peterwilsoncc)](https://github.com/peterwilsoncc), [@Pitemedia](https://github.com/Pitemedia), [Michal Letavka (@michalletavka)](https://github.com/michalletavka), [@shu05](https://github.com/shu05), [Lukas Pawlik (@lukaspawlik)](https://github.com/lukaspawlik), [Amal Ajith PM (@amalajith)](https://github.com/amalajith), [Paul de Wouters (@pdewouters)](https://github.com/pdewouters), [Andre Gagnon (@andygagnon)](https://github.com/andygagnon), [Ravinder Kumar (@ravinderk)](https://github.com/ravinderk), [mapamond (@mapamond)](https://github.com/mapamond), [Giorgos Sarigiannidis (@gsarig)](https://github.com/gsarig), [Dan Maby (@danmaby)](https://github.com/danmaby), [Tim Gieseking (@timstl)](https://github.com/timstl), [David Chandra Purnama (@turtlepod)](https://github.com/turtlepod), [Manolo Bevia (@manolobevia)](https://github.com/manolobevia), [madriverweb (@madriverweb)](https://github.com/madriverweb), [ale8521 (@ale8521)](https://github.com/ale8521), [roshniahuja (@roshniahuja)](https://github.com/roshniahuja), [Jayedul K. (@jayedul)](https://github.com/jayedul), [Konstantinos Galanakis (@kmgalanakis-sage)](https://github.com/kmgalanakis-sage), [Seth Rubenstein (@sethrubenstein)](https://github.com/sethrubenstein), [Harshal Kadu (@QAharshalkadu)](https://github.com/QAharshalkadu), [Joe McGill (@joemcgill)](https://github.com/joemcgill), [Margaret Schneider (@margaretschneider)](https://github.com/margaretschneider), [Anton Vanyukov (@av3nger)](https://github.com/av3nger), [Zach Adams (@zach-adams)](https://github.com/zach-adams), [Severine Pozzo (@severine-pozzo)](https://github.com/severine-pozzo), [Maxim Ledoux (@maxledoux)](https://github.com/maxledoux), [Leo Germani (@leogermani)](https://github.com/leogermani). ## Libraries diff --git a/README.md b/README.md index a8757470b..484e183df 100644 --- a/README.md +++ b/README.md @@ -126,7 +126,7 @@ You can navigate to the `Posts` > `All Posts` table list view to see all content ## Known Caveats/Issues -__Remote Request Timeouts__ - With external connections, HTTP requests are sent back and forth - creating posts, transfering images, syncing post updates, etc. In certain situations, mostly commonly when distributing posts with a large number of images (or very large file sizes), using poorly configured or saturated servers / hosts, or using plugins that add significant weight to post creation, Distributor requests can fail. Although we do some error handling, there are certain cases in which post distribution can fail silently. If distribution requests are taking a long time to load and/or failing, consider adjusting the timeout; you can filter the timeout for pushing external posts using the [`dt_push_post_timeout` filter](https://10up.github.io/distributor/dt_push_post_timeout.html). More advanced handling of large content requests, and improved error handling is on the road map for a future update. +__Remote Request Timeouts__ - With external connections, HTTP requests are sent back and forth - creating posts, transferring images, syncing post updates, etc. In certain situations, mostly commonly when distributing posts with a large number of images (or very large file sizes), using poorly configured or saturated servers / hosts, or using plugins that add significant weight to post creation, Distributor requests can fail. Although we do some error handling, there are certain cases in which post distribution can fail silently. If distribution requests are taking a long time to load and/or failing, consider adjusting the timeout; you can filter the timeout for pushing external posts using the [`dt_push_post_timeout` filter](https://10up.github.io/distributor/dt_push_post_timeout.html). More advanced handling of large content requests, and improved error handling is on the road map for a future update. __Post Meta Associations__ - A distributed post includes all of the post meta from the original version. Sometimes arbitrary post meta references an ID for another piece of content on the original site. Distributor _does not_ "bring along" the referenced content or update references for arbitrary post meta (it will take care of updating references in the case of core WordPress features, such as the featured image ID). This issue is very common when using field management plugins like Advanced Custom Fields (ACF). This can be addressed on a case by case basis by extending the plugin; for external connections, you can manually handle post meta associations using [the `dt_push_post` hook](https://github.com/10up/distributor/blob/f7b60740e679bce4671ccd69a670abadce4f2f93/includes/classes/ExternalConnections/WordPressExternalConnection.php#L646). For internal connections, use the [`dt_push_post` hook](https://10up.github.io/distributor/dt_push_post.html). Note that while named the same, these hooks accept different parameters. diff --git a/distributor.php b/distributor.php index 95b8d2894..d65067e2c 100644 --- a/distributor.php +++ b/distributor.php @@ -4,7 +4,7 @@ * Plugin URI: https://github.com/10up/distributor * Update URI: https://distributorplugin.com * Description: Makes it easy to distribute and reuse content across your websites, whether inside of a multisite or across the web. - * Version: 2.0.2 + * Version: 2.0.3 * Requires at least: 5.7 * Requires PHP: 7.4 * Author: 10up Inc. @@ -28,7 +28,7 @@ exit; // Exit if accessed directly. } -define( 'DT_VERSION', '2.0.2' ); +define( 'DT_VERSION', '2.0.3' ); define( 'DT_PLUGIN_FILE', preg_replace( '#^.*plugins/(.*)$#i', '$1', __FILE__ ) ); define( 'DT_PLUGIN_PATH', plugin_dir_path( __FILE__ ) ); define( 'DT_PLUGIN_FULL_FILE', __FILE__ ); diff --git a/docs/connect-to-an-existing-post.md b/docs/connect-to-an-existing-post.md index 7598ff165..be0f10d17 100644 --- a/docs/connect-to-an-existing-post.md +++ b/docs/connect-to-an-existing-post.md @@ -72,7 +72,7 @@ $data = [ ]; ``` -In the above example, the `internal` array will always be empty, unless an item is also linked to an interal site. For the `external` array, each item in the array will have a key that corresponds to the connection ID (2 in the example above) and then the `post_id` should be the destination post ID. +In the above example, the `internal` array will always be empty, unless an item is also linked to an internal site. For the `external` array, each item in the array will have a key that corresponds to the connection ID (2 in the example above) and then the `post_id` should be the destination post ID. As a further example, if I have a post with an ID of 100 that lives on a site with an ID of 1 and I want that post to be linked to an existing post with an ID of 50 on the site with a connection ID of 2, the `dt_connection_map` data that is stored with the original item (ID of 100, site ID 1) would look like the following: diff --git a/includes/bootstrap.php b/includes/bootstrap.php index 70b8bb3f3..9be1200b8 100644 --- a/includes/bootstrap.php +++ b/includes/bootstrap.php @@ -3,7 +3,7 @@ * Bootstrap the main plugin. * * This file is included by the main plugin file and is responsible for - * bootstraping the plugin. This allows the main file to be used for version + * bootstrapping the plugin. This allows the main file to be used for version * support and therefore support earlier versions of PHP and WP than the * minimum requirements. * diff --git a/includes/classes/Authentication.php b/includes/classes/Authentication.php index 315ea0302..3fd9f5c9f 100644 --- a/includes/classes/Authentication.php +++ b/includes/classes/Authentication.php @@ -112,7 +112,7 @@ public function format_post_args( $args, $context = array() ) { * Store pre-sanizited auth credentials in DB * * @param int $external_connection_id External connection ID. - * @param array $args Array of creds to store. Should be pre-sanitized. + * @param array $args Array of credentials to store. Should be pre-sanitized. * @since 0.8 */ public static function store_credentials( $external_connection_id, $args ) { diff --git a/includes/classes/Authentications/WordPressDotcomOauth2Authentication.php b/includes/classes/Authentications/WordPressDotcomOauth2Authentication.php index 5407ae733..db4dd44ae 100644 --- a/includes/classes/Authentications/WordPressDotcomOauth2Authentication.php +++ b/includes/classes/Authentications/WordPressDotcomOauth2Authentication.php @@ -28,7 +28,7 @@ class WordPressDotcomOauth2Authentication extends Authentication { public static $requires_credentials = true; /** - * Auth hanlder pretty label + * Auth handler pretty label * * @var string */ diff --git a/includes/classes/DistributorPost.php b/includes/classes/DistributorPost.php index d1b5c3645..17d1d5eb3 100644 --- a/includes/classes/DistributorPost.php +++ b/includes/classes/DistributorPost.php @@ -666,7 +666,9 @@ protected function parse_media_blocks() { $found = false; // Note: changes to the cache key or group should be reflected in `includes/settings.php` - $media = wp_cache_get( 'dt_media::{$post_id}', 'dt::post', false, $found ); + $cache_key = "dt_media::{$this->post->ID}"; + $cache_group = 'dt::post'; + $media = wp_cache_get( $cache_key, $cache_group, false, $found ); if ( ! $found ) { // Parse blocks to determine attached media. @@ -679,7 +681,7 @@ protected function parse_media_blocks() { } // Only the IDs are cached to keep the cache size down. - wp_cache_set( 'dt_media::{$post_id}', $media, 'dt::post' ); + wp_cache_set( $cache_key, $media, $cache_group ); } /* @@ -918,7 +920,17 @@ protected function to_pull_list( $args = array() ) { $display_data['distributor_original_site_name'] = $this->source_site['name']; $display_data['distributor_original_site_url'] = $this->source_site['home_url']; - return $display_data; + /** + * Filters the post data for when they are being formatted for a pull + * + * @since 2.0.3 + * @hook dt_post_to_pull + * + * @param {array} $display_data The post data. + * + * @return {array} Modified post data. + */ + return apply_filters( 'dt_post_to_pull', $display_data ); } /** diff --git a/includes/classes/ExternalConnections/WordPressExternalConnection.php b/includes/classes/ExternalConnections/WordPressExternalConnection.php index 8c3c431e3..86cb2ef23 100644 --- a/includes/classes/ExternalConnections/WordPressExternalConnection.php +++ b/includes/classes/ExternalConnections/WordPressExternalConnection.php @@ -786,7 +786,7 @@ public function check_connections() { /** - * Whether if the post type is not distibutor internal post type. + * Whether if the post type is not distributor internal post type. * * @param string $post_type Post type * diff --git a/includes/classes/InternalConnections/NetworkSiteConnection.php b/includes/classes/InternalConnections/NetworkSiteConnection.php index ac424d647..0428347f7 100644 --- a/includes/classes/InternalConnections/NetworkSiteConnection.php +++ b/includes/classes/InternalConnections/NetworkSiteConnection.php @@ -774,7 +774,7 @@ public static function update_syndicated( $post ) { /** * Maybe set post modified date - * On wp_insert_post, modified date is overriden by post date + * On wp_insert_post, modified date is overridden by post date * * https://core.trac.wordpress.org/browser/tags/4.7.2/src/wp-includes/post.php#L3151 * diff --git a/includes/debug-info.php b/includes/debug-info.php index fb4206f0b..076465f41 100644 --- a/includes/debug-info.php +++ b/includes/debug-info.php @@ -124,11 +124,11 @@ function add_debug_info( $info ) { ], [ 'label' => __( 'Internal Connections', 'distributor' ), - 'value' => get_formatted_internal_connnections(), + 'value' => get_formatted_internal_connections(), ], [ 'label' => __( 'External Connections', 'distributor' ), - 'value' => get_formatted_external_connnections(), + 'value' => get_formatted_external_connections(), ], ] ); @@ -144,9 +144,19 @@ function add_debug_info( $info ) { /** * Get and format internal connections. * - * @return array + * @deprecated x.x.x Use get_formatted_internal_connections */ function get_formatted_internal_connnections() { + _deprecated_function( __FUNCTION__, 'x.x.x.', __NAMESPACE__ . '\\get_formatted_internal_connections' ); + return get_formatted_internal_connections(); +} + +/** + * Get and format internal connections. + * + * @return array + */ +function get_formatted_internal_connections() { if ( empty( Connections::factory()->get_registered()['networkblog'] ) ) { return __( 'N/A', 'distributor' ); } @@ -176,9 +186,19 @@ function get_formatted_internal_connnections() { /** * Get and format external connections. * - * @return array + * @deprecated x.x.x Use get_formatted_external_connections */ function get_formatted_external_connnections() { + _deprecated_function( __FUNCTION__, 'x.x.x', __NAMESPACE__ . '\\get_formatted_external_connections' ); + return get_formatted_external_connections(); +} + +/** + * Get and format external connections. + * + * @return array + */ +function get_formatted_external_connections() { $output = []; diff --git a/includes/external-connection-cpt.php b/includes/external-connection-cpt.php index 4396414f7..2a854b399 100644 --- a/includes/external-connection-cpt.php +++ b/includes/external-connection-cpt.php @@ -420,9 +420,9 @@ function save_post( $post_id ) { $connection_class = \Distributor\Connections::factory()->get_registered()[ sanitize_key( $_POST['dt_external_connection_type'] ) ]; $auth_handler_class_again = $connection_class::$auth_handler_class; - $auth_creds = $auth_handler_class_again::prepare_credentials( array_merge( (array) $current_auth, array_map( 'sanitize_text_field', (array) wp_unslash( $_POST['dt_external_connection_auth'] ) ) ) ); + $auth_credentials = $auth_handler_class_again::prepare_credentials( array_merge( (array) $current_auth, array_map( 'sanitize_text_field', (array) wp_unslash( $_POST['dt_external_connection_auth'] ) ) ) ); - $auth_handler_class_again::store_credentials( $post_id, $auth_creds ); + $auth_handler_class_again::store_credentials( $post_id, $auth_credentials ); } } @@ -597,7 +597,7 @@ function dashboard() { global $connection_list_table; $_GET['post_type'] = 'dt_ext_connection'; - $_REQUEST['all_posts'] = true; // Default to replacite "All" tab + $_REQUEST['all_posts'] = true; // Default to replicate "All" tab $connection_list_table->prepare_items(); ?> diff --git a/includes/push-ui.php b/includes/push-ui.php index d883425ed..db071c1a4 100644 --- a/includes/push-ui.php +++ b/includes/push-ui.php @@ -246,7 +246,7 @@ function get_connections() { */ function ajax_push() { if ( ! check_ajax_referer( 'dt-push', 'nonce', false ) ) { - wp_send_json_error( new \WP_Error( 'invalid-referal', __( 'Invalid Ajax referer.', 'distributor' ) ) ); + wp_send_json_error( new \WP_Error( 'invalid-referral', __( 'Invalid Ajax referer.', 'distributor' ) ) ); exit; } diff --git a/includes/settings.php b/includes/settings.php index b25603dc6..afee92722 100644 --- a/includes/settings.php +++ b/includes/settings.php @@ -195,7 +195,7 @@ function setup_fields_sections() { add_settings_field( 'media_handling', esc_html__( 'Media Handling', 'distributor' ), __NAMESPACE__ . '\media_handling_callback', 'distributor', 'dt-section-1' ); if ( false === DT_IS_NETWORK ) { - add_settings_field( 'registation_key', esc_html__( 'Registration Key', 'distributor' ), __NAMESPACE__ . '\license_key_callback', 'distributor', 'dt-section-1' ); + add_settings_field( 'registration_key', esc_html__( 'Registration Key', 'distributor' ), __NAMESPACE__ . '\license_key_callback', 'distributor', 'dt-section-1' ); } } diff --git a/includes/subscriptions.php b/includes/subscriptions.php index 242c2109f..d85383c33 100644 --- a/includes/subscriptions.php +++ b/includes/subscriptions.php @@ -95,7 +95,7 @@ function create_remote_subscription( ExternalConnection $connection, $remote_pos * For a post that is distributed, for each distributed post, we create a subscription (CPT) to keep track * of the copy. Attached to each subscription is a unique signature. When a post is updated, we check for subscriptions. * If subscriptions exist, we grab the signature for each subscription and send the update to the remote copy along - * with the signature. The signature is a passcode of sorts. The subscription signature must match the copied post's + * with the signature. The signature is a pass code of sorts. The subscription signature must match the copied post's * signature otherwise the update is not authorized. * * You might be wondering why we don't just use HTTP Basic Auth or OAuth since we've already set that up. diff --git a/includes/template-tags.php b/includes/template-tags.php index 0c1e2e3ea..95c408318 100644 --- a/includes/template-tags.php +++ b/includes/template-tags.php @@ -215,8 +215,8 @@ function distributor_get_the_connection_source( $post_id = null ) { /** * Display information about where a post was distributed from. * - * @param int|null|mixed $post_id Post ID. - * @param string |null|mixed $preface The string that will preceed the link. + * @param int|null|mixed $post_id Post ID. + * @param string|null|mixed $preface The string that will precede the link. */ function distributor_the_connection_source( $post_id = null, $preface = null ) { if ( ! $post_id ) { diff --git a/includes/utils.php b/includes/utils.php index 41aa5b8df..1e53a57f9 100644 --- a/includes/utils.php +++ b/includes/utils.php @@ -573,7 +573,7 @@ function prepare_taxonomy_terms( $post_id, $args = array() ) { function set_taxonomy_terms( $post_id, $taxonomy_terms ) { // Now let's add the taxonomy/terms to syndicated post foreach ( $taxonomy_terms as $taxonomy => $terms ) { - // Continue if taxonomy doesnt exist + // Continue if taxonomy doesn't exist if ( ! taxonomy_exists( $taxonomy ) ) { continue; } @@ -642,9 +642,9 @@ function set_taxonomy_terms( $post_id, $taxonomy_terms ) { * * @return {bool} Whether term hierarchy should be updated. */ - $update_term_hierachy = apply_filters( 'dt_update_term_hierarchy', true, $taxonomy ); + $update_term_hierarchy = apply_filters( 'dt_update_term_hierarchy', true, $taxonomy ); - if ( ! empty( $update_term_hierachy ) ) { + if ( ! empty( $update_term_hierarchy ) ) { foreach ( $terms as $term_array ) { if ( ! is_array( $term_array ) ) { $term_array = (array) $term_array; @@ -940,8 +940,8 @@ function process_media( $url, $post_id, $args = [] ) { $source_file = $args['source_file']; if ( ! is_a( $wp_filesystem, 'WP_Filesystem_Base' ) ) { - $creds = request_filesystem_credentials( site_url() ); - wp_filesystem( $creds ); + $credentials = request_filesystem_credentials( site_url() ); + wp_filesystem( $credentials ); } // Copy the source file so we don't mess with the original file. diff --git a/package-lock.json b/package-lock.json index ac555477a..4b917159a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "distributor", - "version": "2.0.2", + "version": "2.0.3", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "distributor", - "version": "2.0.2", + "version": "2.0.3", "license": "GPL-2.0-or-later", "dependencies": { "mustache": "^4.2.0" diff --git a/package.json b/package.json index 30bb29396..7c666e89f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "distributor", - "version": "2.0.2", + "version": "2.0.3", "description": "Distributor is a WordPress plugin that makes it easy to distribute and reuse content across your websites — whether in a single multisite or across the web.", "author": { "name": "10up", diff --git a/readme.txt b/readme.txt index aa38668b9..3e7d28617 100644 --- a/readme.txt +++ b/readme.txt @@ -4,7 +4,7 @@ Tags: content, distribution, syndication, management Requires at least: 5.7 Tested up to: 6.4 Requires PHP: 7.4 -Stable tag: 2.0.2 +Stable tag: 2.0.3 License: GPLv2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html diff --git a/tests/cypress/e2e/external-connection.test.js b/tests/cypress/e2e/external-connection.test.js index 22de77924..da5c77db5 100644 --- a/tests/cypress/e2e/external-connection.test.js +++ b/tests/cypress/e2e/external-connection.test.js @@ -9,7 +9,7 @@ describe( 'Admin can add a new external connection', () => { it( 'Should create external connection', () => { const connectionName = 'Connection ' + randomName(); - // The command includes the workaround to sucessfully create new connection. + // The command includes the workaround to successfully create new connection. cy.createExternalConnection( connectionName, 'http://localhost/second/wp-json' diff --git a/tests/cypress/e2e/push-menu.test.js b/tests/cypress/e2e/push-menu.test.js index f84f4a530..89ba4fc5d 100644 --- a/tests/cypress/e2e/push-menu.test.js +++ b/tests/cypress/e2e/push-menu.test.js @@ -110,7 +110,7 @@ describe( 'Push menu test', () => { .contains( externalConnectionName ) .should( 'be.visible' ); - // Deselct the external connection. + // Deselect the external connection. cy.get( '#distributor-push-wrapper .selected-connections-list' ) .contains( externalConnectionName ) .find( '.remove-connection' ) diff --git a/tests/php/DistributorPostTest.php b/tests/php/DistributorPostTest.php index b0503f8c6..ebfd858d7 100644 --- a/tests/php/DistributorPostTest.php +++ b/tests/php/DistributorPostTest.php @@ -1376,6 +1376,251 @@ public function test_get_media_with_attachments() { $this->assertEquals( $post_media_expected, $post_media_actual ); } + /** + * Test that the cache gets set when parse_media_blocks is called. + * + * @covers ::get_media + * @covers ::parse_media_blocks + * @covers ::parse_blocks_for_attachment_id + * @runInSeparateProcess + * @doesNotPerformAssertions + */ + public function test_get_media_sets_cache() { + $post_content = ' +
+ + +
+ + '; + + $this->setup_post_meta_mock( array() ); + + \WP_Mock::userFunction( + 'get_post', + array( + 'return_in_order' => array( + (object) array( + 'ID' => 33, + 'post_title' => 'Block post with media', + 'post_content' => $post_content, + 'post_excerpt' => '', + 'guid' => 'http://example.org/?p=1', + 'post_name' => 'test-post', + ), + (object) array( + 'ID' => 21, + 'post_title' => 'deh-platt', + 'post_content' => '', + 'post_excerpt' => '', + 'guid' => 'http://example.org/?p=11', + 'post_name' => 'deh-platt', + 'post_parent' => 0, + 'post_mime_type' => 'image/jpeg', + ), + (object) array( + 'ID' => 22, + 'post_title' => 'dah-platt', + 'post_content' => '', + 'post_excerpt' => '', + 'guid' => 'http://example.org/?p=22', + 'post_name' => 'dah-platt', + 'post_parent' => 0, + 'post_mime_type' => 'image/jpeg', + ), + ), + ) + ); + + \WP_Mock::userFunction( + 'wp_attachment_is_image', + array( + 'return_in_order' => array( + true, + true, + ), + ) + ); + + \WP_Mock::userFunction( + 'wp_get_attachment_metadata', + array( + 'return_in_order' => array( + array( + 'file' => '2022/12/deh-platt.jpg', + 'width' => 1024, + 'height' => 683, + 'filesize' => 404298, + 'sizes' => array( + 'thumbnail' => array( + 'file' => 'deh-platt-150x150.jpg', + 'width' => 150, + 'height' => 150, + 'mime-type' => 'image/jpeg', + ), + 'medium' => array( + 'file' => 'deh-platt-300x200.jpg', + 'width' => 300, + 'height' => 200, + 'mime-type' => 'image/jpeg', + ), + 'medium_large' => array( + 'file' => 'deh-platt-768x512.jpg', + 'width' => 768, + 'height' => 512, + 'mime-type' => 'image/jpeg', + ), + 'large' => array( + 'file' => 'deh-platt-1024x683.jpg', + 'width' => 1024, + 'height' => 683, + 'mime-type' => 'image/jpeg', + ), + ), + ), + array( + 'file' => '2022/12/dah-platt.jpg', + 'width' => 1024, + 'height' => 683, + 'filesize' => 404298, + 'sizes' => array( + 'thumbnail' => array( + 'file' => 'dah-platt-150x150.jpg', + 'width' => 150, + 'height' => 150, + 'mime-type' => 'image/jpeg', + ), + 'medium' => array( + 'file' => 'dah-platt-300x200.jpg', + 'width' => 300, + 'height' => 200, + 'mime-type' => 'image/jpeg', + ), + 'medium_large' => array( + 'file' => 'dah-platt-768x512.jpg', + 'width' => 768, + 'height' => 512, + 'mime-type' => 'image/jpeg', + ), + 'large' => array( + 'file' => 'dah-platt-1024x683.jpg', + 'width' => 1024, + 'height' => 683, + 'mime-type' => 'image/jpeg', + ), + ), + ), + ), + ) + ); + + \WP_Mock::userFunction( + 'wp_get_attachment_url', + array( + 'return_in_order' => array( + 'http://xu-distributor.local/wp-content/uploads/2022/12/deh-platt.jpg', + 'http://xu-distributor.local/wp-content/uploads/2022/12/dah-platt.jpg', + ), + ) + ); + + \WP_Mock::userFunction( + 'get_attached_file', + array( + 'return_in_order' => array( + '/var/www/html/wp-content/uploads/2022/12/deh-platt.jpg', + '/var/www/html/wp-content/uploads/2022/12/dah-platt.jpg', + ), + ) + ); + + \WP_Mock::userFunction( + 'has_blocks', + array( + 'return' => true, + ) + ); + + \WP_Mock::userFunction( + 'get_permalink', + array( + 'return_in_order' => array( + 'http://xu-distributor.local/?p=2', + 'http://xu-distributor.local/?p=21', + 'http://xu-distributor.local/?p=22', + ), + ), + ); + + \WP_Mock::userFunction( + 'get_post_thumbnail_id', + array( + 'return' => false, + ) + ); + + \WP_Mock::userFunction( + 'wp_cache_get', + array( + 'return' => false, + ) + ); + + $blocks = array( + array( + 'blockName' => 'core/image', + 'attrs' => array( + 'id' => 21, + 'sizeSlug' => 'large', + 'linkDestination' => 'none', + ), + 'innerBlocks' => array(), + 'innerHTML' => '
', + 'innerContent' => array( + '
', + ), + ), + array( + 'blockName' => 'core/image', + 'attrs' => array( + 'id' => 22, + 'sizeSlug' => 'large', + 'linkDestination' => 'none', + ), + 'innerBlocks' => array(), + 'innerHTML' => '
', + 'innerContent' => array( + '
', + ), + ), + ); + + \WP_Mock::userFunction( + 'parse_blocks', + array( + 'return' => $blocks, + ) + ); + + // Add assertions to wp_cache_set mock. + \WP_Mock::userFunction( + 'wp_cache_set', + array( + 'return' => true, + 'times' => 1, + 'args' => array( + 'dt_media::33', + array( 21, 22 ), + 'dt::post' + ), + ) + ); + + $dt_post = new DistributorPost( 33 ); + $dt_post->get_media(); + + } + /** * Test methods for formatting the post data without blocks. * diff --git a/tests/php/bootstrap.php b/tests/php/bootstrap.php index 896e54484..3d9c59221 100644 --- a/tests/php/bootstrap.php +++ b/tests/php/bootstrap.php @@ -10,7 +10,7 @@ WP_Mock::bootstrap(); define( 'DT_PLUGIN_PATH', dirname( __DIR__, 2 ) ); -define( 'DT_VERSION', '2.0.2' ); +define( 'DT_VERSION', '2.0.3' ); require_once __DIR__ . '/includes/common.php'; require_once __DIR__ . '/includes/TestCase.php'; diff --git a/webpack.config.js b/webpack.config.js index 2dbd9ad9d..382903824 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -10,7 +10,7 @@ const { resolve } = require( 'path' ); * suffix is removed from the file name to avoid the tortologist `-css.css`. * * In some cases the CSS file name differs from the JavaScript filename. In a - * possibly foolhardy attemt to maintain backward compatibility, these values are + * possibly foolhardy attempt to maintain backward compatibility, these values are * hard coded here. * * @param {Object} pathData Entry point path data.