Commit Graph

42673 Commits

Author SHA1 Message Date
Dominik Schilling
9e83d04f84 I18N: Introduce WP_Textdomain_Registry to store text domains and their language directory paths.
Previously, when using `switch_to_locale()` all current loaded text domains were unloaded and added to the `$l10n_unloaded` global. This prevented the just-in-time loading for text domains after a switch. The just-in-time loading was also only possible if the translations were stored in `WP_LANG_DIR`. Both issues have been fixed.

* Adds `WP_Textdomain_Registry` to keep track of the language directory paths for all plugins and themes.
* Updates all `load_*_textdomain()`  functions to store the path in `WP_Textdomain_Registry`.
* Adds `$reloadable` parameter to `unload_textdomain()` to define whether a text domain can be loaded just-in-time again. This is used by `WP_Locale_Switcher::load_translations()`.
* Extends `_load_textdomain_just_in_time()` to also support text domains of plugins and themes with custom language directories.
* Fixes the incorrect `test_plugin_translation_after_switching_locale_twice()` test which should have catch this issue earlier.
* Adds a new test plugin/theme to test the loading of translations with a custom language directory.
* Deprecates the now unused and private `_get_path_to_translation()` and `_get_path_to_translation_from_lang_dir()` functions.

Props yoavf, swissspidy, dd32, ocean90.
See #26511.
Fixes #39210.

git-svn-id: https://develop.svn.wordpress.org/trunk@49236 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-20 16:03:58 +00:00
Sergey Biryukov
e3f28a9a11 General: Add $options parameter to JSON response functions:
* `wp_send_json()`
* `wp_send_json_success()`
* `wp_send_json_error()`

This allows for customizing the options passed to `json_encode()`.

Props eroraghav, hareesh-pillai, garrett-eclipse.
Fixes #51293.

git-svn-id: https://develop.svn.wordpress.org/trunk@49235 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-20 15:54:43 +00:00
Sergey Biryukov
2defb1ef6c Media: Introduce a filter for wp_get_attachment_image() HTML output.
Props prionkor, antpb, donmhico, audrasjb, Mista-Flo, hellofromTonya.
Fixes #50801.

git-svn-id: https://develop.svn.wordpress.org/trunk@49234 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-20 15:29:42 +00:00
Sergey Biryukov
a0be3a4ca7 Docs: Use 3-digit, x.x.x style semantic versioning for @since 5.6.0 entries in WP_Image_Editor_Imagick.
See #50768.

git-svn-id: https://develop.svn.wordpress.org/trunk@49233 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-20 14:52:15 +00:00
Jonathan Desrosiers
9f90177b3f Site Health: Improve the reliability of asynchronous tests.
This change adds additional logic to catch HTTP failures that do not return a `WP_Error` object (for example, a wp-json REST API error error).

This also fixes instances where REST API callbacks performed from cron do not work due to a lack of authentication by introducing a direct callback route that asynchronous tests can register.

Props dd32, clorith, timothyblynjacobs.
Fixes #51547.

git-svn-id: https://develop.svn.wordpress.org/trunk@49232 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-20 14:48:50 +00:00
Sergey Biryukov
62e7a97518 Docs: Update the @since note for _media_states().
Follow-up to [49223].

Props mukesh27.
Fixes #42063.

git-svn-id: https://develop.svn.wordpress.org/trunk@49231 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-20 14:39:49 +00:00
Mike Schroder
7021f5f4b5 Media: Support Stream Wrappers In WP_Image_Editor_Imagick
Since `WP_Image_Editor`'s introduction, stream wrappers have functioned in `WP_Image_Editor_GD`, but haven't been properly supported in `WP_Image_Editor_Imagick`.

- Detects stream wrappers and uses `file_put_contents()` along with `Imagick::read/getImageBlob()` for handling when necessary.
- Introduces private method, `WP_Image_Editor_Imagick::write_image` to handle detection and proper saving.
- Introduces `WP_Test_Stream` class for testing stream wrappers, along with new tests for Imagick's stream handling and a stream filename test.

Adds requirement for `Imagick::readImageBlob()`, available in Imagick >= 2.0.0, which aligns with the current requirement of Imagick >= 2.2.0.

Props p00ya, calin, joemcgill, pputzer, jimyaghi, mikeschroder.
Fixes #42663.

