Commit Graph

1676 Commits

Author SHA1 Message Date
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
Sergey Biryukov 8410526528 Date/Time: Make sure `date_i18n()` correctly handles zero timestamp after [45901].
Props soulseekah, gravityview, Rarst.
Reviewed by azaozz, SergeyBiryukov.
Fixes #28636.
Built from https://develop.svn.wordpress.org/trunk@46577


git-svn-id: http://core.svn.wordpress.org/trunk@46374 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-10-25 11:05:07 +00:00
Sergey Biryukov 4e06f0ad40 Date/Time: Make sure `wp_date()` does not unnecessarily escape localized numbers, but keeps localized slashes.
Props Rarst, tmatsuur, remcotolsma, peterwilsoncc.
Reviewed by peterwilsoncc.
Fixes #48319.
Built from https://develop.svn.wordpress.org/trunk@46569


git-svn-id: http://core.svn.wordpress.org/trunk@46366 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-10-22 17:31:08 +00:00
whyisjake 2524ba3aec Filesystem API: Prevent directory travelersals when creating new folders.
Reject file paths that contain sub-directory paths.

Props iandunn, xknown, sstoqnov, whyisjake.

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


git-svn-id: http://core.svn.wordpress.org/trunk@46274 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-10-14 15:31:04 +00:00
Sergey Biryukov 8d1e51e9c7 Docs: Add a `@since` note about new parameters with the spread operator added to function signatures.
Props jrf.
See #47678.
Built from https://develop.svn.wordpress.org/trunk@46451


git-svn-id: http://core.svn.wordpress.org/trunk@46249 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-10-09 04:28:02 +00:00
Andrea Fercia 20e781f44d Accessibility: Improve and modernize user interface controls: Remove the CSS transform 1 pixel shift from the buttons active state.
Props Joen.
See #34904.

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


git-svn-id: http://core.svn.wordpress.org/trunk@46149 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-09-30 10:53:57 +00:00
desrosj 894e133d0c Build/Test Tools: Introduce automated PHP compatibility checking.
This change introduces a new Composer script, `compat` that will scan the codebase for (detectable) potential PHP compatibility issues using the `PHP_CodeSniffer` and a custom ruleset based off of the `PHPCompayibilityWP` ruleset (`phpcompat.xml.dist`).

The command will be run as a separate job within each Travis build. While many compatibility issues and false positives have already been corrected in this commit and other Trac tickets, there are still some remaining. For that reason, the job is allowed to fail while the remainder of the potential compatibility issues are investigated and addressed. After those are resolved, the job should be set as required to pass to help prevent new compatibility issues from being introduced.

Props desrosj, jrf, all PHPCompatibilityWP and PHPCompatibility contributors.
Fixes #46152.
Built from https://develop.svn.wordpress.org/trunk@46290


git-svn-id: http://core.svn.wordpress.org/trunk@46102 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-09-25 13:47:58 +00:00
Sergey Biryukov eb3f420848 Code Modernization: Remove all code using a `version_compare()` with a PHP version older than PHP 5.6.
Props jrf.
Fixes #48074.
Built from https://develop.svn.wordpress.org/trunk@46214


