Commit Graph

784 Commits

Author SHA1 Message Date
Felix Arntz
7926dbb4d5 General: Avoid early initialization of variable in get_bloginfo().
This is a very minor, yet simple performance optimization in a commonly called function, avoiding unnecessary initialization of the `$url` variable when it may not be needed. The conditional is simple enough to not use a variable altogether.

Props Cybr, swissspidy.
Fixes #59450.

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


git-svn-id: http://core.svn.wordpress.org/trunk@56681 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-12-07 22:57:28 +00:00
Pascal Birchler
eb5c155700 I18N: Improve translator comments for strings containing date formats.
Adds translator comments where absent and changes code style so that
comments are attached to the right strings during string extraction.

Props NekoJonez.
Fixes #59947
Built from https://develop.svn.wordpress.org/trunk@57136


git-svn-id: http://core.svn.wordpress.org/trunk@56647 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-11-26 16:43:30 +00:00
Sergey Biryukov
a0504e8091 Text Changes: Update mentions of “web site” to “website” for consistency.
While “web site” was the original spelling, this variant has become rarely used, and “website” is now the standard spelling, already used throughout most of the WordPress core.

Reference: [https://en.wikipedia.org/wiki/Website Wikipedia: Website].

Props LiamMcArthur, cafenoirdesign, sabbirshouvo, sabernhardt, ironprogrammer, mukesh27.
Fixes #59853, #54276.
Built from https://develop.svn.wordpress.org/trunk@57131


git-svn-id: http://core.svn.wordpress.org/trunk@56642 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-11-22 17:44:24 +00:00
Sergey Biryukov
d8936a9fe7 Coding Standards: Remove superfluous blank lines at the end of various functions.
Note: This is enforced by WPCS 3.0.0.

Follow-up to [56536], [56547].

Props jrf.
See #59161, #58831.
Built from https://develop.svn.wordpress.org/trunk@56548


git-svn-id: http://core.svn.wordpress.org/trunk@56060 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-08 10:03:21 +00:00
Sergey Biryukov
ad16732d27 Code Modernization: Use str_contains() in a few more places.
`str_contains()` was introduced in PHP 8.0 to perform a case-sensitive check indicating if the string to search in (haystack) contains the given substring (needle).

WordPress core includes a polyfill for `str_contains()` on PHP < 8.0 as of WordPress 5.9.

This commit replaces `false !== strpos( ... )` with `str_contains()` in core files, making the code more readable and consistent, as well as better aligned with modern development practices.

Follow-up to [55988], [56021].

See #58206.
Built from https://develop.svn.wordpress.org/trunk@56031


git-svn-id: http://core.svn.wordpress.org/trunk@55543 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-06-26 10:17:25 +00:00
Sergey Biryukov
1ce5dc7444 Code Modernization: Replace usage of strpos() with str_contains().
`str_contains()` was introduced in PHP 8.0 to perform a case-sensitive check indicating if the string to search in (haystack) contains the given substring (needle).

WordPress core includes a polyfill for `str_contains()` on PHP < 8.0 as of WordPress 5.9.

This commit replaces `false !== strpos( ... )` with `str_contains()` in core files, making the code more readable and consistent, as well as better aligned with modern development practices.

Follow-up to [52039], [52040], [52326], [55703], [55710], [55987].

Props Soean, spacedmonkey, costdev, dingo_d, azaozz, mikeschroder, flixos90, peterwilsoncc, SergeyBiryukov.
Fixes #58206.
Built from https://develop.svn.wordpress.org/trunk@55988


git-svn-id: http://core.svn.wordpress.org/trunk@55500 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-06-22 14:36:26 +00:00
John Blackbourn
acc6e5d685 General: Replace some instances of "blog" with "site" in documentation, translator comments, and user-facing text strings.
This is not an exhaustive change, but it gets us closer to using "site" in place of "blog" in as many places as possible.

Props NekoJonez, audrasjb, oglekler

Fixes #58117

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


git-svn-id: http://core.svn.wordpress.org/trunk@55454 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-06-19 18:27:27 +00:00
John Blackbourn
bb9b9d17f4 Docs: Miscellaneous corrections and improvements to docblocks.
See #57840

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


git-svn-id: http://core.svn.wordpress.org/trunk@55382 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-05-30 17:45:21 +00:00
Sergey Biryukov
956be813b6 Coding Standards: Improve formatting of some SQL queries for better readability.
This corrects the placement of double quotes around the query and makes sure the alignment is consistent.

Props umeshmcakadi, mukesh27, krupalpanchal, dhrumilk, SergeyBiryukov.
Fixes #58372.
Built from https://develop.svn.wordpress.org/trunk@55857


git-svn-id: http://core.svn.wordpress.org/trunk@55369 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-05-25 12:55:19 +00:00
Sergey Biryukov
2ec23a82ed Code Modernization: Replace usage of strpos() with str_starts_with().
`str_starts_with()` was introduced in PHP 8.0 to perform a case-sensitive check indicating if the string to search in (haystack) begins with the given substring (needle).

WordPress core includes a polyfill for `str_starts_with()` on PHP < 8.0 as of WordPress 5.9.

This commit replaces `0 === strpos( ... )` with `str_starts_with()` in core files, making the code more readable and consistent, as well as improving performance.

While `strpos()` is slightly faster than the polyfill on PHP < 8.0, `str_starts_with()` is noticeably faster on PHP 8.0+, as it is optimized to avoid unnecessarily searching along the whole haystack if it does not find the needle.

Follow-up to [52039], [52040], [52326].

Props spacedmonkey, costdev, sabernhardt, mukesh27, desrosj, jorbin, TobiasBg, ayeshrajans, lgadzhev, SergeyBiryukov.
Fixes #58012.
Built from https://develop.svn.wordpress.org/trunk@55703


git-svn-id: http://core.svn.wordpress.org/trunk@55215 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-05-02 15:45:22 +00:00
Sergey Biryukov
6f745b9fca Coding Standards: Use strict comparison in wp-admin/includes/class-wp-site-icon.php.
Follow-up to [32994], [35299].

Props aristath, poena, afercia, SergeyBiryukov.
See #57839.
Built from https://develop.svn.wordpress.org/trunk@55678


git-svn-id: http://core.svn.wordpress.org/trunk@55190 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-04-23 04:02:18 +00:00
Sergey Biryukov
e3360c89e2 General: Remove Windows Live Writer manifest file.
The XML manifest was originally added in WordPress 2.3.1 to turn on tagging support in Windows Live Writer.

Given that the last major release of the software came out in 2012, and it was completely discontinued in January 2017, including this file in core no longer provides any benefit.

Follow-up to [6192], [49904].

Props joostdevalk, ayeshrajans, flixos90, jhabdas, frank-klein, wtranch, SergeyBiryukov.
Fixes #41404.
Built from https://develop.svn.wordpress.org/trunk@55620


git-svn-id: http://core.svn.wordpress.org/trunk@55132 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-04-04 14:56:22 +00:00
spacedmonkey
1bf93a87a4 Cache API: Introduce new queries cache groups.
Give developers more control over how query caches are handled within an object caches. Now all caches that cache the result of a query, are cached in a group that is suffixed with -queries. Developers can use these groups, to add custom cache invalidation rules or to make them none persistent.

Props spacedmonkey, owi, tillkruess, skithund, peterwilsoncc, flixos90, sergeybiryukov, mukesh27.
Fixes #57625.
Built from https://develop.svn.wordpress.org/trunk@55526


git-svn-id: http://core.svn.wordpress.org/trunk@55048 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-03-10 16:30:03 +00:00
spacedmonkey
df7b417d64 Networks and Sites: Replace get_blog_details with get_site.
Replace usage of the function get_blog_details with more lightweight get_site. 

Props spacedmonkey, kapilpaul, flixos90.
Fixes #57571.
Built from https://develop.svn.wordpress.org/trunk@55515


git-svn-id: http://core.svn.wordpress.org/trunk@55047 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-03-10 15:49:18 +00:00
Sergey Biryukov
9c5d4ca8d1 I18N: Mark screen reader strings as such with translator comments.
This aims to provide better context for translators and make it easier to determine that some strings contain hidden accessibility text and are not displayed in the UI.

Props kebbet, mercime, pavelevap, ocean90, swissspidy, Chouby, jipmoors, afercia, desrosj, costdev, audrasjb, SergeyBiryukov.
Fixes #29748.
Built from https://develop.svn.wordpress.org/trunk@55276


git-svn-id: http://core.svn.wordpress.org/trunk@54809 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-07 17:10:21 +00:00
audrasjb
28358ab213 HTTP API: Fix request header inconsistencies.
This changeset improves the consistency in capitalization of fetching and outputting of request headers. It also updates occurrences found in some docblocks.

Props johnjamesjacoby, costdev, audrasjb, petitphp, mhkuu, SergeyBiryukov.
Fixes #54225.

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


git-svn-id: http://core.svn.wordpress.org/trunk@54743 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-02-03 13:35:20 +00:00
audrasjb
0f28fc7aed Login and Registration: Disable spellcheck for password fields.
This changeset adds `spellcheck="false"` attribute to various password fields.

The spellcheck global attribute defines whether the element may be checked for spelling errors. The `false` value indicates that the element should not be checked for spelling errors, which is relevant for a password field.

Furthermore, and as per MDN specs, using spellchecking can have consequences for users' security and privacy. The specification does not regulate how spellchecking is done and the content of the element may be sent to a third party for spellchecking results. Thus, it is recommended to set `spellcheck` attribute to `false` for elements that can contain sensitive information. Which is the case for password fields.

Props dziudek, audrasjb, gainesm, fosuahmed.
Fixes #56763.

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


git-svn-id: http://core.svn.wordpress.org/trunk@54627 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-01-19 08:53:13 +00:00
audrasjb
6e88e39baa Docs: Align spelling with American English.
This changeset updates the use of "-ise" suffix to American English "-ize" in various files.

Follow-up to [54663], [54664], [55043], [55044].

Props kebbet, mukesh27.
See #56811, #56792.

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


git-svn-id: http://core.svn.wordpress.org/trunk@54584 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-01-11 13:59:13 +00:00
Sergey Biryukov
19382aa5e4 Code Modernization: Rename parameters that use reserved keywords in wp-includes/general-template.php.
While using reserved PHP keywords as parameter name labels is allowed, in the context of function calls using named parameters in PHP 8.0+, this will easily lead to confusion. To avoid that, it is recommended not to use reserved keywords as function parameter names.

This commit:
* Renames the `$echo` parameter to `$display` in:
 * `wp_loginout()`
 * `wp_register()`
 * `get_calendar()`
 * `the_date()`
 * `the_modified_date()`
 * `checked()`
 * `selected()`
 * `disabled()`
 * `wp_readonly()`
 * `__checked_selected_helper()`
* Renames the `$readonly` parameter to `$readonly_value` in `wp_readonly()`.

Follow-up to [52946], [52996], [52997], [52998], [53003], [53014], [53029], [53039], [53116], [53117], [53137], [53174], [53184], [53185], [53192], [53193], [53198], [53203], [53207], [53215], [53216], [53220], [53230], [53232], [53236], [53239], [53240], [53242], [53243], [53245], [53246], [53257], [53269], [53270], [53271], [53272], [53273], [53274], [53275], [53276], [53277], [53281], [53283], [53284], [53285], [53287], [53364], [53365], [54927], [54929], [54930], [54931].

Props jrf, aristath, poena, justinahinon, SergeyBiryukov.
See #56788.
Built from https://develop.svn.wordpress.org/trunk@54932


git-svn-id: http://core.svn.wordpress.org/trunk@54484 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-12-04 13:22:12 +00:00
audrasjb
753fff78e3 Docs: Improve various globals documentation, as per documentation standards.
Props upadalavipul.
See #57069, #56792.

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


git-svn-id: http://core.svn.wordpress.org/trunk@54420 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-11-23 21:36:12 +00:00
John Blackbourn
f9db66d504 Docs: Various improvements to inline docblocks.
See #55646

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


git-svn-id: http://core.svn.wordpress.org/trunk@54029 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-10-11 09:02:14 +00:00
audrasjb
a9e5a09bcc Docs: Fix prev_text and next_text parameters type in paginate_links().
Props gabri3lmarques, maximemeganck.
Fixes #56622.
See #55646.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53845 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-22 09:26:15 +00:00
John Blackbourn
c117e5ae74 Docs: Various improvements and corrections to inline docs.
See #55646

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


git-svn-id: http://core.svn.wordpress.org/trunk@53826 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-20 20:32:09 +00:00
Sergey Biryukov
d34882e9e6 Docs: Correct the wording in wp_lostpassword_url() description.
This affects:
* The `wp_lostpassword_url()` function.
* The `lost_password_html_link` filter.

The filter description was copied from the function, which appears to be not quite accurate, as the lost password can only be reset, not retrieved.

Follow-up to [11448], [54206].

See #55646.
Built from https://develop.svn.wordpress.org/trunk@54224


git-svn-id: http://core.svn.wordpress.org/trunk@53783 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-19 22:26:10 +00:00
Sergey Biryukov
2c79eaf031 Feeds: Add a set of fine-grained filters to disable the different types of feed links separately.
The previously available set of filters in the `feed_links()` function to enable or disable display of various feed links was quite limited:
* `feed_links_show_posts_feed` to control the main feed
* `feed_links_show_comments_feed` to control both the global comments feed and the comment feed for singular posts.

In order to disable the other feeds (post type archive, category, tag, custom taxonomy, author archive, search results), one would have to unhook `feed_links_extra()` from `wp_head`, but that would completely remove all of those feeds, as well as the single post comments feed.

To allow for more flexibility, this commit introduces a full set of filters in the `feed_links_extra()` function to control each one of the feeds independently, including a way to enable/disable the single post comments feed when the global comments feed is disabled/enabled:

* `feed_links_extra_show_post_comments_feed`
* `feed_links_extra_show_post_type_archive_feed`
* `feed_links_extra_show_category_feed`
* `feed_links_extra_show_tag_feed`
* `feed_links_extra_show_tax_feed`
* `feed_links_extra_show_author_feed`
* `feed_links_extra_show_search_feed`

All of them default to `true`, except for `feed_links_extra_show_post_comments_feed` which defaults to the result of `feed_links_show_comments_feed` to ensure backward compatibility.

Follow-up to [33838], [33839], [53125].

Props lopo, mukesh27, audrasjb, SergeyBiryukov.
Fixes #55904.
Built from https://develop.svn.wordpress.org/trunk@54161


git-svn-id: http://core.svn.wordpress.org/trunk@53720 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-14 17:14:10 +00:00
audrasjb
43b406a5ee Comments: Make wp_required_field_indicator() and wp_required_field_message() output filterable.
This changeset introduces two new hooks:

- `wp_required_field_indicator` allows developers to filter the HTML output of the `wp_required_field_indicator()` function.
- `wp_required_field_message` does the same for the `wp_required_field_message()` function.

The changeset also adds new phpunit tests for these filters.

Follow-up to [53888], [54136].

Props kebbet, audrasjb, sabernhardt, costdev, mukesh27.
Fixes #56389.
See #54394.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53696 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-12 22:31:10 +00:00
audrasjb
6b6302f95e Comments: Remove aria-hidden="true" attribute for visible text in comment template.
This changeset removes `aria-hidden="true"` attribute used for required fields in comments template, for better accessibility. It removes the attribute from both `wp_required_field_indicator()` and `wp_required_field_message()` patterns.

Follow-up to [53888].

Props juliemoynat, audrasjb, joedolson, sabernhardt, afercia, costdev.
Fixes #55717.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53695 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-12 21:52:10 +00:00
audrasjb
183165304f Script Loader: Remove default DNS prefetch entry for s.w.org.
A default DNS prefetch entry for s.w.org was previously included to save a few ms in case an emoji is used that is not supported by the browser. It appears this use case doesn't justify a prefetch to s.w.org on every WordPress website.

This changesets removes `emoji_svg_url` prefetch from `wp_resource_hints()`. It also updates unit tests in `Tests_General_wpResourceHints` by removing `test_should_have_defaults_on_frontend()` entirely and removing s.w.org prefetch from expected output of ten other test functions.

Plugin authors can use the `wp_resource_hints` filter if they need to re-add the DNS prefetch entry for s.w.org.

Follow-up to [37920], [38122].

Props joelhardi, superpoincare, jhabdas, garrett-eclipse, sabernhardt, SergeyBiryukov.
Fixes #40426.
See #37387.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53463 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-18 08:45:12 +00:00
audrasjb
e7d91b8017 General: Add required fields helper functions for better reusability.
This changeset introduces new `wp_required_field_indicator()` and `wp_required_field_message()` helper functions to generate reusable and consistent required field indicator and message. It also implements these functions in various admin screens.

Props sabernhardt, ryokuhi, joedolson, audrasjb, SergeyBiryukov.
Fixes #54394.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53447 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-12 12:11:09 +00:00
Adam Silverstein
2c7cae5cd9 Script loader: enable resource preloading with rel='preload'.
Add a `wp_preload_resources` filter that developers can use to add resource preloading.

Preloading helps the browser discover and prioritize important resources earlier during the page load. This ensures that they are available earlier and are less likely to block the page's render.

Props nico23, swissspidy, igrigorik, westonruter, azaozz, furi3r, aristath, spacedmonkey, peterwilsoncc, mihai2u, gziolo. 
Fixes #42438.


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


git-svn-id: http://core.svn.wordpress.org/trunk@53405 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-05 18:26:08 +00:00
audrasjb
63d113e62c Docs: Use third-person singular verbs for function descriptions in general-template.php, as per docblocks standards.
See #55646.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53299 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-20 20:37:07 +00:00
Sergey Biryukov
1069ac4afd Posts, Post Types: Standardize on $post parameter name where appropriate.
This renames the `$post_id` or `$id` parameters to `$post` for functions that accept a post ID or post object:

* `get_sample_permalink()`
* `get_sample_permalink_html()`
* `wp_check_post_lock()`
* `wp_set_post_lock()`
* `get_the_tags()`
* `comment_class()`
* `get_comment_class()`
* `get_comments_link()`
* `get_comments_number()`
* `comments_number()`
* `get_comments_number_text()`
* `comments_open()`
* `pings_open()`
* `comment_form()`
* `do_trackbacks()`
* `pingback()`
* `post_permalink()`
* `get_post_permalink()`
* `get_edit_post_link()`
* `edit_post_link()`
* `get_delete_post_link()`
* `post_class()`
* `get_post_class()`
* `the_attachment_link()`
* `wp_get_attachment_link()`
* `wp_list_post_revisions()`
* `check_and_publish_future_post()`
* `add_ping()`
* `get_pung()`
* `get_to_ping()`
* `wp_get_post_revisions()`
* `wp_get_post_revisions_url()`

Additionally, `$revision_id` is renamed to `$revision` in:

* `wp_restore_post_revision()`
* `wp_delete_post_revision()`

Includes minor documentation improvements for consistency and code layout fixes for better readability.

Follow-up to [1599], [1794], [2881], [3303], [3851], [5302], [6633], [6716], [6985], [7103], [7149], [7747], [8011], [8638], [8643], [8695], [9138], [9273], [11425], [11922], [11956], [12284], [12810], [12923], [13023], [13171], [25567], [27156], [27473], [28558], [28602], [33659], [38852], [47276], [47366], [48622], [49544], [49597], [52095].

See #56243, #55647.
Built from https://develop.svn.wordpress.org/trunk@53715


git-svn-id: http://core.svn.wordpress.org/trunk@53274 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-18 17:37:17 +00:00
Sergey Biryukov
cd6e4451f1 Docs: Document that allowed_tags() is no longer used in core as of WordPress 4.4.
Previously, it was used in core and older bundled themes to display the list of allowed tags in the comment form.

Follow-up to [709], [2009], [2012], [2032], [2040], [13030], [14365], [32858], [34316], [34351].

See #55646.
Built from https://develop.svn.wordpress.org/trunk@53703


git-svn-id: http://core.svn.wordpress.org/trunk@53262 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-15 14:15:08 +00:00
Sergey Biryukov
a29a0e05d1 Docs: Correct method reference format in some DocBlocks.
This ensures that the methods are recognized by the WordPress Code Reference parser.

Follow-up to [7994], [25567], [27156], [28887], [49672], [52226].

Props dd32, audrasjb.
Fixes #55928.
Built from https://develop.svn.wordpress.org/trunk@53469


git-svn-id: http://core.svn.wordpress.org/trunk@53058 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-06 10:51:12 +00:00
Sergey Biryukov
01d172b581 General: Replace all esc_url_raw() calls in core with sanitize_url().
This aims to improve performance by calling `sanitize_url()` directly, instead of the `esc_url_raw()` wrapper. As of WordPress 6.1, `sanitize_url()` is the recommended function for sanitizing a URL for database or redirect usage.

Follow-up to [11383], [13096], [51597], [53452].

Props benjgrolleau, peterwilsoncc, SergeyBiryukov.
Fixes #55852.
Built from https://develop.svn.wordpress.org/trunk@53455


git-svn-id: http://core.svn.wordpress.org/trunk@53044 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-01 18:14:10 +00:00
John Blackbourn
0d46464f83 Docs: Various docblock corrections.
See #54729

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


git-svn-id: http://core.svn.wordpress.org/trunk@52889 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-04-28 09:49:16 +00:00
Peter Wilson
b90d225de1 Feeds: Remove comment feed HTML headers when empty.
Remove the `link[rel=alternate]` element from the HTML header when the comment feeds are disabled. Previously the HTML element was output with an empty `href` attribute.

The element is removed if `get_post_comments_feed_link()` returns an empty string or the feed is disabled via the `feed_links_show_comments_feed` filter.

Props barryceelen, audrasjb, costdev, rachelbaker, Boniu91.
Fixes #54703.


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


git-svn-id: http://core.svn.wordpress.org/trunk@52714 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-04-11 05:03:03 +00:00
Sergey Biryukov
8e4e8afe5d Docs: Adjust DocBlock formatting for wp_robots_*() and related functions.
This ensures the code blocks are displayed correctly in the WordPress Code Reference.

Follow-up to [19304], [37541], [44021], [49992].

See #54729.
Built from https://develop.svn.wordpress.org/trunk@53087


git-svn-id: http://core.svn.wordpress.org/trunk@52676 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-04-06 15:33:03 +00:00
joedolson
9131d74641 Login and Registration: Add autocomplete attributes.
Set valid autocomplete attributes for registration and login fields for username, email, and current password. Autocomplete values are required in WCAG 2.1 at level AA for login forms.

Props johnjamesjacoby, dhanendran, rianrietveld, joedolson, peterwilsoncc.
Fixes #41136.

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


git-svn-id: http://core.svn.wordpress.org/trunk@52630 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-03-31 17:13:01 +00:00
John Blackbourn
0a1310b60d Docs: Correct the documented return types for date and time related functions and filters.
See #54729

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


git-svn-id: http://core.svn.wordpress.org/trunk@52589 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-03-28 10:25:01 +00:00
hellofromTonya
673ab8a677 Administration: Add "File" to Theme/Plugin Editor menu names and relocate "Plugin File Editor" to Tools for block themes.
[52232] relocated the Theme Editor menu item from Appearance to Tools for block themes. This commit relocates the Plugin  Editor menu item from Plugins to Tools for block themes for a consistent workflow.

Both the Theme Editor and Plugin Editor menu items are renamed to "Theme File Editor" and "Plugin File Editor" respectively. Why? To better identify their purpose, i.e. to directly edit the code in the theme or plugin files. The rename is not limited to only block themes. 

Follow-up to [52232].

Props poena, annezazu, audrasjb, clorith, courane01, costdev, dryanpress, desrosj, hellofromTonya, ipstenu, jameskoster, joen, johnbillion, joyously, manfcarlo, marybaum, pbiron, SergeyBiryukov, walbo, youknowriad.
Fixes #54382.
Built from https://develop.svn.wordpress.org/trunk@52406


git-svn-id: http://core.svn.wordpress.org/trunk@51998 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-21 20:06:02 +00:00
hellofromTonya
2ae0e77e47 Template: Fix "undefined index: 00" when archive month query is empty in wp_title().
When `m` query_tag has a valid year, i.e. `?m=2021`, and there are posts for that year, `substr()` returns a `false` on PHP 5.6 and an empty string on PHP 7.0+. Passing either of those values to `$wp_locale->get_month()` results in a PHP notice on PHP 5.6 to PHP 7.4 and a PHP Warning on PHP 8.0+.

Why? The `$month` lookup table has zeroized keys from '01' to '12'. A empty value is passed to `zeroise()` returns `'00'` which is directly passed as a key in the month property. That key does not exist.

While `$wp_locale->get_month()` would benefit from guarding/validation, this fix ensures a falsey value is not passed as a month.

Tests are added including a test that fails with this fix not applied.

Follow-up to [801], [35294], [35624].

Props antpb, audrasjb, costdev, davidmosterd, drewapicture, herregroen, hellofromTonya, michelwppi, sergeybiryukov.
Fixes #31521.
Built from https://develop.svn.wordpress.org/trunk@52136


git-svn-id: http://core.svn.wordpress.org/trunk@51728 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-11-11 16:29:00 +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
Sergey Biryukov
4152fbfdb2 Coding Standards: Improve escaping in wp_login_form().
* Split long concatenated lines using `sprintf()`. This aims to improve readability and avoid multiple `esc_attr()` calls for the same value.
* Escape the form `name` and `id` attributes.

Follow-up to [12696], [18444], [19033].

Props sabbirshouvo, mukesh27, audrasjb, henry.wright, SergeyBiryukov.
Fixes #54279.
Built from https://develop.svn.wordpress.org/trunk@51926


git-svn-id: http://core.svn.wordpress.org/trunk@51519 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-10-21 18:19:00 +00:00
Andrew Ozz
0fcde6de17 Editor: Revert [51748] and [51649]. They intorduced a bug where wp.editor may be replaced with wp.oldEditor in certain cases.
Props desrosj, davidbinda, azaozz.
Fixes #53762.
Built from https://develop.svn.wordpress.org/trunk@51768


git-svn-id: http://core.svn.wordpress.org/trunk@51375 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-09-08 23:29:58 +00:00
Andrew Ozz
774c8047c5 Editor: Replace the remaining references to wp.editor with wp.oldEditor.
Props zieladam.
Fixes #53762.
Built from https://develop.svn.wordpress.org/trunk@51649


git-svn-id: http://core.svn.wordpress.org/trunk@51255 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-21 00:20:00 +00:00
Sergey Biryukov
5202ae3852 Docs: Improve documentation for a few functions per the documentation standards.
This affects:
* `checked()`
* `selected()`
* `disabled()`
* `wp_readonly()`
* `readonly()`
* `__checked_selected_helper()`

Follow-up to [143], [560], [9053], [10662], [13658], [41728], [51586].

See #53399.
Built from https://develop.svn.wordpress.org/trunk@51592


git-svn-id: http://core.svn.wordpress.org/trunk@51203 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-10 13:45:57 +00:00
Sergey Biryukov
52da9fb6af Code Modernization: Rename the readonly() function to wp_readonly().
Since PHP 8.1, `readonly` is a reserved keyword and cannot be used as a function name.

In order to avoid PHP parser errors, the `readonly()` function was extracted to a separate file and is now only included conditionally on PHP < 8.1.

This commit also:
* Moves the tests for the `__checked_selected_helper()` function and all the related functions to their own file.
* Switches to named data providers. This makes the output when using the `--testdox` option more descriptive and is helpful when trying to debug which data set from a data provider failed the test.
* Improves the tests in question to make them feature-complete and expand test coverage.

Props jrf, ayeshrajans, haosun, knutsp, swissspidy, SergeyBiryukov.
Fixes #53858.
Built from https://develop.svn.wordpress.org/trunk@51586


git-svn-id: http://core.svn.wordpress.org/trunk@51197 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-08-09 17:21:00 +00:00
John Blackbourn
79685db062 Docs: Corrections and improvements to types used in docblocks for symbols, properties, and filters.
See #53399

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


git-svn-id: http://core.svn.wordpress.org/trunk@50907 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-01 21:02:57 +00:00
Sergey Biryukov
d2ef664134 Docs: Improve documentation for the wp_resource_hints filter.
Clarify that as of WordPress 4.7, the `$urls` parameter can accept arrays of specific HTML attributes as its child elements, in addition to URLs.

Follow-up to [37920], [38826].

Props vanyukov, Rahmohn, desrosj, peterwilsoncc, SergeyBiryukov.
Fixes #52842.
Built from https://develop.svn.wordpress.org/trunk@51048


git-svn-id: http://core.svn.wordpress.org/trunk@50657 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-05-31 15:39:59 +00:00