git-svn-id: https://develop.svn.wordpress.org/trunk@49230 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-20 14:35:10 +00:00
Jonathan Desrosiers
fc378e2fe5 Site Health: Use consistent padding around header tags.
Props vinita29, clorith.
Fixes #50638.

git-svn-id: https://develop.svn.wordpress.org/trunk@49229 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-20 14:16:27 +00:00
Jonathan Desrosiers
3d1f3c302d Build/Test Tools: Download Chromium for JS tests.
Partial revert of [49227].

See #50401.

git-svn-id: https://develop.svn.wordpress.org/trunk@49228 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-20 14:09:15 +00:00
Jonathan Desrosiers
6d32bc5192 Build/Test Tools: Download Chromium for E2E tests only.
This prevents Chromium from being downloaded in workflows where it is not required.

See #49621, #50649, #50401.

git-svn-id: https://develop.svn.wordpress.org/trunk@49227 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-20 13:52:28 +00:00
Riad Benguella
9fc20595b6 Block Editor: Update the WordPress Packages to the latest version.
This includes the packages that match the Gutenberg 9.2 Release.
It is going to be the last block-editor features update for WordPress 5.6.
It also updates the block-supports code base to the latest APIs.

Props isabel_brison, noisysocks, desrosj.
Fixes #51570.


git-svn-id: https://develop.svn.wordpress.org/trunk@49226 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-20 13:33:02 +00:00
Jonathan Desrosiers
a8d80fd4a7 Coding Standards: Correct some minor coding standards issues.
Introduced in [49154], [49212], [49223], and [49224].

git-svn-id: https://develop.svn.wordpress.org/trunk@49225 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-20 13:27:48 +00:00
Riad Benguella
123a965c70 Block Editor: Expose api_version in the block type and the REST endpoint.
The new block editor included in 5.6 introduces an api_version property
that indicates which block API version the block is using. 
This commits makes this property available on the block type and the endpoint.

Props TimothyBlynJacobs, gziolo.
Fixes #51529.



git-svn-id: https://develop.svn.wordpress.org/trunk@49224 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-20 07:52:06 +00:00
Helen Hou-Sandi
af767035e7 Media: Indicate if item is or was used as a site option in the details modal.
Props Mista-Flo, melchoyce.
Fixes #42063.


git-svn-id: https://develop.svn.wordpress.org/trunk@49223 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-20 03:12:07 +00:00
Anthony Burchell
b95d64f62a Media: Allow hiding of ‘View attachment page’ link in media modal.
If an empty string is supplied to the `attachment_link` filter the ‘View attachment page’ link will be hidden in the media modal.
Props limera1n, garrett-eclipse, joemcgill, Mista-Flo, hellofromTonya.
Fixes #48325.


git-svn-id: https://develop.svn.wordpress.org/trunk@49222 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-20 02:27:39 +00:00
Sergey Biryukov
16468a23ac Sitemaps: Center the container for sitemap content.
Props ramiy, swissspidy.
Fixes #50658.

git-svn-id: https://develop.svn.wordpress.org/trunk@49221 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-20 02:20:31 +00:00
Jonathan Desrosiers
029dd1bbb9 Bundled Themes: Make Twenty Twenty-One the default theme.
After being imported in [49216], Twenty Twenty-One can now be set as the default theme in WordPress.

See #48110.

git-svn-id: https://develop.svn.wordpress.org/trunk@49220 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-20 02:02:37 +00:00
Sergey Biryukov
9943059356 Help/About: Serve the image on the Freedoms page locally.
Serving the files locally is beneficial for reasons of privacy and speed.

Props garrett-eclipse, pputzer, hellofromTonya.
Fixes #46363.

git-svn-id: https://develop.svn.wordpress.org/trunk@49219 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-20 02:00:46 +00:00
Sergey Biryukov
c7b8b7b974 Help/About: Update Privacy page to include illustration.
This brings some consistency with the Freedoms page.

Follow-up to [43938].

Props melchoyce, garrett-eclipse, hareesh-pillai, ryelle.
Fixes #45395.

git-svn-id: https://develop.svn.wordpress.org/trunk@49218 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-20 01:45:27 +00:00
Jonathan Desrosiers
f3397cc7cf Bundled Themes: Add the theme screenshot for Twenty Twenty-One
Follow up to [49216].

See #51526.

