Commit Graph

1908 Commits

Author SHA1 Message Date
Peter Wilson
f888c5cbbb Login and Registration: Improve messaging for invalid log-out nonces.
Clarify messaging of when `wp_nonce_ays('log-out')` is called due to an invalid log out nonce. The HTML title now describes the action being taken rather than using the generic text "something went wrong".

Props davidkryzaniak, hellofromTonya, peterwilsoncc.
Fixes #52600.


Built from https://develop.svn.wordpress.org/trunk@52088


git-svn-id: http://core.svn.wordpress.org/trunk@51680 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-11-09 23:09:00 +00:00
hellofromTonya
8853582220 General: Convert wp_list_filter() into a wrapper for wp_filter_object_list().
The code in `wp_list_filter()` was a duplicate of `wp_filter_object_list()`, minus the `WP_List_Util::pluck()` (used when `$field` is configured).

In testing the wrapper, discovered an edge case (and potential bug) in `WP_List_Util::filter()` where if the operator matches an empty array was returned without resetting the output property. Without that property being set correctly, `WP_List_Util::get_output()` was not correct. This commit also fixes this by resetting the property to an empty array.  

Follow-up to [15686], [17427], [38928], [51044].

Props pbearne, sergeybiryukov, hellofromTonya.
Fixes #53988.
Built from https://develop.svn.wordpress.org/trunk@52066


git-svn-id: http://core.svn.wordpress.org/trunk@51658 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-11-09 01:10:59 +00:00
John Blackbourn
4c3a23ba40 Docs: Fix some docblock syntax errors and add a missing canonical reference.
See #53399, #52867, #38942, #53668

Built from https://develop.svn.wordpress.org/trunk@52034


git-svn-id: http://core.svn.wordpress.org/trunk@51626 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-11-08 10:44:59 +00:00
antpb
c1f6817cad Media: Remove security messaging in media upload failures.
Previously, when uploading a media item type that is not supported, the default error message claims that the reason it cannot upload is due to security reasons. This is not always true. Now the warning says that the type is not allowed, which is always true.

Props antpb, Presskopp, peterwilsoncc, desrosj, iluy, circlecube, mikeschroder.
Fixes #53626.


Built from https://develop.svn.wordpress.org/trunk@52032


git-svn-id: http://core.svn.wordpress.org/trunk@51624 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-11-07 23:29:56 +00:00
John Blackbourn
c274d3c520 Docs: Miscellaneous docblock improvements.
See #53399

Built from https://develop.svn.wordpress.org/trunk@51957


git-svn-id: http://core.svn.wordpress.org/trunk@51546 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-10-30 20:17:01 +00:00
John Blackbourn
0775153e27 Date/Time: Improve the docblocks for various date and time related functions.
See #53399, #28992, #40653

Built from https://develop.svn.wordpress.org/trunk@51950


git-svn-id: http://core.svn.wordpress.org/trunk@51539 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-10-29 16:51:56 +00:00
hellofromTonya
4471c3787c FileSystem API: Fix autovivification deprecation notice in recurse_dirsize().
>PHP natively allows for autovivification (auto-creation of arrays from falsey values). This feature is very useful and used in a lot of PHP projects, especially if the variable is undefined. However, there is a little oddity that allows creating an array from a `false` and `null` value.

The above quote is from the PHP 8.1 RFC and the (accepted) RFC changes the behaviour described above to deprecated auto creation of arrays from `false`. As it is deprecated, it _will_ still work for the time being, but as of PHP 9.0, this will become a Fatal Error, so we may as well fix it now.

The `recurse_dirsize()` function retrieves a transient and places it in the `$directory_cache` variable, but the `get_transient()` function in WP returns `false` when the transient doesn't exist, which subsequently can lead to the above mentioned deprecation notice.

By verifying that the `$directory_cache` variable is an array before assigning to it and initializing it to an empty array, if it's not, we prevent the deprecation notice, as well as harden the function against potentially corrupted transients where this transient would not return the expected array format, but some other variable type.

Includes adding dedicated unit tests for both the PHP 8.1 issue, as well as the hardening against corrupted transients.

Includes some girl-scouting: touching up a parameter description and some code layout.

Refs:
* https://wiki.php.net/rfc/autovivification_false
* https://developer.wordpress.org/reference/functions/get_transient/

Follow-up to [49212], [49744].

Props jrf, hellofromTonya.
See #53635.
Built from https://develop.svn.wordpress.org/trunk@51911


git-svn-id: http://core.svn.wordpress.org/trunk@51504 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-10-15 22:53:58 +00:00
hellofromTonya
82141be0d8 FileSystem API: Fix infinite loop on Windows for clean_dirsize_cache().
When the PHP native `dirname()` function is used on a Windows disk name - i.e. `C:\`-, it will return the same, i.e, it will return `C:\` again.

The `clean_dirsize_cache()` function didn't have guard clause against this, which meant that on Windows based systems and IIS servers, this function would result in WordPress getting stuck into an infinite loop.

The adjustment to the `while` part of the function fix this by checking if the return value of the `dirname()` function call is the same as the original path passed to `dirname()`, which effectively fixes the infinite loop.

A number of other improvements made:

1. Add input validation for the `$path` parameter to guard against invalid variable types being passed into the function.

2. Guard against an empty `$path` parameter, which would result in an infinite loop on both Windows as well as *nix based systems.

In both these cases, a PHP notice will now be thrown.

3. When a non-empty string, which isn't a path would previously be passed, the `dirname()` function would transform that to a `.` and the `.` key in the transient cache would be cleared out.
This was a bug as there is no relation between a non-path string and the root directory of file system.

This bug has been fixed by checking that something could actually be a path and handling received non-empty, non-path input parameters in a special way, i.e only removing the cache key for the passed string and bowing out from further processing.

Unfortunately, no tests can be added to guard against the infinite loop.

For the other fixes, we have added appropriate unit tests. 

Follow-up up [49212], [49616], [49744].

Props jrf, hellofromTonya, raubvogel, sergeybiryukov, codezen8, sjlevy, drosmog, teachlynx, ekojr, bartoszgrzesik, joegasper, janthiel, josephdickson, ocean90, audrasjb.
Fixes #52241.
Built from https://develop.svn.wordpress.org/trunk@51910


git-svn-id: http://core.svn.wordpress.org/trunk@51503 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-10-15 22:25:01 +00:00
John Blackbourn
41995176f6 Docs: Miscellaneous inline documentation improvements, including:
* Document the post statuses global as an array of `stdClass` objects
* Document the taxonomies global as an array of `WP_Taxonomy` objects
* Document the return value of the post count functions as `stdClass` objects
* Fix some typos

See #53399

Built from https://develop.svn.wordpress.org/trunk@51885


git-svn-id: http://core.svn.wordpress.org/trunk@51478 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-10-04 20:44:02 +00:00
hellofromTonya
b8322a053e Code Modernization: Fix null to non-nullable deprecation in wp_privacy_anonymize_ip().
The `wp_privacy_anonymize_ip()` function expects a string for the `$ip_addr` parameter, but did not do any input validation.

One of the pre-existing test cases, passed `null` to the function, leading to a `substr_count(): Passing null to parameter #1 ($haystack) of type string is deprecated` notice on PHP 8.1.

Fixed now by doing a cursory check on the variable at the start of the function and bowing out early for a number of cases (`null`, `false`, `0`, `''`) which would all result in the same `0.0.0.0` output anyway.

Follow-up [42971].

Props jrf, hellofromTonya.
See #53635.
Built from https://develop.svn.wordpress.org/trunk@51793


git-svn-id: http://core.svn.wordpress.org/trunk@51400 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-09-09 22:56:56 +00:00
Sergey Biryukov
e1e1d021ea General: Only use _jsonp_wp_die_handler() for JSONP REST API requests.
Props mdawaffe, peterwilsoncc.
Built from https://develop.svn.wordpress.org/trunk@51740


git-svn-id: http://core.svn.wordpress.org/trunk@51348 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-09-08 17:16:57 +00:00
desrosj
5090761b4f Coding Standards: Apply some minor alignment fixes.
These are updates caused by running `composer format`.

Follow up to [51501], [51599], [51618], [51653].
See #53359, #50542, #53238, #53668, #53690.
Built from https://develop.svn.wordpress.org/trunk@51693


git-svn-id: http://core.svn.wordpress.org/trunk@51299 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-30 14:09:58 +00:00
Andrew Ozz
94a990de99 Media: Fix wp_unique_filename() to check for name collisions with all alternate file names when an image may be converted after uploading. This includes possible collinions with pre-existing images whose sub-sizes/thumbnails are regenerated.
Props ianmjones, azaozz.
Fixes #53668.
Built from https://develop.svn.wordpress.org/trunk@51653


git-svn-id: http://core.svn.wordpress.org/trunk@51259 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-24 20:52:03 +00:00
Sergey Biryukov
532bd808c9 Code Modernization: Check the input type in validate_file().
This fixes a `preg_match_all(): Passing null to parameter #2 ($subject) of type string is deprecated` notice on PHP 8.1.

The behavior for `null` and `string` input is covered by the existing `Tests_Functions::test_validate_file()` test.

Effect: Errors down by 238, assertions up by 1920, failures down by 1.

