Commit Graph

1645 Commits

Author SHA1 Message Date
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
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