git-svn-id: http://core.svn.wordpress.org/trunk@46026 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-09-20 22:02:57 +00:00
desrosj 3cf6276ed0 Code Modernization: Remove JSON extension workarounds for PHP < 5.6.
The PHP native JSON extension has been bundled and compiled with PHP by default since version 5.2.0. Because the minimum version of PHP required by WordPress is now 5.6.20 (see #46594 and [45058]), JSON extension related polyfills and backwards compatibility code can now be removed.

This change removes code that supported JSON related functionality on older versions of PHP. This includes (but is not limited to) checks that `json_last_error()` exists, checking and setting the `JSON_UNESCAPED_SLASHES` and `JSON_PRETTY_PRINT` constants if not previously defined, and deprecating the `_wp_json_prepare_data()` function (which was 100% workaround code).

Follow up of [46205].

See #47699.
Props jrf, Clorith, pento.
Built from https://develop.svn.wordpress.org/trunk@46206


git-svn-id: http://core.svn.wordpress.org/trunk@46018 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-09-20 20:08:57 +00:00
Boone Gorges 2b92bcab85 PHPCS: Fix coding standards violations in `do_enclose()`.
* Use strict checking when appropriate in `in_array()` checks.
* Improved comment formatting.
* Yoda and strict equality checks where appropriate.

See #36824.
Built from https://develop.svn.wordpress.org/trunk@46176


git-svn-id: http://core.svn.wordpress.org/trunk@45988 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-09-19 01:54:56 +00:00
Boone Gorges 7c56b972cc Improve `do_enclose()` logic on post publish.
Removing the direct SQL query in `do_all_pings()` improves filterability.

As part of this change, the signature of `do_enclose()` is changed so that
a null `$content` parameter can be passed, with the `$content` then inferred
from the `$post` passed in the second parameter. In addition, the second
parameter was modified so that a post ID or a `WP_Post` object can be
provided. These changes make it possible to trigger enclosure checks with
a post ID alone (as in `do_all_pings()`) and also brings the function
signature in line with `do_trackbacks()` and `pingback()`.

Props dshanske, spacedmonkey, janw.oostendorp, mrmadhat, birgire.
See #36824.
Built from https://develop.svn.wordpress.org/trunk@46175


git-svn-id: http://core.svn.wordpress.org/trunk@45987 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-09-19 01:49:56 +00:00
whyisjake 471cf58049 Add SMS to the list of allowed protocols.
This commit expands the list of allowed protocols. It adds the `sms://` which can be used to open meessaging clients for mobile users.

Props rilwis, kraftbj

Fixes #39415

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


git-svn-id: http://core.svn.wordpress.org/trunk@45984 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-09-18 23:38:55 +00:00
John Blackbourn b4ac30c19c Docs: Improve docs for upload and `wp_die()` related functions.
See #47110 

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


git-svn-id: http://core.svn.wordpress.org/trunk@45974 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-09-17 21:03:54 +00:00
Sergey Biryukov 7a6d74e28a Code Modernisation: Introduce the spread operator in `wp-includes/functions.php`.
Rather than relying `func_get_args()` to retrieve arbitrary function arguments, we can now use the spread operator to assign them directly to a variable.

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


git-svn-id: http://core.svn.wordpress.org/trunk@45938 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-09-15 10:45:56 +00:00
Sergey Biryukov 8316af9198 Bootstrap/Load: Allow charset to be passed to the `wp_die()` function.
Props mohsinrasool, spacedmonkey, socalchristina.
Fixes #46666.
Built from https://develop.svn.wordpress.org/trunk@46109


git-svn-id: http://core.svn.wordpress.org/trunk@45921 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-09-14 15:42:56 +00:00
Sergey Biryukov f9b87e88ba HTTP API: Add a unit test for `get_status_header_desc()`.
Props pbearne.
Fixes #46631.
Built from https://develop.svn.wordpress.org/trunk@46107


git-svn-id: http://core.svn.wordpress.org/trunk@45919 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-09-14 14:54:56 +00:00
Andrew Ozz 2d6a772400 Fix "white spaces at end of line" in docblock (IDE) woes after [46077].
See #32437.
Built from https://develop.svn.wordpress.org/trunk@46078


git-svn-id: http://core.svn.wordpress.org/trunk@45890 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-09-07 02:12:55 +00:00
Andrew Ozz 1de168e016 Media: Improve handling of cases where an uploaded image matches exactly a defined intermediate size. In most of these cases the original image has been edited by the user and is "web ready", there is no need for an identical intermediate image.
Introduces the `wp_image_resize_identical_dimensions` filter so plugins and themes can determine whether a new image with identical dimensions should be created, defaults to false.

Props wpdennis, HKandulla, galbaras, azaozz.
See #32437.
Built from https://develop.svn.wordpress.org/trunk@46077


git-svn-id: http://core.svn.wordpress.org/trunk@45889 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-09-07 01:34:55 +00:00
Sergey Biryukov e199663322 I18N: Capitalize translator comments consistently, add trailing punctuation.
Includes minor code layout fixes.

See #44360.
Built from https://develop.svn.wordpress.org/trunk@45932


git-svn-id: http://core.svn.wordpress.org/trunk@45743 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-09-03 00:41:05 +00:00
Peter Wilson b55ca66759 #43590: Use robots meta tag to better discourage search engines.
This changes the "discourage search engines" option to output a `noindex, nofollow` robots meta tag. `Disallow: /` is removed from the `robots.txt` to allow search engines to discover they are requested not to index the site.

Disallowing search engines from accessing a site in the `robots.txt` file can result in search engines listing a site with a fragment (a listing without content).

Props donmhico, jonoaldersonwp.
Fixes #43590.


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


git-svn-id: http://core.svn.wordpress.org/trunk@45739 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-09-02 02:27:55 +00:00
Sergey Biryukov 16b8d91baa I18N: Improve translator comments.
* Add missing translator comments.
* Fix placement of some translator comments. Translator comments should be on the line directly above the line containing the translation function call for optimal compatibility with various `.pot` file generation tools. The CS auto-fixing, which changed some inconsistent function calls to multi-line function calls, is part of the reason why this was no longer the case for a select group of translator comments.

Includes minor code layout fixes.

Polyglots, rejoice! All WordPress core files now have translator comments for all strings with placeholders!

Props jrf, subrataemfluence, GaryJ, webdados, Dency, swissspidy, alvarogois, marcomartins, mihaiiceyro, vladwtz, niq1982, flipkeijzer, michielatyoast, chandrapatel, thrijith, joshuanoyce, FesoVik, tessak22, bhaktirajdev, cleancoded, dhavalkasvala, garrett-eclipse, bibliofille, socalchristina, priyankkpatel, 5hel2l2y, adamsilverstein, JeffPaul, pierlo, SergeyBiryukov.
Fixes #44360.
Built from https://develop.svn.wordpress.org/trunk@45926


git-svn-id: http://core.svn.wordpress.org/trunk@45737 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-09-01 17:13:59 +00:00
Sergey Biryukov d26191eb03 Docs: Simplify `get_plugin_data()` and `get_file_data()` description.
See #47110.
Built from https://develop.svn.wordpress.org/trunk@45917


git-svn-id: http://core.svn.wordpress.org/trunk@45728 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-08-30 16:57:56 +00:00
Sergey Biryukov 16c43f368d Date/Time: Restore the previous behavior of `date_i18n()` where invalid input would result in current time.
Make `wp_date()` return `false` on invalid timestamp input, for consistency with upstream PHP `date()` function.

Props Rarst.
Fixes #28636.
Built from https://develop.svn.wordpress.org/trunk@45914


git-svn-id: http://core.svn.wordpress.org/trunk@45725 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-08-29 23:18:55 +00:00
Mike Schroder ccdc221b32 Administration: Output valid HTML when `wp_die()` is called.
To better support HTML and string calls to `wp_die()` without
outputting invalid HTML, wraps error messages in `<div>` rather than `<p>`.

Adds `.wp-die-message` CSS class for styling.

Props dinhtungdu, jeremyfelt, audrasjb, SergeyBiryukov, afercia, audrasjb, noisysocks.
Fixes #47580.
Built from https://develop.svn.wordpress.org/trunk@45909


git-svn-id: http://core.svn.wordpress.org/trunk@45720 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-08-29 07:54:01 +00:00
Sergey Biryukov 6057b32e9b Date/Time: Revamp `mysql2date()` to use `wp_date()` and handle invalid input in a consistent manner.
Add unit tests, improve documentation.

Props Rarst, pbearne.
Fixes #28992.
Built from https://develop.svn.wordpress.org/trunk@45908


git-svn-id: http://core.svn.wordpress.org/trunk@45719 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-08-29 05:07:56 +00:00
Sergey Biryukov 12aa694ee5 Date/Time: Introduce `wp_date()` to retrieve the date in localized format.
Convert `date_i18n()` into a wrapper for `wp_date()`.

`wp_date()` is intended as a replacement for `date_i18n()` without legacy quirks in it. It accepts a true Unix timestamp (not summed with timezone offset) and an arbitrary timezone.

Props Rarst, mboynes, MikeHansenMe, rmccue, nacin.
Fixes #28636.
Built from https://develop.svn.wordpress.org/trunk@45901


git-svn-id: http://core.svn.wordpress.org/trunk@45712 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-08-28 00:52:56 +00:00
Sergey Biryukov 8750097e4b Docs: Remove a clarification from `do_robots()` description that doesn't really clarify anything.
See #47110.
Built from https://develop.svn.wordpress.org/trunk@45898


git-svn-id: http://core.svn.wordpress.org/trunk@45709 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-08-27 00:17:56 +00:00
Sergey Biryukov 6330f10b7d Date/Time: Revert unintended changes from [45882].
Props TimothyBlynJacobs.
See #25768.
Built from https://develop.svn.wordpress.org/trunk@45884


git-svn-id: http://core.svn.wordpress.org/trunk@45695 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-08-23 01:16:53 +00:00
Sergey Biryukov 6e555f0c77 Date/Time: Introduce `current_datetime()` for better time operations.
Returning a `DateTimeImmutable` representation of the current moment in time, this allows for a more flexible and reliable use than `current_time()` provides.

Props Rarst.
Fixes #47464.
Built from https://develop.svn.wordpress.org/trunk@45883


git-svn-id: http://core.svn.wordpress.org/trunk@45694 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-08-23 01:12:55 +00:00
Sergey Biryukov 6f8e50c7f0 Date/Time: Rewrite and simplify `date_i18n()` using `wp_timezone()` to address multiple issues with certain date formats and timezones, while preserving some extra handling for legacy use cases.
Improve unit test coverage.

Props Rarst, remcotolsma, raubvogel.
Fixes #25768.
Built from https://develop.svn.wordpress.org/trunk@45882


git-svn-id: http://core.svn.wordpress.org/trunk@45693 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-08-23 00:57:56 +00:00
Sergey Biryukov d309715a95 Coding Standards: Add missing `break` for the default case in `wp_privacy_anonymize_data()`.
Props itowhid06.
Fixes #47921.
Built from https://develop.svn.wordpress.org/trunk@45877


git-svn-id: http://core.svn.wordpress.org/trunk@45688 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-08-22 14:50:55 +00:00
Sergey Biryukov 349e9f56c1 Date/Time: Use PHP `DateTime` class API in `current_time()`.
Only use the legacy WP timestamp approach (a sum of timestamp and timezone offset) for `timestamp` and `U` formats without the `$gmt` flag.

Otherwise, make sure the function returns correct local time for any format.

Props Rarst, jdgrimes.
Fixes #40653.
Built from https://develop.svn.wordpress.org/trunk@45856


git-svn-id: http://core.svn.wordpress.org/trunk@45667 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-08-19 21:07:50 +00:00
Sergey Biryukov 46ca606114 Coding Standards: Use `KB_IN_BYTES` in `get_file_data()`.
See #22405, #47632.
Built from https://develop.svn.wordpress.org/trunk@45854


git-svn-id: http://core.svn.wordpress.org/trunk@45665 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-08-19 20:10:55 +00:00