Repository navigation
WordPress 7.1 support, a test suite and fixes (1.2.0) - #70
Merged
Merged
Conversation
- wp-env: a dev site (port 8888) and a separate tests site (port 8889), both pinned to WordPress 6.8.2 / PHP 8.3 with the plugin mounted as wp-content/plugins/iframely - Composer dev dependencies, run inside the wp-env containers: PHPUnit, Yoast PHPUnit polyfills, PHP_CodeSniffer with WordPress and PHPCompatibilityWP rules, PHPStan with the WordPress extension - PHPUnit (single site and multisite), Jest and Playwright harnesses, each with one smoke test; PHPUnit uses its own table prefix so it does not reset the tests site - npm scripts for the environment, tests and linters; README updated - ESLint, stylelint and Prettier configured to match the existing code style, so no source file is reformatted - .distignore, and .gitignore entries for vendor/ and test output - package-lock.json: add the @parcel/watcher platform packages that were missing because the lockfile was generated on Windows (npm ci failed on Linux) No plugin code is changed and build/ is byte-identical.
PHPUnit integration tests for every plugin class (single site and multisite), Jest unit tests for the editor script, and Playwright e2e tests for the settings screen and the block editor. Tests are hermetic: PHPUnit fails on any undeclared HTTP request and the e2e site answers Iframely API calls from a stub mu-plugin. An opt-in live test (npm run test:php:live) reads IFRAMELY_API_KEY from the environment or .env. Tests named known_issue pin current defective behaviour and are to be inverted when the defect is fixed. No plugin code is changed. Also adds a Plugin Check runner (npm run lint:plugin-check).
Run both wp-env sites on WordPress 7.1.4 and bump the @wordpress/* packages to their latest releases. The rebuilt editor script is functionally identical to the previous build. Follow the tooling changes that @wordpress/scripts 37 requires: unit tests run on Vitest instead of Jest, and ESLint uses a flat config. Reconcile the plugin metadata: WordPress 6.6 and PHP 7.4 as minimum versions, tested up to 7.1, and "GPLv2 or later" as the license in the plugin header, readme.txt and package.json, with a LICENSE file that ships in releases. Two tests keep the header and the readme in agreement. Add an end-to-end test for the site editor and "npm run test:matrix", which runs PHPUnit and the end-to-end tests on the minimum supported versions and on the latest WordPress with the newest PHP.
Add tests for summary cards and the "Make it a small card" option at every level: end-to-end in the editor and on the front end, PHPUnit for rendering, caching and the site-wide default, unit tests for the editor script, and two checks against the real API in the opt-in live test. Rebuild the end-to-end stubs on the formats the real API and embeds use: a player with "Closed captions" and "Start from" for video URLs, a card for any other page, and embeds that report their options through the plugin's message relay. The rich media and site editor tests now use these instead of an invented option.
Add end-to-end tests for changing options over and over: a card switched between small and regular in several rounds, quick clicks that do not wait for the preview, and nine mixed changes to a video's checkbox and text options. Pin three defects found on the way as known issues: a click made while a new preview loads is lost, the options panel fails when used after a preview has failed, and on current WordPress "Try again" does not ask for the failed preview again (it does on 6.6, which has its own test). The API stub can now delay or fail the next request and report the WordPress version of the tests site.
With the cache refresh on, an expired embed was deleted before WordPress asked for it again, so a failing API left a bare link on every view, and a URL that could not be embedded was requested again on every view. An expired entry is now kept and only passed over for one fetch. If that fetch fails, the old embed is served and the refresh is tried again an hour later. A URL that cannot be embedded is asked for again after a day at most.
The options an author chooses for one embed travel in the post URL and were copied into the API request as they came. They could replace the API key, the origin and the URL of the request, add parameters through values with "&" or "#", and a value that was not an object raised a PHP warning. Options are now taken from a JSON object only, with plain names and plain values, the values are encoded, and the parameters that say who asks for which page in which format cannot be set. Two more faults of the same code are fixed. Options whose base64 form contains a "+" were dropped, because the value was decoded twice. And an unchecked option was left out of the request, so an option that is on by default stayed on in the published post while the editor showed it off; checkboxes are now sent as true and false, as the editor preview does.
The editor kept the chosen options in an attribute of its own and wrote them into the URL of the block inside the save filter, behind the back of the block. It also rebuilt the address of the embed on screen by hand. As a result: - every change loaded the embed twice; - a change made while the new preview was loading was lost, because the handler needed the preview on screen; - when a preview failed after a change, the options panel threw an error, and on current WordPress "Try again" asked for the URL without the options, so the block stayed broken until the page was reloaded; - option values were put into the embed address without encoding, and every "&" in the saved block was rewritten. An option change now sets the URL of the block directly, and the block loads the one preview for it. The handler needs nothing but the block, so it works while a preview loads and after one has failed. The save filter and the extra attribute are gone. The embed block of WordPress keeps a copy of its URL from the moment it was first shown and uses it for "Try again" and the URL field, so the block is started again whenever the options in its URL change. Options are also encoded from their UTF-8 bytes now: a value in a script other than Latin made btoa() throw. Posts saved by earlier versions open as before. Newly saved posts carry the "&" of the URL as an entity in the HTML, as any other embed does.
The plugin took every REST request of a user who can edit posts for a preview request of the editor. Every embed rendered in such a request, for example in the content of a post read over REST, got the script that passes messages on to the editor and a style that hides the overflow of the whole page, was asked for from the API a second time and cached a second time. On WordPress 6.6 that style took the scrollbar off the canvas of the site editor. The preview mode is now switched on for the oEmbed proxy route alone and off again when that request is done. This also removes the user check on plugins_loaded. It settled who the user is before plugins that sign users in on their own had registered, which left their visitors signed out.
Only a JSON body with an "error" field counted as a failed verification. An error page of a proxy or a firewall, a sign-in page of a network or an empty answer is no JSON at all, so the key was stored and the plugin reported success while every embed failed. The key is now stored when the request succeeds and returns data without an error. Otherwise the user is told that the key can't be verified, with the HTTP status when it says more than the answer. One settings test relied on another test class to register the settings page; it registers the page itself now.
Two faults in how the plugin steps in for WordPress: To turn links to the site's own posts into cards, the plugin answered pre_oembed_result with null at the last priority. That threw away the answer of every other plugin, for every URL. Now WordPress is only told that the link is not a post while it looks for its own answer. Iframely was switched off for feeds on the_content_feed, which runs after the first item has been rendered, so the newest item of every feed carried an embed that needs JavaScript. It is now switched off when the content of a feed is about to be rendered.
…ages The editor script referred to the global of Iframely's CDN scripts without checking for it, so a blocked if-cdn.com made it throw. It also parsed every message posted to the editor window as JSON, and threw on the ones other scripts post in formats of their own. Both are handled now: without the CDN scripts there are simply no options to choose. Options of an embed were taken from any frame. The script that passes an embed's messages on to the editor now passes on only messages of the embed's own frames, and only to the editor's origin, and the editor takes options only from a frame that has its own origin. The dependencies and the version of the editor script are read from the build, which adds the JSX runtime that was missing, and jQuery and the two CDN scripts are declared as well. The texts of the script are registered for translation.
The "Query string parameters" setting went through sanitize_text_field as a whole, which drops everything that looks like an encoded byte: "title=Hello%20World" was stored as "title=HelloWorld". The API link then put the decoded values back without encoding them, so a value with "&" or "#" changed the request. The setting is now read as name and value pairs, the values are cleaned after decoding and stored encoded, and the API link encodes what it adds. The cache lifetime was stored as it came from the form. Only the lifetimes that are offered are accepted now; anything else becomes the default. The migration of old settings compared the lifetime with the list that carries translated names. It runs while plugins are loaded, where WordPress 6.7 and later log a notice for a translation asked for that early. It uses a list without names now.
After a key was verified, the onboarding panel was printed right away. That happens on admin_init, before the page is started, so the panel ended up in front of the document and PHP logged "headers already sent". It is now printed where the other messages of the settings page are.
…ting With "Include built-in providers" off, WordPress asks its own providers first, and the shortcode handed a YouTube URL to WordPress's YouTube provider. Sites that came from the old "shortcode only" mode are in that state. The shortcode now puts Iframely first for its own lookup, and keeps its embeds apart from the ones a built-in provider made for the same URL in the same post. Sites where Iframely replaces the built-in providers keep their cache as it is.
…twork On AMP pages the plugin adds the paragraphs itself, around the embeds. The text after the last embed was left out and came without paragraphs. On a network the settings page exists in the network admin only, but the "Settings" link on the Plugins screen of a single site was built for that site and came out empty. It now leads to the network admin, and is shown only to those who can open it.
When there is no embed for a URL, WordPress shows the URL as a link. For an embed with options chosen in the editor, visitors saw the "iframely=" parameter in the text and the address of that link. The link now carries the URL as it was before the options were added.
The views printed translated texts, URLs and stored values as they came. Nothing in them comes from a request, so there was no hole to use, but one message carries the status field of an API answer, and the stored values were printed with esc_attr_e(), which sends a value through the translations before it escapes it. Texts are printed with esc_html_e() and esc_attr_e(), texts with a link through wp_kses_post() with an escaped address, values with esc_attr() and esc_html(). The notice escapes its status and cleans its message, and the error code of the API is escaped where the message is made. The nonce and the fields of the forms are unslashed and sanitized where they are read. save() reads them after it has verified the nonce and hands them to update() and activate(), which no longer read the request themselves. Each view ends at once when it is opened directly, where it used to fail with an error 500. Two texts with two placeholders have them numbered now, and texts with placeholders have a note for translators.
Deleting the plugin left its nine options behind, the API key among them. uninstall.php removes them, and the two options of the versions before 1.0 in case they were never converted. Posts are not touched: their URLs and the embeds WordPress has cached for them stay as they are.
Utils::debug(), Links::activation() and the parameters of Reactivation::start() and end() were not used. The address of the API was written down twice; the class constant now takes it from the constant of the plugin. PHPStan is clean with this: the AMP filter asked for two arguments for a callback that takes one, the migration passed an integer for a boolean, and the autoloader returned a value where none is expected. The autoloader also takes only classes of the Iframely namespace now, not every class whose name starts with these letters.
The page for changing the API key said that the media cache of the posts is cleared. It is not: the current key stays in use until a new one is verified, and embeds move to the new key as they are refreshed. The text says that now. "arehere" on the Help tab is two words. The large images of the onboarding had "@" in their names, which wordpress.org does not accept, and the PNG one was never offered to the browser: the list named the small image twice. load_plugin_textdomain() is gone. WordPress loads the translations from wordpress.org on its own, and the release carries no translation files. For a copy from the repository the Domain Path header tells WordPress 6.8 and later where the bundled translation is. The translation template is generated again.
No change in behaviour. Everything here is the output of "phpcbf", "eslint --fix", "stylelint --fix" and "prettier --write", plus the rebuilt editor script. The style rules could not be used as they were: they named a rule stylelint does not know, and asked for an empty line at the start of a block, which Prettier takes away again. The configuration now leaves indentation to Prettier and agrees with it about that line. Two templates are left for a separate commit: what phpcbf makes of their one-line conditions is hard to read.
The editor's hint for administrators has its two placeholders numbered and a note for translators. An unused variable, an empty style rule and a colour written as a word are gone. The two templates left out of the formatting commit print the class of the active tab and of a dismissible notice with an expression in place of a one-line condition. The translation template names the built script again next to its sources; the last regeneration had left it out. With this, "npm run lint" passes: ESLint, Stylelint, PHPCS and PHPStan report nothing.
"gulp release" copied the files of its own list, next to the list in .distignore that the other tools use. A new file had to be added to both, and the copy for a tag left out files without a dot in their name, LICENSE among them. "npm run release" builds the scripts and styles and packages every file under version control that .distignore does not list, in the same folders as before. A file that only exists on one machine cannot get into the package. The command stops when files differ from what is committed, and when the tag is not the version of the plugin. gulp and mri are no longer needed.
On every pull request and every push to main, GitHub Actions runs what the README describes for a developer's machine, with the same commands: the formatters and linters, the unit tests, Plugin Check and the packaging in one job; PHPUnit on a single site and on multisite and the end-to-end tests in a job for each combination of WordPress and PHP versions. For that the matrix script has a "default" combination, the versions of the tests site itself, and a --keep option that leaves the site on the combination it ran, and it installs the PHP tools when they are missing. Plugin Check now fails on errors: "wp plugin check" reports them and ends as if all was well. The live test runs only where the repository has an IFRAMELY_API_KEY secret.
Neither has to do with tests: one packages a release, the other is a linter. The two test runners stay in tests/bin. Nothing else changes.
Bump the version, add the changelog entry and an upgrade notice.
siniakinaa
approved these changes
Nov 18, 2026
iparamonau
approved these changes
Nov 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This brings the plugin up to WordPress 7.1, gives it a test suite and CI, and fixes 22 defects found in a review of the code. The largest fixes are in the evergreen cache and in the embed options of the block editor.
What changes for users
+, or values in non-Latin scripts, are no longer lost.api_key,originorurlin the API request. Output of the admin pages is escaped.pre_oembed_resultare kept, and sign-in methods registered afterplugins_loadedwork again.[iframely]shortcode with built-in providers kept, AMP paragraphs, the "Settings" link on multisite, the query string setting, onboarding output.Behaviour changes worth a look
uninstall.php).iqueryblock attribute is no longer written.true.gulpfile.jsis replaced bynpm run release, which packages the tracked files that.distignoredoes not list. The output matches what gulp produced, plusLICENSE.Tests and tooling
IFRAMELY_API_KEYis set.readme.txtwording.npm run test:matrixruns the tests on WordPress 6.6 / PHP 7.4 and on the latest versions..github/workflows/ci.ymlruns all of the above on pull requests and on pushes tomain.