Commit Graph

1707 Commits

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