Commit Graph

1638 Commits

Author SHA1 Message Date
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
Sergey Biryukov
4896dc64ee Date/Time: Introduce wp_timezone_string() and wp_timezone() for unified timezone retrieval.
* `wp_timezone_string()` retrieves the timezone from current settings as a string. Uses the `timezone_string` option to get a proper timezone if available, otherwise falls back to an offset.
* `wp_timezone()` retrieves the timezone from current settings as a `DateTimeZone` object. Timezone can be based on a PHP timezone string or a `±HH:MM` offset.

Props Rarst, remcotolsma, johnjamesjacoby, rmccue.
Fixes #24730.
Built from https://develop.svn.wordpress.org/trunk@45853


git-svn-id: http://core.svn.wordpress.org/trunk@45664 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-08-19 19:08:59 +00:00
Sergey Biryukov
282dfee8e0 General: Correctly detect large floats in is_serialized().
Props killerbishop, donmhico, hoythan.
Fixes #46570.
Built from https://develop.svn.wordpress.org/trunk@45754


git-svn-id: http://core.svn.wordpress.org/trunk@45565 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-08-05 13:55:57 +00:00
Sergey Biryukov
9967a3e030 Docs: Add missing description for $post global.
Props immeet94.
Fixes #46503. See #47110.
Built from https://develop.svn.wordpress.org/trunk@45742


git-svn-id: http://core.svn.wordpress.org/trunk@45553 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-08-04 12:28:56 +00:00
Sergey Biryukov
7f7480cb2a Docs: Add missing description for $wp_query and $wp_the_query globals.
Props mukesh27.
See #45604, #47110.
Built from https://develop.svn.wordpress.org/trunk@45739


git-svn-id: http://core.svn.wordpress.org/trunk@45550 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-08-04 01:59:56 +00:00
Sergey Biryukov
e0311b76c7 Docs: Add missing description for $wp_locale global.
Props mukesh27.
See #45604, #47110.
Built from https://develop.svn.wordpress.org/trunk@45737


git-svn-id: http://core.svn.wordpress.org/trunk@45548 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-08-04 01:46:55 +00:00
Sergey Biryukov
ea606165a5 Docs: Add missing description for $wp global.
See #45604, #47110.
Built from https://develop.svn.wordpress.org/trunk@45736


git-svn-id: http://core.svn.wordpress.org/trunk@45547 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-08-04 01:28:55 +00:00
Sergey Biryukov
a186dbcb65 I18N: Update translator comments after [45674].
See #47771.
Built from https://develop.svn.wordpress.org/trunk@45676


git-svn-id: http://core.svn.wordpress.org/trunk@45487 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-07-25 22:52:56 +00:00
Sergey Biryukov
8e85299a00 General: First pass at replacing Codex URLs with a corresponding HelpHub or DevHub article.
Props ianbelanger, tobifjellner, SergeyBiryukov.
See #47771.
Built from https://develop.svn.wordpress.org/trunk@45674


git-svn-id: http://core.svn.wordpress.org/trunk@45485 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-07-25 22:45:57 +00:00
Sergey Biryukov
18bd01985b Coding Standards: Rename $r variable used with wp_parse_args() to $parsed_args for clarity.
Props freewebmentor.
Fixes #45059.
Built from https://develop.svn.wordpress.org/trunk@45667


git-svn-id: http://core.svn.wordpress.org/trunk@45478 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-07-25 00:48:58 +00:00
Gary Pendergast
abcbee954f Coding Standards: Fix instances of WordPress.PHP.NoSilencedErrors.Discouraged.
Noteable changes:
- The `magic_quotes_runtime` and `magic_quotes_sybase` settings were removed in PHP 5.4, so no longer need to be set.
- Some functions that use external libraries can generate errors that can't be tested for, so are globally allowed to silence errors.
- Quite a few functions would cause errors if `safe_mode` was set. This setting was removed in PHP 5.4.
- Only a handful of `header()` calls needed corresponding `headers_sent()` checks for unit tests to pass, but more may need to be added as the nightlies builds are tested.