Props jrf, hellofromTonya, SergeyBiryukov.
See #53635.
Built from https://develop.svn.wordpress.org/trunk@51625


git-svn-id: http://core.svn.wordpress.org/trunk@51231 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-16 22:53:02 +00:00
gziolo
2f6eb9d25e Blocks: Add support for variations in block.json` file
We integrated variations with block types and the corresponding REST API endpoint in #52688. It's a follow-up patch to add missing support to the `block.json` metadata file when using `register_block_type`.

Some fields for variations are translatable.Therefore, i18n schema was copied over from Gutenberg: https://github.com/WordPress/gutenberg/blob/trunk/packages/blocks/src/api/i18n-block.json. The accompanying implementation was adapted as `translate_settings_using_i18n_schema`.

Props: gwwar, swissspidy, schlessera, jorgefilipecosta.
Fixes #53238.


Built from https://develop.svn.wordpress.org/trunk@51599


git-svn-id: http://core.svn.wordpress.org/trunk@51210 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-11 09:08:01 +00:00
Sergey Biryukov
04f4e911dc Coding Standards: Silence a WPCS warning in date_i18n().
This fixes a "Calling `current_time()` with a `$type` of `timestamp` or `U` is strongly discouraged as it will not return a Unix (UTC) timestamp" warning.

Props jrf.
See #53359.
Built from https://develop.svn.wordpress.org/trunk@51557


git-svn-id: http://core.svn.wordpress.org/trunk@51168 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-05 14:49:57 +00:00
John Blackbourn
ea60cd8191 Docs: Descriptive improvements and corrections for various docblocks.
See #53399

Built from https://develop.svn.wordpress.org/trunk@51300


git-svn-id: http://core.svn.wordpress.org/trunk@50909 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-01 21:12:58 +00:00
iandunn
3801e9818a Media: Revert r51211 to restore ms-files.php assets.
r51211 accidentally introduced a fatal error for Multisite instances with `ms_files_rewriting` enabled. Reverting removes the error, and the original purpose of the commit can be solved in another way.

Props otto42, barry, ryelle, azaozz.
Fixes #53492. See #53475.

Built from https://develop.svn.wordpress.org/trunk@51223


git-svn-id: http://core.svn.wordpress.org/trunk@50832 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-06-23 22:20:59 +00:00
Andrew Ozz
e93093f7ed Media: Prevent uploading and show an error message when the server doesn't support editing of WebP files and image sub-sizes cannot be created.
Props adamsilverstein, desrosj, azaozz
Fixes #53475
Built from https://develop.svn.wordpress.org/trunk@51211


git-svn-id: http://core.svn.wordpress.org/trunk@50820 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-06-22 23:12:57 +00:00
jorgefilipecosta
6db7930147 Ports theme.json changes for beta 3.
- Add _wp_to_kebab_case function
- Add CSS Custom Properties within preset classes.

Props nosolosw.
See #53397.
Built from https://develop.svn.wordpress.org/trunk@51198


git-svn-id: http://core.svn.wordpress.org/trunk@50807 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-06-22 09:51:00 +00:00
Sergey Biryukov
e127bcde70 Themes: Make sure get_file_data() recognizes headers prefixed by <?php tag.
This allows for using headers in the format of `<?php // Template Name: Something ?>`, which previously could not be recognized correctly.

Props dd32, m_uysl, thomas-vitale, boblinthorst.
Fixes #33387.
Built from https://develop.svn.wordpress.org/trunk@51182


git-svn-id: http://core.svn.wordpress.org/trunk@50791 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-06-18 14:03:58 +00:00
Sergey Biryukov
b964d532e2 Docs: Add a @since note to wp_parse_id_list() and wp_parse_slug_list() about using wp_parse_list().
Follow-up to [44546], [49941].

Props joyously, dlh, pbiron.
See #52628.
Built from https://develop.svn.wordpress.org/trunk@51055


git-svn-id: http://core.svn.wordpress.org/trunk@50664 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-06-01 21:21:57 +00:00
Sergey Biryukov
972d2bc117 Docs: Improve documentation for wp_list_filter() and wp_filter_object_list().
This should make the purpose and behavior of these functions more obvious without reading the code.

Props ribaricplusplus.
Fixes #52808.
Built from https://develop.svn.wordpress.org/trunk@51044