git-svn-id: https://develop.svn.wordpress.org/trunk@49217 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-20 01:27:09 +00:00
Jonathan Desrosiers
4b90066592 Bundled Themes: Import Twenty Twenty-One, the new default theme for WordPress 5.6.
Welcome to the bundled themes family!

Twenty Twenty-One is a blank canvas for your ideas, making the block editor your best brush.

Theme development to this point has taken place on GitHub. See: https://github.com/WordPress/twentytwentyone/.

Props poena, melchoyce, luminuu, elmastudio, bethsoderberg, williampatton, aristath, jffng, kjellr, jeffikus, audrasjb, fabiankaegy, mukesh27, dingo_d, kellylawrence, acosmin, whyisjake, metodiew, ryelle, nielslange, littlebigthing, mahesh901122, zebulan, kishanjasani, lukecavanagh, scruffian, abhijitrakas, utz119, sudoshreyansh, kau-boy, justinahinon, joostdevalk, bduclos, hareesh-pillai, mager19, rolfsiebers, webmigrates, sresok, guidooffermans, francina, marybaum, hareshlive, navanathbhosale, afercia, richtabor, joyously, sarahricker, nrqsnchz, glauberglauber, sabernhardt, kraftbj, ItsJonQ, joen, CTMartin0, decrecementofeliz, bhautikvirani.
See #51526.

git-svn-id: https://develop.svn.wordpress.org/trunk@49216 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-20 01:12:25 +00:00
Sergey Biryukov
2a8dae456d General: Remove noreferrer from wp_targeted_link_rel() and other uses.
When `noopener noreferrer` was originally added in #37941 and related tickets, the `noreferrer` bit was specifically included due to Firefox not supporting `noopener` at the time.

Since `noopener` has been supported by all major browsers for a while, it should now be safe to remove the `noreferrer` attribute from core.

Props Mista-Flo, audrasjb, joostdevalk, jonoaldersonwp, peterwilsoncc, elgameel.
Fixes #49558.

git-svn-id: https://develop.svn.wordpress.org/trunk@49215 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-19 23:37:53 +00:00
Sergey Biryukov
ffbde71040 Themes: Add a return value to set_theme_mod() to allow for error handling.
Props latifi, hareesh-pillai.
Fixes #51296.

git-svn-id: https://develop.svn.wordpress.org/trunk@49214 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-19 22:43:21 +00:00
Sergey Biryukov
d86bda1180 Administration: Remove obsolete .ac_results class references.
Core does not use the jQuery.suggest plugin since [38797].

Props afercia, hareesh-pillai, garrett-eclipse.
Fixes #40260.

git-svn-id: https://develop.svn.wordpress.org/trunk@49213 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-19 22:31:08 +00:00
Helen Hou-Sandi
80329c379a Multisite: More specific caching for get_dirsize.
Instead of one cache entry for all upload folders for a site on multisite, this now caches for each folder and invalidates that cache based on context. In multisite, this should speed up `get_dirsize` calls since older directories that are much less likely to change will no longer have the size recalculated.

Props janthiel, A5hleyRich, batmoo.
Fixes #19879.


git-svn-id: https://develop.svn.wordpress.org/trunk@49212 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-19 21:49:58 +00:00
Sergey Biryukov
052ac08385 Pings/Trackbacks: Split do_all_pings() into several functions:
* `do_all_pingbacks()`
* `do_all_enclosures()`
* `do_all_trackbacks()`

This allows for the specific removal/replacement of one of more services.

Props dshanske, garrett-eclipse, Mista-Flo, azaozz, hellofromTonya.
Fixes #36576.

git-svn-id: https://develop.svn.wordpress.org/trunk@49211 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-19 21:14:06 +00:00
Sergey Biryukov
bcfa865733 Editor: Expose the embed core block on the server.
Props ntsekouras, gziolo.
Fixes #51531.

git-svn-id: https://develop.svn.wordpress.org/trunk@49210 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-19 20:55:43 +00:00
Sergey Biryukov
98b6f199ef Coding Standards: Fix WPCS issues in [49207].
See #46866.

git-svn-id: https://develop.svn.wordpress.org/trunk@49209 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-19 20:43:34 +00:00
Sergey Biryukov
ab19c66463 Bundled Themes: Declare support for the html5 feature navigation-widgets.
Widgets that output a list of links are now wrapped within `<nav>` elements to improve semantics and accessibility.

The `<nav>` elements are native landmark regions, which helps assistive technology users to navigate through them.

Follow-up to [48349], [49177].