See #46732.

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


git-svn-id: http://core.svn.wordpress.org/trunk@45422 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-07-09 05:45:58 +00:00
Gary Pendergast
87675d288b Coding Standards: Fix all WordPress.WhiteSpace.PrecisionAlignment issues.
See #47632.


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


git-svn-id: http://core.svn.wordpress.org/trunk@45413 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-07-05 05:21:56 +00:00
Gary Pendergast
4803fc405e Coding Standards: Fix the Squiz.PHP.DisallowMultipleAssignments violations in wp-includes.
See #47632.


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


git-svn-id: http://core.svn.wordpress.org/trunk@45401 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-07-02 23:42:58 +00:00
Gary Pendergast
55af0f0d0a Coding Standards: Fix/ignore the WordPress.NamingConventions.ValidFunctionName violations.
See #47632


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


git-svn-id: http://core.svn.wordpress.org/trunk@45391 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-07-01 08:01:57 +00:00
Sergey Biryukov
a06e914bae Date/Time: Add more supported formats to wp_maybe_decline_date().
Props SergeyBiryukov, Rarst.
Fixes #37411.
Built from https://develop.svn.wordpress.org/trunk@45555


git-svn-id: http://core.svn.wordpress.org/trunk@45366 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-06-20 13:47:52 +00:00
Sergey Biryukov
05afb2271d CSS Coding Standards: Use unitless values for line-height in wp-includes/functions.php.
Props ianbelanger, pbiron, afercia.
Fixes #46523. See #44643.
Built from https://develop.svn.wordpress.org/trunk@45473


git-svn-id: http://core.svn.wordpress.org/trunk@45284 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-05-30 12:39:52 +00:00
Sergey Biryukov
c77e771c84 Date/Time: Replace all instances of date() with gmdate().
Use of `date()` in core depends on PHP timezone set to UTC and not changed by third party code (which cannot be guaranteed).

`gmdate()` is functionally equivalent, but is not affected by PHP timezone setting: it's always UTC, which is the exact behavior the core needs.

Props nielsdeblaauw, Rarst.
Fixes #46438. See #44491.
Built from https://develop.svn.wordpress.org/trunk@45424


git-svn-id: http://core.svn.wordpress.org/trunk@45235 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-05-26 00:12:54 +00:00
Sergey Biryukov
9785381a8c Date/Time: Use strict comparison in is_new_day(), add a unit test.
Props pbearne.
Fixes #46627.
Built from https://develop.svn.wordpress.org/trunk@45375


git-svn-id: http://core.svn.wordpress.org/trunk@45186 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-05-22 17:53:52 +00:00
Sergey Biryukov
ea8078f73c Media: Fix deletion of files on Windows.
`wp_delete_file_from_directory()` should always normalize file paths before comparing.

Props tonybogdanov, SergeyBiryukov.
Fixes #47185.
Built from https://develop.svn.wordpress.org/trunk@45352


git-svn-id: http://core.svn.wordpress.org/trunk@45163 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-05-17 13:30:02 +00:00
Sergey Biryukov
643ec358a4 Docs: Correct @return description for get_dirsize().
Props wpboss, tmatsuur.
Fixes #46987.
Built from https://develop.svn.wordpress.org/trunk@45249


git-svn-id: http://core.svn.wordpress.org/trunk@45058 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-04-19 13:39:52 +00:00
Andrew Ozz
9a316c6ea4 Site health, info tab:
- Change `recurse_dirsize()` to accept an array of excluded paths.
- Change so we don't calculate the sizes of dirs in wp-content twice.
- Add the size in bytes to the "debug" into.
- Add a custom DOM event after the dir sizes request is done. Can be used by plugins to "daisy chain" more requests.
- Move "WordPress directory location" and "WordPress directory size" to the top in the "Directories and Sizes" section.
- Move "Theme directory location" to the "Active Theme" section.
- Fix labels capitalization.