git-svn-id: http://core.svn.wordpress.org/trunk@50653 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-05-28 18:04:57 +00:00
desrosj
4a7c797d92 General: Correct the inline code examples for _wp_array_get() and `_wp_array_set().
Props thomasplevy, SergeyBiryukov.
Fixes #53264.
Built from https://develop.svn.wordpress.org/trunk@51041


git-svn-id: http://core.svn.wordpress.org/trunk@50650 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-05-27 19:36:59 +00:00
Sergey Biryukov
a30afc155e General: Avoid a PHP warning when checking the mbstring.func_overload PHP value.
This avoids "A non-numeric value encountered" warning when `mbstring.func_overload` is set to something other than a numeric string, e.g. an empty string instead of the default `'0'` value.

Props djbu.
Fixes #53282.
Built from https://develop.svn.wordpress.org/trunk@51032


git-svn-id: http://core.svn.wordpress.org/trunk@50641 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-05-26 16:05:59 +00:00
Sergey Biryukov
8f47c944d8 General: Some documentation and test improvements for the _wp_array_set():
* Update the function DocBlock per the documentation standards.
* Move the unit tests to a more appropriate place.
* Rename and reorder the tests for consistency with `_wp_array_get()` tests.

Follow-up to [50958], [50962], [50964].

See #53175, #52625.
Built from https://develop.svn.wordpress.org/trunk@50965


git-svn-id: http://core.svn.wordpress.org/trunk@50574 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-05-24 12:25:55 +00:00
youknowriad
6c0578055c General: Add _wp_array_set function.
This adds the _wp_array_set function, which is the counterpart of the existing _wp_array_get.
This utility is to be used by the Global Settings work.

Props nosolosw, jorgefilipecosta.
See #53175.

Built from https://develop.svn.wordpress.org/trunk@50958


git-svn-id: http://core.svn.wordpress.org/trunk@50567 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-05-24 08:30:56 +00:00
Sergey Biryukov
5354201954 Media: Avoid an infinite loop between wp_getimagesize() and wp_get_image_mime().
As a result of the recent changes, both functions were calling each other if the `exif` PHP extension is not available.

The issue is now resolved by calling the `getimagesize()` PHP function directly, instead of the `wp_getimagesize()` wrapper.

Follow-up to [50146], [50810], [50814], [50815], [50818-50821].

See #35725.
Built from https://develop.svn.wordpress.org/trunk@50822


git-svn-id: http://core.svn.wordpress.org/trunk@50431 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-05-07 09:33:01 +00:00
Sergey Biryukov
0778849c12 Media: Some documentation and test improvements for WebP support:
* Document that WebP constants are only defined in PHP 7.1+.
* Correct the `$filename` parameter type in `wp_get_webp_info()`.
* Use a consistent message when skipping tests due to the lack of WebP support.
* Remove unnecessary `else` branches after `markTestSkipped()`.
* Replace `assertEquals()` with more appropriate assertions.

Follow-up to [50810].

See #35725.
Built from https://develop.svn.wordpress.org/trunk@50814


git-svn-id: http://core.svn.wordpress.org/trunk@50423 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-05-05 17:08:01 +00:00
Adam Silverstein
524030edfa Images: enable WebP support.
Add support for uploading, editing and saving WebP images when supported by the server.

Add 'image/webp' to supported mime types. Correctly identify WebP images and sizes even when PHP doesn't support WebP. Resize uploaded WebP files (when supported) and use for front end markup.

Props markoheijne, blobfolio, Clorith, joemcgill, atjn, desrosj, spacedmonkey, marylauc, mikeschroder, hellofromtonya, flixos90.
Fixes #35725.


Built from https://develop.svn.wordpress.org/trunk@50810


git-svn-id: http://core.svn.wordpress.org/trunk@50419 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-05-04 14:44:58 +00:00
John Blackbourn
52679edbff Docs: Add examples of possible names for various hooks whose name contains a dynamic portion.
This provides greater discoverability of such hooks in search results on the Code Reference site as well as increased clarity when reading the source.

See #50734, #52628

Built from https://develop.svn.wordpress.org/trunk@50505


git-svn-id: http://core.svn.wordpress.org/trunk@50118 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-03-07 12:32:09 +00:00
Peter Wilson
c463e94a33 Security: move Content-Security-Policy script loaders.
Move `wp_get_script_tag()`, `wp_print_script_tag()`, `wp_print_inline_script_tag()` and `wp_get_inline_script_tag()` functions from `functions.php` to `script-loader.php`.

Relocate related tests to `dependencies` sub-directory.

Follow up to [50167].
Props adamsilverstein, hellofromTonya, SergeyBiryukov.
Fixes #39941.

Built from https://develop.svn.wordpress.org/trunk@50409


git-svn-id: http://core.svn.wordpress.org/trunk@50020 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-02-23 02:00:06 +00:00
Adam Silverstein
a506e02edd Security: add Content-Security-Policy script loaders.
Add new functions `wp_get_script_tag`, `wp_print_script_tag`, `wp_print_inline_script_tag` and `wp_get_inline_script_tag` that support script attributes. Enables passing attributes such as `async` or `nonce`, creating a path forward for enabling a Content-Security-Policy in core, plugins and themes.

Props tomdxw, johnbillion, jadeddragoon, jrchamp, mallorydxw, epicfaace, alinod, enricocarraro, ocean90.
Fixes #39941.



Built from https://develop.svn.wordpress.org/trunk@50167


git-svn-id: http://core.svn.wordpress.org/trunk@49846 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-02-02 20:55:05 +00:00
Sergey Biryukov
aab7206ff8 Media: Move wp_getimagesize() to wp-includes/media.php, for consistency with other media functions.
Follow-up to [50146].

See #49889.
Built from https://develop.svn.wordpress.org/trunk@50148


git-svn-id: http://core.svn.wordpress.org/trunk@49827 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-02-02 17:10:04 +00:00
antpb
f80e5d0919 Media: Avoid suppressing errors when using getimagesize().
Previously, all logic utilizing `getimagesize()` was supressing errors making it difficult to debug usage of the function. 

A new `wp_getimagesize()` function has been added to allow the errors to no longer be suppressed when `WP_DEBUG` is enabled.

Props Howdy_McGee, SergeyBiryukov, mukesh27, davidbaumwald, noisysocks, hellofromTonya.
Fixes #49889.

Built from https://develop.svn.wordpress.org/trunk@50146


git-svn-id: http://core.svn.wordpress.org/trunk@49825 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-02-02 16:53:04 +00:00
Sergey Biryukov
22188b3e85 Users: Move retrieve_password() to wp-includes/user.php, for consistency with other user functions.
Follow-up to [25231], [50129].

Props jfarthing84, dimadin.
See #34281, #31039.
Built from https://develop.svn.wordpress.org/trunk@50140


git-svn-id: http://core.svn.wordpress.org/trunk@49819 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-02-02 12:37:03 +00:00
Felix Arntz
dbfbf5501a Security, Site Health: Make migrating a site to HTTPS a one-click interaction.
Switching a WordPress site from HTTP to HTTPS has historically been a tedious task. While on the surface the Site Address and WordPress Address have to be updated, existing content still remains using HTTP URLs where hard-coded in the database. Furthermore, updating _two_ URLs to migrate to HTTPS is still a fairly unintuitive step which is not clearly explained.

This changeset simplifies migration from HTTP to HTTPS and, where possible, makes it a one-click interaction.

* Automatically replace insecure versions of the Site Address (`home_url()`) with its HTTPS counterpart on the fly if the site has been migrated from HTTP to HTTPS. This is accomplished by introducing a `https_migration_required` option and enabling it when the `home_url()` is accordingly changed.
    * A new `wp_replace_insecure_home_url()` function is hooked into various pieces of content to replace URLs accordingly.
    * The migration only kicks in when the Site Address (`home_url()`) and WordPress Address (`site_url()`) match, which is the widely common case. Configurations where these differ are often maintained by more advanced users, where this migration routine would be less essential - something to potentially iterate on in the future though.
    * The migration does not actually update content in the database. More savvy users that prefer to do that can prevent the migration logic from running by either deleting the `https_migration_required` option or using the new `wp_should_replace_insecure_home_url` filter.
    * For fresh sites that do not have any content yet at the point of changing the URLs to HTTPS, the migration will also be skipped since it would not be relevant.
* Expose a primary action in the Site Health recommendation, if HTTPS is already supported by the environment, built on top of the HTTPS detection mechanism from [49904]. When clicked, the default behavior is to update `home_url()` and `site_url()` in one go to their HTTPS counterpart.
    * A new `wp_update_urls_to_https()` function takes care of the update routine.
    * A new `update_https` meta capability is introduced to control access.
    * If the site's URLs are controlled by constants, this update is not automatically possible, so in these scenarios the user is informed about that in the HTTPS status check in Site Health.
* Allow hosting providers to modify the URLs linked to in the HTTPS status check in Site Health, similar to how that is possible for the URLs around updating the PHP version.
    * A `WP_UPDATE_HTTPS_URL` environment variable or `wp_update_https_url` filter can be used to provide a custom URL with guidance about updating the site to use HTTPS.
    * A `WP_DIRECT_UPDATE_HTTPS_URL` environment variable or `wp_direct_update_https_url` filter can be used to provide a custom URL for the primary CTA to update the site to use HTTPS.

Props flixos90, timothyblynjacobs.
Fixes #51437.

Built from https://develop.svn.wordpress.org/trunk@50131


git-svn-id: http://core.svn.wordpress.org/trunk@49810 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-02-02 00:10:01 +00:00
Adam Silverstein
315b1c185d Users: enable admins to send users a reset password link.
Add a feature so Admins can send users a 'password reset' email. This doesn't change the password or force a password change. It only emails the user the password reset link.

The feature appears in several places:
* A "Send Reset Link" button on user profile screen.
* A "Send password reset" option in the user list bulk action dropdown.
* A "Send password reset" quick action when hovering over a username in the user list.

Props Ipstenu, DrewAPicture, eventualo, wonderboymusic, knutsp, ericlewis, afercia, JoshuaWold, johnbillion, paaljoachim, hedgefield.
Fixes #34281.


Built from https://develop.svn.wordpress.org/trunk@50129


git-svn-id: http://core.svn.wordpress.org/trunk@49808 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-02-01 22:13:03 +00:00
whyisjake
5f532382aa Privacy: Ensure that exported user data reports can't be found with directory listings.
By moving from `.html` to `.php` files, we can prevent directory listings, and ensure that WordPress can load.

Fixes #52299.

Props lucasbustamante, xkon, freewebmentor, SergeyBiryukov, whyisjake. 

Built from https://develop.svn.wordpress.org/trunk@50037


git-svn-id: http://core.svn.wordpress.org/trunk@49738 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-01-27 23:46:58 +00:00
Felix Arntz
3716c8c20f Robots: Introduce Robots API.
This changeset introduces a filter-based Robots API, providing central control over the `robots` meta tag.

* Introduces `wp_robots()` function which should be called anywhere a `robots` meta tag should be included.
* Introduces `wp_robots` filter which allows adding or modifying directives for the `robots` meta tag. The `wp_robots()` function is entirely filter-based, i.e. if no filter is added to `wp_robots`, no directives will be present, and therefore the entire `robots` meta tag will be omitted.
* Introduces the following `wp_robots` filter functions which replace similar existing functions that were manually rendering a `robots` meta tag:
    * `wp_robots_noindex()` replaces `noindex()`, which has been deprecated.
    * `wp_robots_no_robots()` replaces `wp_no_robots()`, which has been deprecated.
    * `wp_robots_sensitive_page()` replaces `wp_sensitive_page_meta()`, which has been deprecated. Its rendering of the `referrer` meta tag has been moved to another new function `wp_strict_cross_origin_referrer()`.

Migration to the new functions is straightforward. For example, a call to `add_action( 'wp_head', 'wp_no_robots' )` should be replaced with `add_filter( 'wp_robots', 'wp_robots_no_robots' )`.

Plugins and themes that render their own `robots` meta tags are encouraged to switch to rely on the `wp_robots` filter in order to use the central management layer now provided by WordPress core.

Props adamsilverstein, flixos90, timothyblynjacobs, westonruter.
See #51511.

Built from https://develop.svn.wordpress.org/trunk@49992


git-svn-id: http://core.svn.wordpress.org/trunk@49693 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-01-21 01:37:00 +00:00
Sergey Biryukov
c38bdce55b Docs: Correct description for wp_parse_list().
The function simply converts a comma- or space-separated list of scalar values to an array and does not perform any sanitization on its own.

Follow-up to [44546].

Props johnjamesjacoby.
See #51800.
Built from https://develop.svn.wordpress.org/trunk@49941


git-svn-id: http://core.svn.wordpress.org/trunk@49640 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-01-06 17:25:07 +00:00
Sergey Biryukov
7ced0efbf4 Docs: Use more consistent descriptions for void|false return values.
See #51800.
Built from https://develop.svn.wordpress.org/trunk@49935


git-svn-id: http://core.svn.wordpress.org/trunk@49634 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-01-05 16:48:07 +00:00
Sergey Biryukov
37662df05e Docs: In various @return tags, list the expected type first, instead of false or WP_Error.
Follow-up to [46696], [47060], [49926], [49927].

See #51800.
Built from https://develop.svn.wordpress.org/trunk@49929


git-svn-id: http://core.svn.wordpress.org/trunk@49628 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-01-04 17:18:04 +00:00
John Blackbourn
dfe1f9b322 Docs: Promote many bool types to true or false where only that value is used.
See #51800

Built from https://develop.svn.wordpress.org/trunk@49927


git-svn-id: http://core.svn.wordpress.org/trunk@49626 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-01-03 22:04:04 +00:00
John Blackbourn
53da9208dd Docs: Various docblock corrections particularly relating to boolean types.
See #51800

Built from https://develop.svn.wordpress.org/trunk@49926


git-svn-id: http://core.svn.wordpress.org/trunk@49625 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-01-03 21:57:09 +00:00
Sergey Biryukov
3f05756219 Accessibility: Upgrade/Install: Add more contrast to input borders during installation.
This brings the accessibility improvements previously made for other areas of the admin in WordPress 5.3 to the installation screens too.

Follow-up to [46241-46244], [46247], [46248], [46293], [46425].

Props Maigret, audrasjb.
Fixes #51854.
Built from https://develop.svn.wordpress.org/trunk@49907


git-svn-id: http://core.svn.wordpress.org/trunk@49606 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-12-26 19:54:07 +00:00
John Blackbourn
e7cc15b321 Upload: Introduce the {$action}_overrides filter that allows the overrides parameter for file uploads and file sideloads to be filtered.
The dynamic portion of the hook name, `$action`, refers to the post action.

Props iandunn, jakub.tyrcha, nacin, wonderboymusic, Mte90, johnbillion

Fixes #16849

Built from https://develop.svn.wordpress.org/trunk@49845


git-svn-id: http://core.svn.wordpress.org/trunk@49564 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-12-20 16:15:03 +00:00
John Blackbourn
bf83c368fd Docs: Various docblock improvements.
See #51800

Built from https://develop.svn.wordpress.org/trunk@49790


git-svn-id: http://core.svn.wordpress.org/trunk@49513 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-12-10 23:59:03 +00:00
iandunn
4de6175227 Multisite: Cache absolute dirsize paths to avoid PHP 8 fatal.
r49212 greatly improved the performance of `get_dirsize()`, but also changed the structure of the data stored in the `dirsize_cache` transient. It stored relative paths instead of absolute ones, and also removed the unnecessary `size` array.

That difference in data structures led to a fatal error in the following environment:

* PHP 8
* Multisite
* A custom `WP_CONTENT_DIR` which is not a child of WP's `ABSPATH` folder (e.g., [https://roots.io/bedrock/ Bedrock])
* The `upload_space_check_disabled` option set to `0`

After upgrading to WP 5.6, the `dirsize_cache` transient still had data in the old format. When `wp-admin.php/index.php` was visited, `get_space_used()` received an `array` instead of an `int`, and tried to divide it by another `int`. PHP 7 would silently cast the arguments to match data types, but [https://wiki.php.net/rfc/arithmetic_operator_type_checks PHP 8 throws a fatal error]: 

`Uncaught TypeError: Unsupported operand types: array / int`

`recurse_dirsize()` was using `ABSPATH` to convert the absolute paths to relative ones, but some upload locations are not located under `ABSPATH`. In those cases, `$directory` and `$cache_path` were identical, and that triggered the early return of the old `array`, instead of the expected `int`. 

In order to avoid that, this commit restores the absolute paths, but without the `size` array. It also adds a type check when returning cached values. Using absolute paths without `size` has the result of overwriting the old data, so that it matches the new format. The type check and upgrade routine are additional safety measures.

Props peterwilsoncc, janthiel, helen, hellofromtonya, francina, pbiron.
Fixes #51913. See #19879.


Built from https://develop.svn.wordpress.org/trunk@49744


git-svn-id: http://core.svn.wordpress.org/trunk@49467 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-12-03 20:39:02 +00:00
John Blackbourn
f4cda1b62f Docs: Upgrade more parameters in docblocks to used typed array notation.
See #51800, #41756

Built from https://develop.svn.wordpress.org/trunk@49693


git-svn-id: http://core.svn.wordpress.org/trunk@49416 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-11-24 21:27:05 +00:00
Helen Hou-Sandí
b456e9c9c8 Upgrade/Install: Consistent layout and accurate messages on the update screen.
* Clarifies that if you are on maintenance/security auto-updates that you are only on those and therefore there are more options available.
* Adds a message if a version control system has been detected, as automatic updates are disabled in that case.
* Ensures only one heading between `update available`, `you are on a dev version`, and `you are on latest` appears at any given time, falling back to `you are on latest` if something strange happens with the returned update data.
* Removes some older strings related to auto-updates, which greatly simplifies the above.
* Strips the `core-major-auto-updates-saved` query arg from the URL, as it is related to a dismissible notice.

Props audrasjb, pbiron, helen.
Fixes #51742.

Built from https://develop.svn.wordpress.org/trunk@49638


git-svn-id: http://core.svn.wordpress.org/trunk@49376 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-11-17 20:28:04 +00:00
Sergey Biryukov
5801fc9a93 Multisite: Rename the calculate_current_dirsize filter to pre_recurse_dirsize.
Set the default value to `false`. This brings some consistency with the `pre_get_space_used` filter.

Follow-up to [49212], [49616], [49628].

See #19879.
Built from https://develop.svn.wordpress.org/trunk@49629


git-svn-id: http://core.svn.wordpress.org/trunk@49367 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-11-17 15:44:07 +00:00
Sergey Biryukov
e123448589 Docs: Adjust comments for recurse_dirsize() and related tests per the documentation standards.
Follow-up to [49212], [49616].

See #19879.
Built from https://develop.svn.wordpress.org/trunk@49628


git-svn-id: http://core.svn.wordpress.org/trunk@49366 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-11-17 15:38:10 +00:00
Helen Hou-Sandí
aceaf33edd Multisite: More consistency for clean_dirsize_cache().
Props SergeyBiryukov.
Fixes #19879.

Built from https://develop.svn.wordpress.org/trunk@49616


git-svn-id: http://core.svn.wordpress.org/trunk@49354 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-11-16 22:31:06 +00:00
John Blackbourn
9115246f72 General: Convert wp_array_get() to a "private" function and add tests.
This function may be promoted in the future if it's deemed useful enough.

Props dd32, jorgefilipecosta, Hareesh Pillai

Fixes #51720

Built from https://develop.svn.wordpress.org/trunk@49580


git-svn-id: http://core.svn.wordpress.org/trunk@49318 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-11-12 20:20:12 +00:00
Helen Hou-Sandí
c57ce00691 Feeds: Don't treat media URLs with fragments as unique for enclosures.
Props archduck, dshanske.
Fixes #47421.

Built from https://develop.svn.wordpress.org/trunk@49552


git-svn-id: http://core.svn.wordpress.org/trunk@49290 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-11-09 20:28:07 +00:00
Helen Hou-Sandí
cc74786052 General: Make some inline comments more descriptive.
Props jorbin.
Fixes #51683.

Built from https://develop.svn.wordpress.org/trunk@49474


git-svn-id: http://core.svn.wordpress.org/trunk@49233 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-11-02 18:04:07 +00:00
whyisjake
4b91d4e523 Upgrade/Install: During the install process, add additional checking for exising tables.
If reinstalling WordPress, there is a condition where tables would exist in the database. Ensures that when that is the case, the install process can carry along without issue.

Fixes #51676.

Props xknown, garubi, mukesh27, desrosj, johnbillion, metalandcoffee, davidbaumwald, whyisjake.


Built from https://develop.svn.wordpress.org/trunk@49452


git-svn-id: http://core.svn.wordpress.org/trunk@49211 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-10-30 17:52:07 +00:00
desrosj
a8e86c768c Upgrade/install: Improve logic check when determining installation status.
Improve handling of ambiguous return values to determine if a blog is installed.

Props zieladam, xknown.
Merges [49377] to trunk.
Built from https://develop.svn.wordpress.org/trunk@49386


git-svn-id: http://core.svn.wordpress.org/trunk@49145 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-10-29 18:06:13 +00:00
Sergey Biryukov
e2e3c8ec47 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.
Built from https://develop.svn.wordpress.org/trunk@49235


git-svn-id: http://core.svn.wordpress.org/trunk@48997 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-10-20 15:56:08 +00:00
desrosj
d40c365a30 Coding Standards: Correct some minor coding standards issues.
Introduced in [49154], [49212], [49223], and [49224].
Built from https://develop.svn.wordpress.org/trunk@49225


git-svn-id: http://core.svn.wordpress.org/trunk@48987 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-10-20 13:29:08 +00:00
Sergey Biryukov
651f426b3a 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.
Built from https://develop.svn.wordpress.org/trunk@49215


git-svn-id: http://core.svn.wordpress.org/trunk@48977 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-10-19 23:39:04 +00:00
Helen Hou-Sandí
bdfd1a954f 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.

Built from https://develop.svn.wordpress.org/trunk@49212


git-svn-id: http://core.svn.wordpress.org/trunk@48974 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-10-19 21:51:06 +00:00
Sergey Biryukov
0e3147c40e 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.
Built from https://develop.svn.wordpress.org/trunk@49193


git-svn-id: http://core.svn.wordpress.org/trunk@48955 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-10-18 17:27:06 +00:00
Sergey Biryukov
542d13830b General: Move wp_array_get() next to wp_array_slice_assoc(), for a bit more consistent placement.
Follow-up to [49135], [49143].

See #51461.
Built from https://develop.svn.wordpress.org/trunk@49144


git-svn-id: http://core.svn.wordpress.org/trunk@48906 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-10-14 02:16:08 +00:00
Sergey Biryukov
620c069fe8 General: Move wp_array_get() from a separate file to wp-includes/functions.php, for consistency.
Add missing `@since` tag, adjust the DocBlock per the documentation standards.

Follow-up to [49135].

Props isabel_brison, ocean90.
Fixes #51461.
Built from https://develop.svn.wordpress.org/trunk@49143


git-svn-id: http://core.svn.wordpress.org/trunk@48905 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-10-14 02:10:04 +00:00
John Blackbourn
bd1fa2d998 Posts, Post Types: Switch to restoring posts to draft status by default when they are untrashed.
This allows for edits to be made to a restored post before it goes live again. This also prevents scheduled posts being published unexpectedly if they are untrashed after their originally scheduled date.

The old behaviour of restoring untrashed posts to their original status can be reinstated using the `wp_untrash_post_set_previous_status()` helper function.

Also fixes an issue where the incorrect post ID gets passed to hooks if no post ID is passed to the function.

Props harrym, bananastalktome, jaredcobb, chriscct7, melchoyce, johnbillion, pankajmohale

Fixes #23022

Built from https://develop.svn.wordpress.org/trunk@49125


git-svn-id: http://core.svn.wordpress.org/trunk@48887 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-10-11 13:39:07 +00:00
Sergey Biryukov
897f004a9c General: Replace older-style PHP type conversion functions with type casts.
This improves performance, readability, and consistency throughout core.

* `intval()` → `(int)`
* `strval()` → `(string)`
* `floatval()` → `(float)`

Props ayeshrajans.
Fixes #42918.
Built from https://develop.svn.wordpress.org/trunk@49108


git-svn-id: http://core.svn.wordpress.org/trunk@48870 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-10-08 21:15:13 +00:00
Sergey Biryukov
bdccfa3a03 Code Modernization: Check if the file to retrieve metadata from in get_file_data() was successfully opened.
This avoids a fatal error on PHP 8 caused by passing a `false` value to `fread()`, instead of a file resource.

See #50913.
Built from https://develop.svn.wordpress.org/trunk@49073


git-svn-id: http://core.svn.wordpress.org/trunk@48835 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-30 12:20:03 +00:00
TimothyBlynJacobs
0db3f859ea Add ircs and irc6 to the list of allowed protocols.
This adds support for the secure and ipv6 variants of the already allowed irc protocol.

Props arealnobrainer, markparnell, ctmartin.

Built from https://develop.svn.wordpress.org/trunk@49055


git-svn-id: http://core.svn.wordpress.org/trunk@48817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-26 21:02:04 +00:00
Sergey Biryukov
346794bc57 Upload: Add a check in wp_check_filetype_and_ext() to account for CSV files having the application/csv MIME type.
Previously, the PHP Fileinfo extension used to detect CSV files as `text/plain`.

In PHP 8, this has changed, and CSV files are detected as `application/csv`.

Follow-up to [44438].

See #50913.
Built from https://develop.svn.wordpress.org/trunk@49049


git-svn-id: http://core.svn.wordpress.org/trunk@48811 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-26 01:11:09 +00:00
Sergey Biryukov
cfe5b1c9f2 Docs: Add a @since note to wp_privacy_exports_dir and wp_privacy_exports_url filters about exports using relative paths since WordPress 5.5.
When changing exports location via these filters, make sure to migrate the files to the new directory, to avoid breaking any existing exports.

Follow-up to [48127], [48330].

Props garrett-eclipse.
Fixes #51361.
Built from https://develop.svn.wordpress.org/trunk@49042


git-svn-id: http://core.svn.wordpress.org/trunk@48804 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-24 05:00:06 +00:00
John Blackbourn
aef504acfd Docs: Correct the indentation for some array type docs.
See #50768

Built from https://develop.svn.wordpress.org/trunk@49028


git-svn-id: http://core.svn.wordpress.org/trunk@48790 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-21 16:46:06 +00:00
Sergey Biryukov
d3a3862248 Code Modernization: Fix PHP 8 deprecation notices for optional function parameters declared before required parameters.
As it already was not possible to pass the required parameters without also passing the optional one anyway, removing the default value for the (not so) optional parameters should not affect backward compatibility.

This change affects three functions in core:

* `get_comment_delimited_block_content()`
* `do_enclose()`
* `_wp_delete_tax_menu_item()`

Props jrf, ayeshrajans, desrosj.
Fixes #50343.
Built from https://develop.svn.wordpress.org/trunk@48794


git-svn-id: http://core.svn.wordpress.org/trunk@48556 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-08-15 13:40:03 +00:00
John Blackbourn
782f05d2c5 Docs: Various fixes and improvements to inline documentation.
See #49572
Built from https://develop.svn.wordpress.org/trunk@48695


git-svn-id: http://core.svn.wordpress.org/trunk@48457 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-07-30 19:14:03 +00:00
Sergey Biryukov
6731940272 Pings/Trackbacks: Avoid a PHP notice in do_enclose() when encountering a URL without a path in post content.
Props jbouganim, mukesh27, Otto42, SergeyBiryukov.
Fixes #49872.
Built from https://develop.svn.wordpress.org/trunk@48621


git-svn-id: http://core.svn.wordpress.org/trunk@48383 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-07-26 14:08:05 +00:00
Sergey Biryukov
ed9d53ec1f I18N: Respect the passed text_direction argument in wp_die().
Previously, the passed value was only used as a fallback if `get_language_attributes()` is not yet available.

Props apedog.
Fixes #49060.
Built from https://develop.svn.wordpress.org/trunk@48607


git-svn-id: http://core.svn.wordpress.org/trunk@48369 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-07-25 15:26:05 +00:00
Sergey Biryukov
d07fc084af Docs: Improve description for wp_unique_filename().
Props stevenlinx.
Fixes #50762.
Built from https://develop.svn.wordpress.org/trunk@48606


git-svn-id: http://core.svn.wordpress.org/trunk@48368 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-07-25 12:31:05 +00:00
Sergey Biryukov
d936f2c959 Docs: Miscellaneous DocBlock corrections.
See #49572.
Built from https://develop.svn.wordpress.org/trunk@48591


git-svn-id: http://core.svn.wordpress.org/trunk@48353 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-07-23 21:55:04 +00:00
John Blackbourn
9bc7d0a776 Docs: Another pass at some inline docs fixes mostly made by PHPCBF.
See #49572, #50744
Built from https://develop.svn.wordpress.org/trunk@48590


git-svn-id: http://core.svn.wordpress.org/trunk@48352 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-07-23 21:11:05 +00:00
John Blackbourn
1fbcdb2213 Docs: Various corrections to inline docblocks.
See #49572
Built from https://develop.svn.wordpress.org/trunk@48573


git-svn-id: http://core.svn.wordpress.org/trunk@48335 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-07-23 00:48:06 +00:00
Sergey Biryukov
bec9fa5010 Site Health: Remove parse_ini_size(), use the existing wp_convert_hr_to_bytes() function instead.
Follow-up to [48535].

See #50038.
Built from https://develop.svn.wordpress.org/trunk@48538


git-svn-id: http://core.svn.wordpress.org/trunk@48300 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-07-21 15:40:03 +00:00
whyisjake
73a8fb4cc3 Site Health: Include new tests to check for the ability to upload files.
Several new checks:

* `max_file_uploads`
* `file_uploads`
* `post_max_size`
* `upload_max_filesize`
* `upload_max`
* `max_file_uploads`

In addition, new function `parse_ini_size()` that converts shorthand byte strings to bytes. Useful for size comparisons.

Fixes #50038.
Props dd32, donmhico, JavierCasares, SergeyBiryukov, ayeshrajans, Clorith, ipstenu, sabernhardt, whyisjake.

Built from https://develop.svn.wordpress.org/trunk@48535


git-svn-id: http://core.svn.wordpress.org/trunk@48297 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-07-21 15:21:02 +00:00
John Blackbourn
4ff1233e75 Docs: Correct and improve inline docs for parameters that accept a callback function.
See #49572
Built from https://develop.svn.wordpress.org/trunk@48473


git-svn-id: http://core.svn.wordpress.org/trunk@48242 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-07-14 11:56:04 +00:00
Sergey Biryukov
f2a7a5e154 Bootstrap/Load: Adjust the logic in add_magic_quotes() for better readability.
Follow-up to [48205].

See #48605.
Built from https://develop.svn.wordpress.org/trunk@48440


git-svn-id: http://core.svn.wordpress.org/trunk@48209 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-07-11 22:44:05 +00:00
Sergey Biryukov
82d9974f8c Upload: Introduce pre_wp_unique_filename_file_list filter to allow for short-circuiting the scandir() call in wp_unique_filename().
This allows plugins to override the file fetching behavior to provide performance improvements for large directories.

Props joehoyle.
Fixes #50587.
Built from https://develop.svn.wordpress.org/trunk@48369


git-svn-id: http://core.svn.wordpress.org/trunk@48138 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-07-07 10:20:03 +00:00
Andrea Fercia
afa6bb4f1a Accessibility: Improve color contrast for the blue links :hover state.
For a number of years, WordPress has been using a `#00a0d2` blue shade for the links `:hover` state. This blue shade doesn't have a sufficient color contrast with the various (too many) background colors used in the admin interface.