Props hareesh-pillai, justinahinon, afercia, williampatton.
Fixes #51445.

git-svn-id: https://develop.svn.wordpress.org/trunk@49208 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-19 20:30:47 +00:00
Anthony Burchell
ec624193eb Media: Add 'Uploaded to' for individual media items in the media editor.
Adds a link in the media editor showing which post a media item was uploaded to.
Props karmatosed, garrett-eclipse, Mista-Flo, SergeyBiryukov, joemcgill, hellofromTonya.
Fixes #46866.


git-svn-id: https://develop.svn.wordpress.org/trunk@49207 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-19 20:27:34 +00:00
Sergey Biryukov
8f88adf9d5 Coding Standards: Use more specific checks for $wpdb->get_row() results.
If `$wpdb->get_row()` is successful and the `$output` parameter has not been set, the output will be an instance of `stdClass`, so test to confirm that instead of testing against "not null".

This affects:
* `wpmu_validate_user_signup()`
* `wpmu_validate_blog_signup()`

Props jrf.
See #50767.

git-svn-id: https://develop.svn.wordpress.org/trunk@49206 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-19 20:18:44 +00:00
Anthony Burchell
1dd1db6ec0 Media: Indicate if media is header video in media library.
This introduces a label to indicate if a piece of media is being used as a video header in the media library.
Props desrosj, Mista-Flo, mikeschroder.
Fixes #42929.


git-svn-id: https://develop.svn.wordpress.org/trunk@49205 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-19 18:30:36 +00:00
Jonathan Desrosiers
6c31412a70 Build/Test Tools: Improve the clarity for PHPUnit workflow strategy.
This change makes better use of the job strategy matrix for workflows. By using `include`, the memcached and test reporting job can be configured more clearly.

Props ocean90.
See #50401.

git-svn-id: https://develop.svn.wordpress.org/trunk@49204 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-19 18:22:21 +00:00
Sergey Biryukov
c25f1719bf Widgets: Introduce before_sidebar and after_sidebar arguments for register_sidebar().
Props deepaklalwani, flixos90, christophherr, dgwyer, markoheijnen, morganestes, audrasjb.
Fixes #19709.

git-svn-id: https://develop.svn.wordpress.org/trunk@49203 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-19 15:38:11 +00:00
Sergey Biryukov
1ca7bc6718 Embeds: Only catch clicks from the primary mouse button in the click handler, without any modifier keys.
This ensures that Ctrl/Cmd + click to open a link in the embed iframe in a new tab works as expected.

Props timhavinga, garrett-eclipse, smerriman, swissspidy, johnbillion, Mte90, iandunn, azaozz, afercia, audrasjb, SergeyBiryukov.
Fixes #39097.

git-svn-id: https://develop.svn.wordpress.org/trunk@49202 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-19 13:34:03 +00:00
Sergey Biryukov
4362706c10 Docs: Add a @deprecated note to WP_Community_Events::format_event_data_time().
Follow-up to [49146].

See #51130.

git-svn-id: https://develop.svn.wordpress.org/trunk@49201 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-19 13:20:50 +00:00
Peter Wilson
86fc3af215 Canonical: Support multiple post types in redirect_guess_404_permalink().
Prevent `redirect_guess_404_permalink()` from throwing a notice when multiple post types are included in the `post_type` query.

Props junaidbhura.
Fixes #43056.



git-svn-id: https://develop.svn.wordpress.org/trunk@49200 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-18 23:21:03 +00:00
Sergey Biryukov
0392a498db Networks and Sites: Introduce network_site_info_form action.
The action fires at the end of the site info form in network admin, and complements the existing `network_site_new_form` action.

Props virgodesign.
Fixes #50704.

git-svn-id: https://develop.svn.wordpress.org/trunk@49199 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-18 21:15:51 +00:00
John Blackbourn
5efc326c34 Media: Add an image_sideload_extensions filter to the list of allowed file extensions when sideloading an image from a URL.
Props paulschreiber, hellofromTonya

Fixes #50695


git-svn-id: https://develop.svn.wordpress.org/trunk@49198 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-18 21:04:33 +00:00
John Blackbourn
ef8b5078f6 Docs: Further corrections and promotions for docblocks relating to object types.
See #50768


git-svn-id: https://develop.svn.wordpress.org/trunk@49197 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-18 20:52:01 +00:00
John Blackbourn
89a402c49c Docs: Improve the docs for the globals that are used in the actions and filters API.
See #50531, #50768