Props xkon, afercia, Clorith, azaozz.
Fixes #46707.
Built from https://develop.svn.wordpress.org/trunk@45220


git-svn-id: http://core.svn.wordpress.org/trunk@45029 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-04-16 23:02:51 +00:00
Sergey Biryukov
7af011a5f0 Bootstrap/Load: After [45016], make sure wp_die() does not cause _doing_it_wrong() notices if called before $wp_query global is set.
Props tmdesigned, TimothyBlynJacobs.
Fixes #46813.
Built from https://develop.svn.wordpress.org/trunk@45206


git-svn-id: http://core.svn.wordpress.org/trunk@45015 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-04-15 23:49:53 +00:00
Sergey Biryukov
88fdfae793 Plugins: Introduce is_wp_version_compatible() and is_php_version_compatible() for checking compatibility with the current WordPress or PHP version.
Props afragen.
Fixes #46599.
Built from https://develop.svn.wordpress.org/trunk@45185


git-svn-id: http://core.svn.wordpress.org/trunk@44994 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-04-12 23:56:52 +00:00
Joe McGill
1b35ea6978 Media: Fix deletion of files when using stream wrappers.
This fixes a bug introduced in [43392] which breaks file deletion on systems using stream wrappers, due to limitations of `realpath()`.

Props antonypuckey, pfiled.
Fixes #44563.

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


git-svn-id: http://core.svn.wordpress.org/trunk@44986 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-04-12 20:01:52 +00:00
Gary Pendergast
9a80e2095b Text Changes: Tweak the wording of email notification subjects.
This change brings more coherence between the subject lines of the various emails WordPress will send.

Props ramiy, pento.
Fixes #37940.

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


git-svn-id: http://core.svn.wordpress.org/trunk@44946 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-04-08 06:17:51 +00:00
Andrew Ozz
4601e178e5 Site health: fix usage of max_execution_time. When PHP is run from the cli the default is 0.
Fixes #46645.
Built from https://develop.svn.wordpress.org/trunk@45111


git-svn-id: http://core.svn.wordpress.org/trunk@44920 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-04-04 21:54:53 +00:00
Andrew Ozz
2cdc22aded Site health:
- Prevent fatal errors from timeouts on the Tools => Site Health => Info tab.
- Use the `get_dirsize()` and `recurse_dirsize()` functions to calculate directory sizes. The results are cached.
- Introduce "timeout protection" in `recurse_dirsize()`.

Props pento, Clorith, xkon, afercia, jeremyfelt, azaozz.
Fixes #46645.
Built from https://develop.svn.wordpress.org/trunk@45104


git-svn-id: http://core.svn.wordpress.org/trunk@44913 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-04-02 23:33:53 +00:00
Sergey Biryukov
d5f198676b Plugins: In wp_update_php_annotation(), only display the annotation and the surrounding tags if it's not empty.
Props afragen.
Fixes #46678.
Built from https://develop.svn.wordpress.org/trunk@45045


git-svn-id: http://core.svn.wordpress.org/trunk@44854 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-27 22:37:51 +00:00
Sergey Biryukov
65b1cbfd45 Docs: Improve documentation for wp_die() handlers after [45015] and [45016].
See #46543, #46025, #46026.
Built from https://develop.svn.wordpress.org/trunk@45017


git-svn-id: http://core.svn.wordpress.org/trunk@44826 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-26 23:18:53 +00:00
Sergey Biryukov
546841949f Bootstrap/Load: Add support for XML requests to wp_die().
In addition to AJAX, XML-RPC, JSON, and JSONP requests, `wp_die()` now handles XML requests correctly, returning information in the expected content type.

Props spacedmonkey, birgire.
Fixes #46026. See #44458.
Built from https://develop.svn.wordpress.org/trunk@45016


git-svn-id: http://core.svn.wordpress.org/trunk@44825 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-26 23:11:52 +00:00
Sergey Biryukov
4101255505 Bootstrap/Load: Add support for JSONP requests to wp_die().
In addition to AJAX, XML-RPC, and JSON requests, `wp_die()` now handles JSONP requests correctly, returning information in the expected content type.