The new `#006799` blue shade is part of the official WordPress color palette and does have a sufficient color contrast with most of the admin backgrounds.

Props ryokuhi, audrasjb, joedolson, mapk.
See #47682.

Built from https://develop.svn.wordpress.org/trunk@48368


git-svn-id: http://core.svn.wordpress.org/trunk@48137 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-07-07 10:11:05 +00:00
Sergey Biryukov
24ed3a9a30 REST API: Correct the check for $version argument in rest_handle_doing_it_wrong().
Move `WP_REST_Response` and `WP_Error` class names out of the translatable string.

Follow-up to [48327], [48361].

See #36271.
Built from https://develop.svn.wordpress.org/trunk@48367


git-svn-id: http://core.svn.wordpress.org/trunk@48136 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-07-07 09:56:02 +00:00
whyisjake
ad1c6c9586 REST API: Trigger _doing_it_wrong() if wp_send_json() is used on a REST API request
In addition to triggering the `_doing_it_wrong()` logging, also adds a `X-WP-DoingItWrong` header.

Fixes #36271.

Props rmccue, TimothyBlynJacobs.


Built from https://develop.svn.wordpress.org/trunk@48361


git-svn-id: http://core.svn.wordpress.org/trunk@48130 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-07-07 05:01:07 +00:00
whyisjake
aad1fa48ea Site Health: Ensure that the user will be notified after a successful snooze action.
After clicking remind me later, the user is shown an admin notification.

