* `str_contains()`
* `str_ends_with()`
* `str_starts_with()`
Additionally, include a test for a PDF file in an `<object>` tag with an unsupported protocol.
Follow-up to [51963], [52039], [52040], [52304], [52309].
Props TobiasBg, ramonopoly.
See #54261.
git-svn-id: https://develop.svn.wordpress.org/trunk@52326 602fd350-edb4-49c9-b593-d223f7449a82
The task was previously used to ensure that `/*! This file is auto-generated */` comment is not included on front end as part of the inline emoji detection script.
As the `wp-emoji-loader.js` script is now included via `file_get_contents()` and `wp_print_inline_script_tag()` instead of `grunt-include` to simplify the logic, the task does not find anything to replace and is no longer necessary.
Additionally, include a line break before the `wp-emoji-loader.js` script content for better line wrapping.
Follow-up to [48096], [50651], [52132].
See #44632, #44306, #53363.
git-svn-id: https://develop.svn.wordpress.org/trunk@52325 602fd350-edb4-49c9-b593-d223f7449a82
Update packages to include these bug fixes from Gutenberg:
- Gallery block: turn on auto-migration of v1 Gallery blocks to v2 format when edited
- Add accessible labelling to submenu buttons.
- Improve performance of wp_navigation lookup.
- Various inline docblock corrections
- Use core version of template and template part post types and REST endpoints for WP 5.9, with back compat for 5.8
- Gradients: Enable adding custom gradient when gradients are disabled
- Custom color palette: add default color name
- Color Picker: Re-instate debounce and controlled value to fix issue with gradient picker
- Add aria-current="page" to active navigation item
- Site Editor: Templat list fallback to slug
- Fix: Custom color picker popover position
- Fix: php 5.6 error in theme JSON class.
- Update the WP_Theme_JSON_Gutenberg class to be like the core one
- Update the WP_Theme_JSON_Resolver_Gutenberg class to be like the core one
- Move Global Styles code to lib/compat/wordpress-5.9 folder
- E2E Tests: Fix failing image e2e test by waiting for required element
- Navigation: Try removing absorb toolbar prop.
- Navigation: Fix navigation justifications.
- Fix wordbreak for URLs
- Polish unset color indicator.
- Template revert flow: Make label description source agnostic
- [Block Library - Navigation]: Fix vertical layout
- Add: Corners to custom color picker popover
- Add: Missing margin to the color picker clear button
- Gradient: Fix clearing a custom gradient from throwing a React warning
- [Block Library]: Rename Query Pagination blocks
- PHP Unit Tests: Use global transients
- Remove CSS that causes conflict with theme.json
- Add actions which fire during the loading process of block template parts
- Fix usage of useSetting('color.palette')
- Update micromodal, include click-through fix
- Site Editor: Remove unused PHP code
- Don't try and render unstable location if Nav block has ID
- Fix gutenberg prefixed function references in core
- Card: support the extraSmall option for the size prop
- Gallery block: enable the new gallery block by default if running in core
- Block fixtures: Change port to 8889 to placate KSES
- Full Site Editing: Remove block template resolution unit tests
- Site Editor: Sync export API
See #54487.
git-svn-id: https://develop.svn.wordpress.org/trunk@52324 602fd350-edb4-49c9-b593-d223f7449a82
When using a `foreach` loop with a value assigned by reference, the variable continues to point to the last array element even after the loop, so it is recommended to destroy it by `unset()` to avoid unexpected behavior later on.
See [https://www.php.net/manual/en/control-structures.foreach.php PHP Manual: foreach].
Follow-up to [52312], [52313].
Props TobiasBg.
See #54558.
git-svn-id: https://develop.svn.wordpress.org/trunk@52322 602fd350-edb4-49c9-b593-d223f7449a82
* Make the `@since 5.9.0` notes more specific. When mentioning that parameters or values have been added or changed, it is generally also helpful to include their exact names and the nature of changes for future reference.
* Update some DocBlocks per the documentation standards.
Follow-up to [52049], [52306].
See #53399, #54336.
git-svn-id: https://develop.svn.wordpress.org/trunk@52320 602fd350-edb4-49c9-b593-d223f7449a82
The template resolution system makes a request like `/?page_id=1234&_wp-find-template=true`, depending on `WP_Query` to resolve a page or post using the page_id or p (post_id) in the query string. With new posts/pages, a placeholder post with the status auto-draft is created. But by default `WP_Query` will not resolve these posts, unless the query is specifically set to look for them.
This commit handles the query string to properly resolve a page or post. It adds 2 private callbacks for the processing.
Props poena, noisysocks, bernhard-reiter, costdev, hellofromTonya.
Fixes#54553.
git-svn-id: https://develop.svn.wordpress.org/trunk@52316 602fd350-edb4-49c9-b593-d223f7449a82
Renaming the classname was missed in [52244] when updating changes in `WP_Http::request()` for the Requests 2.0.0 external library upgrade. `HTTP` class no longer exists and caused a fatal error `Fatal error: Uncaught Error: Class 'WpOrg\Requests\Proxy\HTTP' not found`.
This commit renames the class to `Http` and resolves the fatal error.
Follow-up to [52244].
Props alexeydemidov, costdev, mukesh27.
Fixes#54562.
git-svn-id: https://develop.svn.wordpress.org/trunk@52315 602fd350-edb4-49c9-b593-d223f7449a82
At the time tests were backported from Gutenberg, a block template theme was not available in the test suite; thus, the test was marked as `markTestIncomplete()`.
Now that `block-theme` and `block-theme-child` test fixture block template themes are available, this commit removes the `markTestIncomplete()` and adjusts the test to run by switching to the `block-theme` test fixture.
Follow-up to [51003], [52062], [52247].
Props bernhard-reiter.
Fixes#54551.
git-svn-id: https://develop.svn.wordpress.org/trunk@52314 602fd350-edb4-49c9-b593-d223f7449a82
This changes adds a leading slash when needed in the `?context=edit` path to avoid an `undefined index` notice in the Template Parts Editor.
Follow-up to [52275].
Props kafleg, costdev, mukesh27, Boniu91.
Fixes#54558.
git-svn-id: https://develop.svn.wordpress.org/trunk@52312 602fd350-edb4-49c9-b593-d223f7449a82
Improves the URL validation in `_wp_kses_allow_pdf_objects()` to account for sites using an upload path that contains a port, for example wp.org:8080.
Follow up to [51963], [52304].
Props ocean90, ramonopoly, talldanwp.
See #54261.
git-svn-id: https://develop.svn.wordpress.org/trunk@52309 602fd350-edb4-49c9-b593-d223f7449a82
This change fixes template resolution to give precedence to child theme PHP templates over parent theme block templates with equal specificity.
Before this change, when a theme was using a PHP template of a certain specificity (e.g. `page-home.php`), and it happened to be a child theme of another theme which had a block template for the same specificity (e.g. `page-home.html`), WordPress was picking the parent theme’s block template over the child theme’s PHP template to render the page. If the PHP and block template have equal specificity, the child theme's template should be used.
The issue was fixed before in Gutenberg so the fix now needs to happen in Core.
This change also re-enables the preexisting template resolution unit tests.
Follow-up to [51003].
Props bernhard-reiter, youknowriad.
Fixes#54515.
git-svn-id: https://develop.svn.wordpress.org/trunk@52308 602fd350-edb4-49c9-b593-d223f7449a82
Add callback validation to HTML tag attributes for increased flexibility over an array of values only.
In `object` tags, validate the `data` attribute via a callback to ensure it is a PDF and matches the `type` attribute. This prevents mime type mismatches in browsers.
Follow up to [51963].
Props Pento, dd32, swissspidy, xknown, peterwilsoncc.
Fixes#54261.
git-svn-id: https://develop.svn.wordpress.org/trunk@52304 602fd350-edb4-49c9-b593-d223f7449a82
These functions don't require the callback to be a valid callable, therefore `array` and `string` are also valid types for this parameter.
Props malthert
Fixes#54440
git-svn-id: https://develop.svn.wordpress.org/trunk@52300 602fd350-edb4-49c9-b593-d223f7449a82
To prevent potential false negatives, set `$error` to `null` initially, so we can better tell if it was ever changed during the sanitization and be able to better react if an empty string is added to it.
Additionally, and mainly for the sake of the Settings API at this point, add error messages to some `WP_Error` objects returned from `wpdb` methods that were previously causing the issues here.
Follow-up to [32791].
Props iCaleb, audrasjb, hellofromTonya, SergeyBiryukov.
Fixes#53986.
git-svn-id: https://develop.svn.wordpress.org/trunk@52294 602fd350-edb4-49c9-b593-d223f7449a82
Adds CSS to hide both the visibility and status settings for the `wp_navigation` post type.
Props antonvlasenko , costdev.
Fixes#54407.
git-svn-id: https://develop.svn.wordpress.org/trunk@52293 602fd350-edb4-49c9-b593-d223f7449a82
`sanitize_key()` expects a string type for the given `key`. Passing any other data type to `strtolower()` can result in `E_WARNING: strtolower() expects parameter 1 to be string, array given`.
A check is added that if the key is not a string, the key is set to an empty string. For performance, the additional string processing is skipped if the key is an empty string.
This change maintains backwards-compatibility for valid string keys while fixing the bug of non-string keys.
Props costdev, dd32.
Fixes#54160.
git-svn-id: https://develop.svn.wordpress.org/trunk@52292 602fd350-edb4-49c9-b593-d223f7449a82
As capability queries was introduced in 5.9, this commit allows for previous versions by assigning the "who" and unsetting "capability".
Follow-up to [51943].
Props johnbillion, swissspidy.
Fixes#16841.
git-svn-id: https://develop.svn.wordpress.org/trunk@52290 602fd350-edb4-49c9-b593-d223f7449a82
* Check for direct PHP flle access and only use `rename()` if true.
* Check whether the destination directory was successfully created.
* Clear the working directory so there is internal parity within the function between the results of a successful `rename()` and a fallback to `copy_dir()`.
* Use `move_dir()` in `WP_Upgrader::move_to_temp_backup_dir()` and `::restore_temp_backup()`.
Follow-up to [51815], [51898], [51899], [51902], [52192], [52284].
Props afragen, peterwilsoncc, dd32, SergeyBiryukov.
See #54166, #51857.
git-svn-id: https://develop.svn.wordpress.org/trunk@52289 602fd350-edb4-49c9-b593-d223f7449a82
Follow-up to [52287] which added an undefined variable. The variable should have been the global `wp.media.view.settings.infiniteScrolling`. This commit brings that global setting into each of the functions and renames the variable using camelCase to comply with JS coding standards.
Follow-up to [52287].
Props SergeyBiryukov.
Fixes#53765.
git-svn-id: https://develop.svn.wordpress.org/trunk@52288 602fd350-edb4-49c9-b593-d223f7449a82
Follow-up to [52167], which partially fixed a bug introduced in [50829] that caused media modal to only load the selected image.
This commit adds additional checks to ensure infinite scroll is disabled.
Follow-up to [50829], [52167].
Props dariak, joedolson, szaqal21.
Fixes#53765.
git-svn-id: https://develop.svn.wordpress.org/trunk@52287 602fd350-edb4-49c9-b593-d223f7449a82
Add a REST API to export site templates and template part as html files. When the REST API is requested, it responds by downloading a single ZIP file and exits early, without completing full request. To create the exported zip, the ZipArchive class is required. If this class is not present then the export will gracefully fail, returning a `WP_Error` object and 500 status error code.
Props spacedmonkey, youknowriad, Mamaduka, walbo, peterwilsoncc.
Fixes#54448 .
git-svn-id: https://develop.svn.wordpress.org/trunk@52286 602fd350-edb4-49c9-b593-d223f7449a82
Trying to schedule cron jobs before WordPress is installed results in DB errors, which is suboptimal.
This addresses a `Table 'wp_options' doesn't exist` error when running the installation with `WP_DEBUG` enabled.
Follow-up to [51815], [51898], [51899], [51902], [52192].
Props dlh, pbiron.
See #51857.
git-svn-id: https://develop.svn.wordpress.org/trunk@52284 602fd350-edb4-49c9-b593-d223f7449a82
This commit syncs minor changes for the default theme from its active development repository to core.
This is a follow up to [52081], [52107], [52164], and [52222]. It includes changes to template part markup, theme.json appearance flags, navigation block markup, and text domains. For a full set of changes, visit 742df6cb2b...1a121e0224.
Props poena, kjellr, onemaggie, hellofromtonya.
See #54318.
git-svn-id: https://develop.svn.wordpress.org/trunk@52283 602fd350-edb4-49c9-b593-d223f7449a82
[51962] and [51964] introduced two new functions: `rest_get_route_for_post_type_items()` and `rest_get_route_for_taxonomy_items()`. These functions replaced hardcoded references in all parts of core that reference taxonomy and post type rest controller endpoints. However, several instances were missed in the `wp-admin/site-editor.php` file.
This commit replaces those remaining hardcoded instances.
Follow-up to [51962], [51964], [52232].
Props spacedmonkey.
Fixes#54536.
git-svn-id: https://develop.svn.wordpress.org/trunk@52281 602fd350-edb4-49c9-b593-d223f7449a82
This change removes the internationalization of the "Custom Styles" specific posts as the post title being hardcoded is consistent with `wp_template_part` and `wp_template` post types, and is not publicly visible, except in the database. Moreover, using consistent "Custom Styles" post title may make is easier to retrieve the related posts in the database.
Props antonvlasenko, audrasjb, desrosj, hellofromTonya.
Fixes#54518.
git-svn-id: https://develop.svn.wordpress.org/trunk@52280 602fd350-edb4-49c9-b593-d223f7449a82
For block themes (like Twenty Twenty-Two), Customizer menu item is removed and replaced with the Site Editor menu item. However, other links exist in the Dashboard's welcome panel "Customize Your Site" button and the "Customize" button in each theme listed in the Appearance > Themes interface.
This commit changes each of those remaining links to link to the Site Editor interface instead of the Customizer.
To help identify block vs non-block themes, two method methods are introduced in `WP_Theme`:
* `WP_Theme:: is_block_based()` which identifies if the theme is a block theme or not.
* `WP_Theme::get_file_path()` which is similar to `get_theme_file_path()` but uses the directories within the theme object.
Both of these new methods include test coverage including the addition of a parent and child block theme in test data.
Follow-up to [18749], [35483], [42013], [42169].
Props antonvlasenko, jameskoster, hellofromTonya, matveb, noisysocks, poena, sergeybiryukov.
Fixes#54460.
git-svn-id: https://develop.svn.wordpress.org/trunk@52279 602fd350-edb4-49c9-b593-d223f7449a82