Props spacedmonkey, TimothyBlynJacobs.
Fixes #46025. See #44458.
Built from https://develop.svn.wordpress.org/trunk@45015


git-svn-id: http://core.svn.wordpress.org/trunk@44824 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-26 22:26:52 +00:00
Sergey Biryukov
50bb3c689f Plugins: Remove wp_is_wp_compatible() and wp_is_php_compatible() functions added in [44978] for now, to discuss use cases and better naming.
See #46599, #43992.
Built from https://develop.svn.wordpress.org/trunk@44981


git-svn-id: http://core.svn.wordpress.org/trunk@44812 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 13:00:52 +00:00
Sergey Biryukov
75a3e484ec Plugins: Block plugin activation if it requires a higher version of PHP or WordPress.
Introduce `validate_plugin_requirements()` for validating a plugin's WordPress and PHP version requirements.

Introduce `wp_is_wp_compatible()` and `wp_is_php_compatible()` for checking compatibility with the current WordPress or PHP version.

Props afragen, joyously, DrewAPicture, TimothyBlynJacobs, desrosj, flixos90, SergeyBiryukov.
See #43992.
Built from https://develop.svn.wordpress.org/trunk@44978


git-svn-id: http://core.svn.wordpress.org/trunk@44809 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-22 00:37:50 +00:00
desrosj
53f212ebbe General: Improve the PHP update notice annotation.
This change introduces the `wp_get_update_php_annotation()` function, which returns the message displayed when a host filters the direct PHP update or PHP update education URLs to indicate the information is site specific and provided by the host, not WordPress core.

It also updates `wp_update_php_annotation()` to accept a `$before` and `$after` parameter, which makes this notice more flexible for displaying in multiple locations within the admin area. Previously, the markup output in `wp_update_php_annotation()` was hardcoded, which was making it difficult to display it properly in multiple locations.

Props afragen, aaroncampbell, flixos90, TimothyBlynJacobs, desrosj.
Fixes #46044.
Built from https://develop.svn.wordpress.org/trunk@44935


git-svn-id: http://core.svn.wordpress.org/trunk@44766 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-19 16:54:52 +00:00
Sergey Biryukov
81ca7552b8 Docs: Improve documentation for wp_die() handlers.
See #46543.
Built from https://develop.svn.wordpress.org/trunk@44921


git-svn-id: http://core.svn.wordpress.org/trunk@44752 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-17 01:45:50 +00:00
desrosj
ecfb6fd700 Privacy: Do not attempt to cleanup personal data export files when the directory does not exist.
Checking for the presence of the directory and returning early prevents PHP warnings when attempting to list files in a non-existent directory.

Props arena, garrett-eclipse.
Fixes #45136.
Built from https://develop.svn.wordpress.org/trunk@44910


git-svn-id: http://core.svn.wordpress.org/trunk@44741 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-15 19:00:51 +00:00
desrosj
7d952a7930 General: Add missing @since annotation for wp_get_direct_php_update_url().
Missed in [44815].

Props birgire.
See #46074.
Built from https://develop.svn.wordpress.org/trunk@44829


git-svn-id: http://core.svn.wordpress.org/trunk@44661 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-11 12:59:50 +00:00
Sergey Biryukov
51c0543bf2 Bootstrap/Load: Add nocache_headers() to all wp_die() handlers.
Props spacedmonkey.
Fixes #46054.
Built from https://develop.svn.wordpress.org/trunk@44828


git-svn-id: http://core.svn.wordpress.org/trunk@44660 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-11 11:47:50 +00:00
Sergey Biryukov
69939e4929 Database: Use wp_die() instead of die() in dead_db(), for more flexibility and consistency with other error messages in core.
Props gitlost.
Fixes #41655.
Built from https://develop.svn.wordpress.org/trunk@44827


git-svn-id: http://core.svn.wordpress.org/trunk@44659 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-11 11:31:50 +00:00