Fixes #48333.

Props desrosj, sathyapulse, Clorith, azaozz, audrasjb, afragen, whyisjake.
 

Built from https://develop.svn.wordpress.org/trunk@48359


git-svn-id: http://core.svn.wordpress.org/trunk@48128 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-07-07 03:59:02 +00:00
Sergey Biryukov
69e7e7681b Plugins: Consistently use an empty string as the default value for $replacement and $message parameters in:
* `_deprecated_function()`
* `_deprecated_constructor()`
* `_deprecated_file()`
* `_deprecated_argument()`
* `_deprecated_hook()`
* `apply_filters_deprecated()`
* `do_action_deprecated()`

This matches the documented type of `string` for these parameters and removes unnecessarily strict `! is_null()` checks.

Follow-up to [46792].

Props jignesh.nakrani, renathoc, SergeyBiryukov.
Fixes #49698.
Built from https://develop.svn.wordpress.org/trunk@48327


git-svn-id: http://core.svn.wordpress.org/trunk@48096 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-07-05 21:09:03 +00:00
Dominik Schilling
310db57c48 Administration: Add delete_count to wp_removable_query_args().
It's a single-use URL parameter that does not need to be passed to canonical URLs in the admin.

Props opurockey.
Fixes #50464.
Built from https://develop.svn.wordpress.org/trunk@48319