git-svn-id: https://develop.svn.wordpress.org/trunk@49196 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-18 19:17:29 +00:00
John Blackbourn
d51fc4b06c Media: Add an audio and video player to the media manager modal.
This introduces a means of playing existing audio and video files while browsing them prior to selecting them for use.

Props antpb, Mista-Flo, garrett-eclipse, mapk

Fixes #43640


git-svn-id: https://develop.svn.wordpress.org/trunk@49195 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-18 17:37:19 +00:00
Sergey Biryukov
422a9049b5 Code Modernization: Use instanceof instead of a comparison with get_class().
Includes adjusting external libraries which are no longer maintained externally.

Props jrf.
See #50767.

git-svn-id: https://develop.svn.wordpress.org/trunk@49194 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-18 17:31:37 +00:00
Sergey Biryukov
97b2f07d2e Coding Standards: Replace alias PHP functions with the canonical names.
Using the canonical function name for PHP functions is strongly recommended, as aliases may be deprecated or removed without (much) warning.

This replaces all uses of the following:
* `join()` with `implode()`
* `sizeof()` with `count()`
* `is_writeable()` with `is_writable()`
* `doubleval()` with a `(float)` cast

In part, this is a follow-up to #47746.

Props jrf.
See #50767.

git-svn-id: https://develop.svn.wordpress.org/trunk@49193 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-18 17:25:10 +00:00
Sergey Biryukov
f124a650ba Coding Standards: Use self when appropriate.
* `WP_List_Table::get_default_primary_column_name()` is a protected method, so calling it statically with the class name is bad practice.
* Similarly, this applies when calling a private constructor in `WP_Screen::get()`.

Props jrf.
See #50767.

git-svn-id: https://develop.svn.wordpress.org/trunk@49192 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-18 17:16:33 +00:00
John Blackbourn
f41b6b4d2e Administration: Allow WP_List_Table::get_bulk_items() to receive a nested array in order to output optgroups.
The allowed format for bulk actions is now an associative array where each element represents either a top level option value and label, or an array representing an optgroup and its options.

For a standard option, the array element key is the field value and the array element value is the field label.

For an optgroup, the array element key is the label and the array element value is an associative array of options as above.

Props goldenapples, mattkeys, valentinbora, davidbaumwald

Fixes #19278


git-svn-id: https://develop.svn.wordpress.org/trunk@49190 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-18 16:20:07 +00:00
Drew Jaynes
1f1adbeee8 Docs: Clarify documentation for what the 'count' orderby argument represents in WP_Term_Query.
Props jeremyescott.
Fixes #44443.


git-svn-id: https://develop.svn.wordpress.org/trunk@49189 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-18 08:21:06 +00:00
Sergey Biryukov
2991a01f3f Formatting: Deprecate wp_slash_strings_only() in favor of wp_slash().
The reason for introducing `wp_slash_strings_only()` in [46454] was to keep non-string values untouched.

Later, `wp_slash()` itself was updated in [48433] to prevent changing non-string values.

To avoid confusion, `wp_slash_strings_only()` is now deprecated.

Props ayeshrajans, ocean90.
Fixes #50635.

git-svn-id: https://develop.svn.wordpress.org/trunk@49188 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-18 06:55:16 +00:00
Sergey Biryukov
7164e4b4c8 Comments: Hide the link to the initial parent comment in the reply heading when replying to another comment.
This ensures that the reply heading is updated correctly on single post URLs with the `?replytocom` query argument.

Follow-up to [47506], [48876], [48904].

Props mailnew2ster, wpamitkumar, audrasjb, desrosj, SergeyBiryukov.
Fixes #51175.

git-svn-id: https://develop.svn.wordpress.org/trunk@49187 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-18 06:39:21 +00:00
Sergey Biryukov
918bebfe3c Code Modernization: Remove unnecessary reference sign from PO::export_entry() definition.
This fixes a PHP 8 "argument must be passed by reference, value given" error when using `array_map()` in `PO::export_entries()`.

Object variables in PHP 5+ contain a reference to the object, and it's the reference that's passed around.

Props jrf.
See #50913.

git-svn-id: https://develop.svn.wordpress.org/trunk@49186 602fd350-edb4-49c9-b593-d223f7449a82
2020-10-18 06:27:38 +00:00