git-svn-id: http://core.svn.wordpress.org/trunk@48088 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-07-05 13:57:03 +00:00
Sergey Biryukov
5fb7c090de Media: Add heic extension to wp_get_ext_types(), for consistency with wp_get_mime_types().
Follow-up to [48288].

Props imath.
Fixes #50557. See #42775.
Built from https://develop.svn.wordpress.org/trunk@48296


git-svn-id: http://core.svn.wordpress.org/trunk@48065 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-07-04 17:09:01 +00:00
Andrew Ozz
86317e3e85 Media: Show an error message when a .heic file is uploaded that this type of files cannot be displayed in a web browser and suggesting to convert to JPEG. The message is shown by using filters, plugins that want to handle uploading of .heic files can remove it.
Props mattheweppelsheimer, mikeschroder, jeffr0, andraganescu, desrosj, azaozz.
Fixes #42775.
Built from https://develop.svn.wordpress.org/trunk@48288


git-svn-id: http://core.svn.wordpress.org/trunk@48057 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-07-03 23:15:03 +00:00
Sergey Biryukov
d25cc189be Bootstrap/Load: Make sure add_magic_quotes() does not inappropriately recast non-string data types to string.
Props donmhico, jrf, Veraxus, Rarst.
Fixes #48605.
Built from https://develop.svn.wordpress.org/trunk@48205


git-svn-id: http://core.svn.wordpress.org/trunk@47974 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-06-28 21:04:02 +00:00
Sergey Biryukov
3336009e34 Docs: Replace "html" and "xhtml" instances in DocBlocks and comments with "HTML" and "XHTML".
This ensures consistent capitalization where appropriate.

Props navidos, desrosj.
Fixes #50473.
Built from https://develop.svn.wordpress.org/trunk@48199


git-svn-id: http://core.svn.wordpress.org/trunk@47968 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-06-28 14:02:06 +00:00
Sergey Biryukov
40c389c95e Docs: Standardize on "Returning a value from the filter" vs. "Passing a value to the filter".
The filter is the callback function added with `add_filter()`, therefore the hook passes a value to the filter, and the filter returns a value to change its behaviour.

The documentation is referring to the latter.

Props johnbillion.
See #49572, #16557.
Built from https://develop.svn.wordpress.org/trunk@48185


git-svn-id: http://core.svn.wordpress.org/trunk@47954 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-06-26 18:49:09 +00:00
Sergey Biryukov
56342b8e8f Docs: Replace "AJAX" with "Ajax" in DocBlocks and comments, per the spelling glossary.
Props mukesh27, sabernhardt, SergeyBiryukov.
Fixes #50064.
Built from https://develop.svn.wordpress.org/trunk@48168


git-svn-id: http://core.svn.wordpress.org/trunk@47937 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-06-25 12:43:07 +00:00
Sergey Biryukov
f27cb65e1e Administration: Remove the xmlns attribute on the <html> tag.
The attribute is specific to XHTML and is not needed in HTML5.

Props audrasjb, diddledan, hommealone, joyously, mukesh27, valentinbora, peterwilsoncc, SergeyBiryukov.
Fixes #49126.
Built from https://develop.svn.wordpress.org/trunk@48126


git-svn-id: http://core.svn.wordpress.org/trunk@47895 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-06-22 21:26:16 +00:00
Andrea Fercia
ae447adaf4 I18N: Restore the "Error:" prefix for error messages.
Partially reverts [48059] as there's no full consensus on the removal of the text prefix. Further actions should be taken to improve consistency and accessibility of the admin notices. Keeps some improvements to the translatable strings from [48059].

Fixes #47656.

Built from https://develop.svn.wordpress.org/trunk@48115


git-svn-id: http://core.svn.wordpress.org/trunk@47884 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-06-21 14:00:09 +00:00
Sergey Biryukov
be16bb9fba Docs: Remove extra spaces from @param tags.
Per the documentation standards, `@param` tags should be aligned with each other, but not with the `@return` tag.

See #49572.
Built from https://develop.svn.wordpress.org/trunk@48110


git-svn-id: http://core.svn.wordpress.org/trunk@47879 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-06-20 12:58:10 +00:00
Sergey Biryukov
b16368c268 Docs: Remove @staticvar tags from core.
The tag was supported in phpDocumentor 1.x, but is no longer supported in 2.x and 3.x.

Usage of static variables is considered an internal implementation detail and has no information value for someone reading the docs.

Props alishanvr, jrf.
Fixes #50426.
Built from https://develop.svn.wordpress.org/trunk@48109


git-svn-id: http://core.svn.wordpress.org/trunk@47878 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-06-20 12:40:12 +00:00
Sergey Biryukov
e13c363b17 Docs: Capitalize "ID", when referring to a post ID, term ID, etc. in a more consistent way.
See #49572.
Built from https://develop.svn.wordpress.org/trunk@48104


git-svn-id: http://core.svn.wordpress.org/trunk@47873 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-06-20 12:02:12 +00:00
John Blackbourn
1a77bb81d8 Docs: Remove unnecessary variables names from @return tags.
See #49572.
Built from https://develop.svn.wordpress.org/trunk@48100


git-svn-id: http://core.svn.wordpress.org/trunk@47869 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-06-19 22:55:12 +00:00
Sergey Biryukov
353c9bfc58 Docs: List the expected return type first for size_format() and wp_get_original_referer().
Follow-up to [46696], [47060].

See #49572.
Built from https://develop.svn.wordpress.org/trunk@48068


git-svn-id: http://core.svn.wordpress.org/trunk@47835 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-06-16 21:24:07 +00:00
Sergey Biryukov
a8cd3a3e2c Coding Standards: Rename the $clean or $ids variable in several functions to $non_cached_ids for clarity.
* `_get_non_cached_ids()`
* `update_meta_cache()`
* `update_object_term_cache()`

See #49542.
Built from https://develop.svn.wordpress.org/trunk@48065


git-svn-id: http://core.svn.wordpress.org/trunk@47832 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-06-16 19:09:08 +00:00
Andrea Fercia
f83c504b88 I18N: Remove the "Error:" prefix from error messages.
For a number of years, most of the WordPress error messages have been prefixed with "Error:". However, these messages appear in a context where it's already clear an error occurred. Whether it's an error, a warning, or any other classification, that's not so relevant for users. The content of the message is the relevant part. The "Error:" prefix doesn't add great value while it does add unnecessary complexity for the message readability.

Also, revises some of these messages to improve clarity and removes HTML from translatable strings.

Props garrett-eclipse, ramiy, SergeyBiryukov, afercia, sabernhardt, quadthemes, audrasjb. 
See #47003, #43037, #42945, #15887.
Fixes #47656.

Built from https://develop.svn.wordpress.org/trunk@48059


git-svn-id: http://core.svn.wordpress.org/trunk@47826 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-06-16 15:35:13 +00:00
whyisjake
8a6cc1a810 Cache API: Add wp_cache_get_multiple() to core functions.
* `update_object_term_cache`
* `update_meta_cache`
* `_get_non_cached_ids`

See [47938].

Fixes #50352.

Props spacedmonkey, tillkruss, lukecavanagh. 


Built from https://develop.svn.wordpress.org/trunk@48055


git-svn-id: http://core.svn.wordpress.org/trunk@47822 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-06-16 06:30:09 +00:00
whyisjake
28c6339400 I18N: Add i18n to size_format().
Add translatable strings to the units of the `size_format()` function.

Props Rahe, audrasjb, ocean90.

Fixes #50194.


Built from https://develop.svn.wordpress.org/trunk@48054


git-svn-id: http://core.svn.wordpress.org/trunk@47821 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-06-16 06:10:08 +00:00
desrosj
27485fd7aa General: Continuing to work towards a passing PHP Compatibility scan.
This is a final pass to fix PHP compatibiilty issues in the codebase with code changes or adding `phpcs:ignore` comments.

With this change, all PHP compatibility warnings and errors without specific tickets have been addressed (see #49810 and #41750).

Props desrosj, johnbillion, jrf.
See #49922.
Built from https://develop.svn.wordpress.org/trunk@47902


git-svn-id: http://core.svn.wordpress.org/trunk@47676 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-06-03 17:40:12 +00:00
Sergey Biryukov
443dd105d4 Customize: Move the WordPress logo with a white background to the wp-includes directory.
This ensures that the image used as a default site icon looks good on a dark background.

The image was previously changed in the `wp-admin` directory, but the site icon is now loaded from `wp-includes`.

Follow-up to [36635], [47018], [47564], [47832].

Props ocean90.
Fixes #49798.
Built from https://develop.svn.wordpress.org/trunk@47838


git-svn-id: http://core.svn.wordpress.org/trunk@47614 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-05-21 09:10:12 +00:00
Sergey Biryukov
23c4fbeaa0 Customize: Load the default site icon from the wp-includes directory.
Files inside the `wp-admin` directory may not be publicly available.

Follow-up to [36635], [47018].

Props whyisjake, finomeno, ocean90.
Fixes #50131.
Built from https://develop.svn.wordpress.org/trunk@47832


git-svn-id: http://core.svn.wordpress.org/trunk@47608 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-05-20 10:36:09 +00:00
Sergey Biryukov
7932193708 Coding Standards: Use strict comparison where static strings are involved.
This reduces the number of `WordPress.PHP.StrictComparisons.LooseComparison` issues in half, from 1897 to 890.

Includes minor code layout fixes for better readability.

See #49542.
Built from https://develop.svn.wordpress.org/trunk@47808


git-svn-id: http://core.svn.wordpress.org/trunk@47584 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-05-16 18:42:12 +00:00
Sergey Biryukov
ced8fb20a1 Code Modernization: Remove error suppression from parse_url() calls.
Previously, the `@` operator was used to prevent possible warnings emitted by `parse_url()` in PHP < 5.3.3 when URL parsing failed.

Now that the minimum version of PHP required by WordPress is 5.6.20, this is no longer needed.

Props netpassprodsr, Howdy_McGee.
Fixes #49980. See #24780.
Built from https://develop.svn.wordpress.org/trunk@47617


git-svn-id: http://core.svn.wordpress.org/trunk@47392 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-04-24 07:28:10 +00:00
Sergey Biryukov
38676936ba Coding Standards: Use strict type check for in_array() and array_search() where strings are involved.
This reduces the number of `WordPress.PHP.StrictInArray.MissingTrueStrict` issues from 486 to 50.

Includes minor code layout fixes for better readability.

See #49542.
Built from https://develop.svn.wordpress.org/trunk@47550


git-svn-id: http://core.svn.wordpress.org/trunk@47325 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-04-05 03:02:11 +00:00
John Blackbourn
7004afe4f4 Docs: Various docblock corrections and improvements.
See #49572
Built from https://develop.svn.wordpress.org/trunk@47461


git-svn-id: http://core.svn.wordpress.org/trunk@47248 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-03-16 18:40:07 +00:00
Sergey Biryukov
d5f942d7ba General: Trim the input data in maybe_unserialize(), for consistency with is_serialized().
Props pbearne, mikeschroder.
Fixes #36416.
Built from https://develop.svn.wordpress.org/trunk@47454


git-svn-id: http://core.svn.wordpress.org/trunk@47241 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-03-13 21:13:08 +00:00
Sergey Biryukov
0dc46c0ba5 General: Move maybe_serialize() to a more appropriate place in the file, before maybe_unserialize().
Rename the `$original` parameter of `maybe_unserialize()` to `$data`, for consistency with other serialization functions.

See #36416.
Built from https://develop.svn.wordpress.org/trunk@47453


git-svn-id: http://core.svn.wordpress.org/trunk@47240 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-03-13 21:07:06 +00:00
Sergey Biryukov
4b64d587a5 General: Ensure get_tag_regex() always returns a string, to match the documented value.
Props subrataemfluence.
Fixes #45643.
Built from https://develop.svn.wordpress.org/trunk@47430


git-svn-id: http://core.svn.wordpress.org/trunk@47217 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-03-04 12:05:05 +00:00
Sergey Biryukov
eea1fd30c2 General: Correct the default value of the $defaults parameter in wp_parse_args() to match the documented type.
Props subrataemfluence.
See #45643.
Built from https://develop.svn.wordpress.org/trunk@47429


git-svn-id: http://core.svn.wordpress.org/trunk@47216 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-03-04 12:00:06 +00:00
Sergey Biryukov
57e91eb89a Docs: Add missing @throws tag to _wp_json_sanity_check() DocBlock.
Props subrataemfluence.
See #45643.
Built from https://develop.svn.wordpress.org/trunk@47427


git-svn-id: http://core.svn.wordpress.org/trunk@47214 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-03-04 11:34:08 +00:00
John Blackbourn
251d77e1a1 Docs: Miscellaneous docs fixes and improvements.
See #48303.
Built from https://develop.svn.wordpress.org/trunk@47398


git-svn-id: http://core.svn.wordpress.org/trunk@47185 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-03-01 10:40:07 +00:00
John Blackbourn
056dad9c2c Docs: Use more specific types in parameter descriptions in place of mixed.
See #48303.
Built from https://develop.svn.wordpress.org/trunk@47397


git-svn-id: http://core.svn.wordpress.org/trunk@47184 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-03-01 10:38:07 +00:00
Sergey Biryukov
641c632b0c Coding Standards: Use Yoda conditions where appropriate.
See #49222.
Built from https://develop.svn.wordpress.org/trunk@47219


git-svn-id: http://core.svn.wordpress.org/trunk@47019 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-02-09 16:55:09 +00:00
Sergey Biryukov
8fa6586958 Tests: Add a basic test for wp() function.
Props pbearne, donmhico.
Fixes #48844.
Built from https://develop.svn.wordpress.org/trunk@47212


git-svn-id: http://core.svn.wordpress.org/trunk@47012 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-02-08 05:31:07 +00:00
Sergey Biryukov
b2a1146380 Coding Standards: Adjust coding standards to always omit parentheses for include/require statements.
These are language constructs, not function calls, so the parentheses are unnecessary.

This updates the PHPCS configuration file the enforce the sniff until it is moved from the `WordPress-Extra` ruleset to the `WordPress-Core` ruleset upstream.

Follow-up to [47198].

Props desrosj, jrf, GaryJ.
Fixes #49376.
Built from https://develop.svn.wordpress.org/trunk@47207


git-svn-id: http://core.svn.wordpress.org/trunk@47007 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-02-07 19:16:06 +00:00
Sergey Biryukov
47ed56f38f Code Modernization: Replace dirname( __FILE__ ) calls with __DIR__ magic constant.
This avoids the performance overhead of the function call every time `dirname( __FILE__ )` was used instead of `__DIR__`.

This commit also includes:

* Removing unnecessary parentheses from `include`/`require` statements. These are language constructs, not function calls.
* Replacing `include` statements for several files with `require_once`, for consistency:
 * `wp-admin/admin-header.php`
 * `wp-admin/admin-footer.php`
 * `wp-includes/version.php`

Props ayeshrajans, desrosj, valentinbora, jrf, joostdevalk, netweb.
Fixes #48082.
Built from https://develop.svn.wordpress.org/trunk@47198


git-svn-id: http://core.svn.wordpress.org/trunk@46998 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-02-06 06:33:11 +00:00
Sergey Biryukov
deb1886078 Accessibility: Text Changes: Use sentence case for the word Error in various error messages, instead of all caps.
Using all caps should be avoided for better readability and because screen readers may pronounce all-caps words as abbreviations.

Props afercia, ryokuhi, sabernhardt, garrett-eclipse.
See #47656, #43037, #42945.
Built from https://develop.svn.wordpress.org/trunk@47156


git-svn-id: http://core.svn.wordpress.org/trunk@46956 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-02-01 21:38:04 +00:00
Sergey Biryukov
001ffe81fb Docs: Improve inline comments per the documentation standards.
Includes minor code layout fixes for better readability.

See #48303.
Built from https://develop.svn.wordpress.org/trunk@47122


git-svn-id: http://core.svn.wordpress.org/trunk@46922 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-01-29 00:45:18 +00:00
Sergey Biryukov
46dd0a79f6 Date/Time: In wp_maybe_decline_date(), add support for a range of days, e.g. February 21–23.
A potential use case is displaying multi-day events in the WordPress Events and News dashboard widget.

See #47798, #48934.
Built from https://develop.svn.wordpress.org/trunk@47098


git-svn-id: http://core.svn.wordpress.org/trunk@46898 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-01-21 23:48:04 +00:00
Sergey Biryukov
2900bb8ea7 Docs: Update links to https://secure.php.net/, they now redirect to https://www.php.net/.
See #48303.
Built from https://develop.svn.wordpress.org/trunk@47088


git-svn-id: http://core.svn.wordpress.org/trunk@46888 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-01-20 03:14:06 +00:00
Sergey Biryukov
a370d1a9c0 Date/Time: Pass the date format to wp_maybe_decline_date().
This ensures that the function has enough context to determine the necessity of replacing the month name with the correct form in locales that require it.

Props SergeyBiryukov, Rarst.
Fixes #48934.
Built from https://develop.svn.wordpress.org/trunk@47078


git-svn-id: http://core.svn.wordpress.org/trunk@46878 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-01-17 01:12:04 +00:00
Sergey Biryukov
dd4d98a368 Docs: In various @return tags, list the expected type first, instead of false.
Follow-up to [46696].

See #48303.
Built from https://develop.svn.wordpress.org/trunk@47060


git-svn-id: http://core.svn.wordpress.org/trunk@46860 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-01-11 18:32:05 +00:00
Sergey Biryukov
d858656023 Bootstrap/Load: Make handling the /favicon.ico requests more flexible.
Previously, `wp_favicon_request()` was introduced in [13205] to avoid a performance hit of serving a full 404 page on every favicon request.

While working as intended, that implementation did not provide a way for theme or plugin authors to manage the behavior of favicon requests.

This changeset implements the following logic (only applied if WordPress is installed in the root directory):

* If there is a Site Icon set in Customizer, redirect `/favicon.ico` requests to that icon.
* Otherwise, use the WordPress logo as a default icon.
* If a physical `/favicon.ico` file exists, do nothing, let the server handle the request.

Handling `/favicon.ico` is now more consistent with handling `/robots.txt` requests.

New functions and hooks:

* Introduce `is_favicon()` conditional tag to complement `is_robots()`.
* Introduce `do_favicon` action to complement `do_robots` and use it in template loader.
* Introduce `do_favicon()` function, hooked to the above action by default, to complement `do_robots()`.
* Introduce `do_faviconico` action to complement `do_robotstxt`, for plugins to override the default behavior.
* Mark `wp_favicon_request()` as deprecated in favor of `do_favicon()`.

Props jonoaldersonwp, birgire, joostdevalk, mukesh27, SergeyBiryukov.
Fixes #47398.
Built from https://develop.svn.wordpress.org/trunk@47018


git-svn-id: http://core.svn.wordpress.org/trunk@46818 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-12-28 21:20:04 +00:00
Sergey Biryukov
27d9bac051 Administration: Add doing_wp_cron to wp_removable_query_args().
It's a single-use URL parameter that does not need to be passed to canonical URLs in the admin.

Props dlh.
Fixes #49017.
Built from https://develop.svn.wordpress.org/trunk@47002


git-svn-id: http://core.svn.wordpress.org/trunk@46802 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-12-21 16:14:04 +00:00
Andrew Ozz
6403619f92 Upload: Run the final file name collision test in wp_unique_filename() for each existing file + 1.
Props pbiron.
See #48975.

Built from https://develop.svn.wordpress.org/trunk@46976


git-svn-id: http://core.svn.wordpress.org/trunk@46776 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-12-17 20:52:03 +00:00
Andrew Ozz
ef7326129f Upload: Fix the final file name collision test in wp_unique_filename() when uploading a file with upper case extension. Add a unit test to catch that in the future.
Fixes #48975 for trunk.

Built from https://develop.svn.wordpress.org/trunk@46966


git-svn-id: http://core.svn.wordpress.org/trunk@46766 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-12-16 23:44:04 +00:00
Andrew Ozz
e0ace80488 Upload:
- Fix PHP warnings in `wp_unique_filename()` when the destination directory is unreadable.
- Run the final name collision test only for files that are saved to the uploads directory.
- Update the unit tests to match.

Props eden159, audrasjb, azaozz.
Fixes #48960 for trunk.
Built from https://develop.svn.wordpress.org/trunk@46965


git-svn-id: http://core.svn.wordpress.org/trunk@46765 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-12-16 23:23:06 +00:00
Sergey Biryukov
098273f1d3 Date/Time: When determining whether to decline the month name in wp_maybe_decline_date(), take word boundaries into account.
Add more unit tests.

Props Rarst, Clorith, timon33, Xendo, SergeyBiryukov.
Fixes #48606.
Built from https://develop.svn.wordpress.org/trunk@46862


git-svn-id: http://core.svn.wordpress.org/trunk@46662 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-12-09 18:50:06 +00:00
Andrew Ozz
15a566edef Upload: fix wp_unique_filename() to prevent name collisions with existing or future image sub-size file names, and add unit tests.
Props Viper007Bond, pbiron, azaozz.
Fixes #42437.
Built from https://develop.svn.wordpress.org/trunk@46822


git-svn-id: http://core.svn.wordpress.org/trunk@46622 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-12-06 22:28:00 +00:00
Sergey Biryukov
0aef4faacd Plugins: Correct default value of $replacement parameter in do_action_deprecated() and apply_filters_deprecated().
This addresses an inconsistency with `_deprecated_hook()`, which uses `is_null()` to check if `$replacement` was provided, however the previous default value was `false`.

Props shaampk1, felipeelia.
Fixes #48817.
Built from https://develop.svn.wordpress.org/trunk@46792


git-svn-id: http://core.svn.wordpress.org/trunk@46592 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-11-27 23:55:01 +00:00
John Blackbourn
f545bb3f63 Docs: Improve documentation of known return types, plus other docs fixes.
See #48303

Built from https://develop.svn.wordpress.org/trunk@46660


git-svn-id: http://core.svn.wordpress.org/trunk@46460 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-11-05 21:23:02 +00:00
John Blackbourn
b3d6acd6a4 Docs: Fix some incorrect return tags in docblocks.
See #48303

Built from https://develop.svn.wordpress.org/trunk@46644


git-svn-id: http://core.svn.wordpress.org/trunk@46444 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-11-03 22:23:01 +00:00
Sergey Biryukov
265bc4fe74 General: Wrap the error message in _deprecated_constructor() in <code> tags instead of <pre>.
Props aftabmuni.
Fixes #48483.
Built from https://develop.svn.wordpress.org/trunk@46633


git-svn-id: http://core.svn.wordpress.org/trunk@46433 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-11-03 10:56:03 +00:00
Sergey Biryukov
979a526902 Code Modernization: Pass an appropriate error level to trigger_error() in _doing_it_wrong() and related functions:
* `_deprecated_function()`
* `_deprecated_argument()`
* `_deprecated_constructor()`
* `_deprecated_file()`

The error level passed is `E_USER_DEPRECATED` for the deprecated function group and `E_USER_NOTICE` for `_doing_it_wrong()`.

Props jrf.
Fixes #36561.
Built from https://develop.svn.wordpress.org/trunk@46625


git-svn-id: http://core.svn.wordpress.org/trunk@46422 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-11-01 00:41:01 +00:00
John Blackbourn
057f661ce3 Docs: Miscellaneous docblock corrections.
See #48303

Built from https://develop.svn.wordpress.org/trunk@46610


git-svn-id: http://core.svn.wordpress.org/trunk@46407 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-10-28 19:48:01 +00:00
Sergey Biryukov
c283f8b1ed Docs: Remove "private" designation from _doing_it_wrong() and related functions:
* `_deprecated_function()`
* `_deprecated_argument()`
* `_deprecated_constructor()`
* `_deprecated_file()`

Plugins and themes should be allowed to use these functions to throw appropriate error notices.

This brings them in line with newer `do_action_deprecated()` and `apply_filters_deprecated()` functions, which are not marked as private.

Props jrf.
Fixes #48251.
Built from https://develop.svn.wordpress.org/trunk@46602


git-svn-id: http://core.svn.wordpress.org/trunk@46399 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-10-27 14:21:03 +00:00
John Blackbourn
d599314349 Docs: Correct and improve inline docs for the file type functions.
See #48303

Built from https://develop.svn.wordpress.org/trunk@46599


git-svn-id: http://core.svn.wordpress.org/trunk@46396 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-10-26 23:49:03 +00:00
John Blackbourn
3caaa40fc6 Docs: Switch more docs over to typed array notation, plus some fixes.
See #48303, #41756

Built from https://develop.svn.wordpress.org/trunk@46596


git-svn-id: http://core.svn.wordpress.org/trunk@46393 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-10-26 21:09:04 +00:00
John Blackbourn
7c2b9f2a2e Docs: Miscellaneous docblock fixes and improvements.
See #48303

Built from https://develop.svn.wordpress.org/trunk@46594


git-svn-id: http://core.svn.wordpress.org/trunk@46391 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-10-26 20:43:04 +00:00