Commit Graph

616 Commits

Author SHA1 Message Date
Sergey Biryukov
10ad5f0d4d Docs: Correct the type of the $user_id parameter in wp_set_password action.
Follow-up to [6600], [55056].

See #57436.
Built from https://develop.svn.wordpress.org/trunk@55057


git-svn-id: http://core.svn.wordpress.org/trunk@54590 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-01-12 13:14:15 +00:00
audrasjb
00ed89ffb1 Users: Add an action hook on wp_set_password().
This changeset introduces the `wp_set_password` action hook, triggered after a password is set for a given user. As several plugins are calling `wp_set_password()` directly, adding an action to the end of the function will help plugin authors to catch all instances of password setting.

Props tanner-m, audrasjb.
Fixes #57436.

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


git-svn-id: http://core.svn.wordpress.org/trunk@54589 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-01-12 09:05:15 +00:00
audrasjb
b6760ea0ce Docs: Align spelling with American English.
This changeset updates the use of "-ise" suffix to American English "-ize" and replaces "behaviour" with "behavior" in various docblocks.

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

Props kebbet.
See #56811, #56792.

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


git-svn-id: http://core.svn.wordpress.org/trunk@54577 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-01-10 09:30:13 +00:00
johnjamesjacoby
0f0646eda0 Mail: allow custom attachment filenames in wp_mail().
Previous to this change, attachment filenames in outgoing emails could only ever be derived from their paths (passed in as a numerically indexed array of `$attachments`).

This changeset adds support for passing an associative `$attachments` array, where the key strings will be used as filenames instead.

Includes 2 new unit tests to ensure both array formats continue to work as intended.

Props johnjamesjacoby, ritteshpatel, swissspidy, syntaxart.
Fixes #28407.
Built from https://develop.svn.wordpress.org/trunk@55030


git-svn-id: http://core.svn.wordpress.org/trunk@54563 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-01-05 10:49:16 +00:00
Sergey Biryukov
0d03ee0b7a Code Modernization: Rename parameters that use reserved keywords in wp-includes/pluggable.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 `$die` parameter to `$stop` in `check_ajax_referer()`.
* Renames the `$default` parameter to `$fallback_url` in `wp_validate_redirect()`.
* Renames the `$default` parameter to `$default_value` in `get_avatar()`.

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], [54932], [54933], [54938], [54943], [54944], [54945], [54946], [54947], [54948], [54950], [54951].

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


git-svn-id: http://core.svn.wordpress.org/trunk@54504 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-12-09 00:24:17 +00:00
Sergey Biryukov
5f30490527 Coding Standards: Remove a one-time $loading variable in get_avatar().
This aims to bring consistency between two similar code fragments.

Follow-up to [47554], [53480], [54895].

See #56791.
Built from https://develop.svn.wordpress.org/trunk@54920


git-svn-id: http://core.svn.wordpress.org/trunk@54472 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-12-01 15:43:20 +00:00
Sergey Biryukov
1750d30863 Coding Standards: Always use strict type check for in_array().
This fixes the currently flagged `WordPress.PHP.StrictInArray.MissingTrueStrict` issues:
* `Not using strict comparison for in_array; supply true for third argument.`

These all do comparisons with strings, so all the more reason why it is imperative that a strict comparison is used.

Follow-up to [47550], [47557], [54155], [53480].

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


git-svn-id: http://core.svn.wordpress.org/trunk@54447 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-11-29 21:00:14 +00:00
Sergey Biryukov
3ba44120d0 Coding Standards: Always use parentheses when instantiating an object.
Note: This will be enforced by WPCS 3.0.0.

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


git-svn-id: http://core.svn.wordpress.org/trunk@54443 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-11-29 15:51:14 +00:00
audrasjb
65cdec186b Docs: Align spelling with American English.
This changeset replaces "cancelled" with "canceled" in various docblocks, per the [https://make.wordpress.org/core/handbook/best-practices/spelling/ Spelling Guidelines].

Props costdev.
See #56811, #56792.

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


git-svn-id: http://core.svn.wordpress.org/trunk@54216 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-10-21 21:51:14 +00:00
audrasjb
1b46797366 Mail: Reset PHPMailer properties between use.
Props xknown, martinkrcho, tykoted.

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


git-svn-id: http://core.svn.wordpress.org/trunk@54084 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-10-17 11:42:11 +00:00
Peter Wilson
b879d04354 Users: Revert use of shared objects for current user.
Reverts [50790].

Props oztaser, ravipatel, dd32, costdev, SergeyBiryukov, tykoted, cu121, xknown.
Fixes #54984.


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


git-svn-id: http://core.svn.wordpress.org/trunk@53956 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-10-06 04:38:14 +00:00
John Blackbourn
f7dc68f99a Docs: Updates and corrections to various inline docs added in 6.1.
See #55646

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


git-svn-id: http://core.svn.wordpress.org/trunk@53843 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-21 20:24:12 +00:00
audrasjb
06cb9d7691 Security: Salting functions: translate the phrase "put your unique phrase here".
In `wp_salt()` WordPress pre-populates the check for duplicate salt values with the default put your unique phrase here. As the `wp-config.php file` for non-en_US can be translated in downloaded packages, a translated version of this phrase ought to be in the pre-populated duplicate values array too.

Props peterwilsoncc, SergeyBiryukov, whaze, costdev, audrasjb.
Fixes #55937.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53808 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-20 11:57:20 +00:00
audrasjb
4bb6301eb9 General: Pass $action to nonce_life filter.
This changeset contextualizes the usage of `nonce_life` filter by passing the `$action` parameter. It allows to alterate the default lifespan of nonces on a case by case basis.

Props giuseppemazzapica, dwainm, DrewAPicture, jorbin, audrasjb, SergeyBiryukov, costdev, antonvlasenko.
Fixes #35188.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53777 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-19 21:36:10 +00:00
audrasjb
cad5069194 Docs: Update wp_rand docblock to clarify that it returns a non-negative number.
Props hakre, westi, jeremyfelt, neychok, sabernhardt, audrasjb.
Fixes #15089.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53749 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-16 22:39:11 +00:00
desrosj
fa9c62915f Mail: Prevent the last character of names in “From” headers from being trimmed.
When extracting the email and name from a “From” header, the last character of the name is incorrectly trimmed when a space is not included between the name and the opening `<`.

Though the space is required for the header to be compliant with RFC5322 (see https://www.rfc-editor.org/rfc/rfc5322#section-3.4), the absence of a space can be ignored here. PHPMailer accepts the name and email as separate parameters and constructs the header correctly later on.

Props hakanca, mikehansenme, SergeyBiryukov, kovshenin, mattyrob, drewapicture, desrosj.
Fixes #19847.
Built from https://develop.svn.wordpress.org/trunk@53900


git-svn-id: http://core.svn.wordpress.org/trunk@53459 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-16 18:18:14 +00:00
John Blackbourn
79db573265 Docs: Various corrections and improvements to inline documentation.
See #55646

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


git-svn-id: http://core.svn.wordpress.org/trunk@53386 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-04 14:52:11 +00:00
John Blackbourn
5dc1150ea2 Users: Allow conditional supression of the email notifications that are sent when a new user account is registered.
This introduces the following new filters:

* `wp_send_new_user_notification_to_admin`
* `wp_send_new_user_notification_to_user`

Props janthiel, costdev, audrasjb, peterwilsoncc

Fixes #54874

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


git-svn-id: http://core.svn.wordpress.org/trunk@53257 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-07-12 21:05:16 +00:00
Sergey Biryukov
9e01bd8adc Query: Some documentation and test improvements for update_post_author_caches():
* Make the descriptions for `update_post_author_caches()` and `update_post_caches()` more specific.
* Move the unit test into its own file, for consistency with `update_post_cache()` tests. This also allows for using shared fixtures in case more tests are added in the future.

Follow-up to [53482].

See #55716.
Built from https://develop.svn.wordpress.org/trunk@53483


git-svn-id: http://core.svn.wordpress.org/trunk@53072 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-10 15:17:10 +00:00
spacedmonkey
2237f67458 Prime users cache in WP_Query and post REST API controller.
For a call to `WP_Query` or a post REST API request that contains posts from multiple authors, call the `cache_users` function, to ensure that all user data for post authors is primed in 
a single database query. This results in far fewer database queries on multiple author sites. 

Props spacedmonkey, timothyblynjacobs, peterwilsoncc.
Fixes #55716.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53071 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-10 13:39:11 +00:00
Peter Wilson
b8e44627c8 Media: Add decoding="async" to image attributes.
Dynamically add `decoding="async"` to image tags on the front end of a site to instruct browsers to download them in parallel.

Modifies `wp_get_attachment_image()`, `get_avatar()` to include the attribute by default. Modifies `wp_filter_content_tags()` to add the attribute during the front-end render of the site.

Introduces `wp_img_tag_add_decoding_attr()` to take an image tag and modify it to include the attribute. Introduces the filter `wp_img_tag_add_decoding_attr` used to define the default value for the attribute.

Props adamsilverstein, ayeshrajans, costdev, flixos90, hellofromtonya, isaumya, michaelbourne, mihai2u, mitogh, sergiomdgomes, spacedmonkey, westonruter, peterwilsoncc.
Fixes #53232.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53069 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-09 05:31:12 +00:00
audrasjb
56d7437f59 General: Ensure wp_rand() returns 0 when $min and $max values are equal to 0.
This changeset ensures `wp_rand()` returns zero instead of a random number when both `$min` and `$max` values are equal to zero.

Fixes #55194.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53062 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-06 22:50:10 +00:00
audrasjb
0ab9c4ee4b Docs: Various fixes in wp-includes/pluggable.php docblocks, as per documentation standards.
See #55646.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53061 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-06 22:35:10 +00:00
audrasjb
bbe60d66c3 Text Changes: Improve consistency of admin error notices.
This changeset replaces `<strong>Error</strong>:` with `<strong>Error:</strong>`, for better consistency.

Props transl8or, mihaidumitrascu, audrasjb.
Fixes #50785.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53047 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-06-02 15:05:13 +00:00
John Blackbourn
13ed66ec88 Mail: Improve the docblocks for actions and functions related to the parsing of authentication cookies.
See #54729

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


git-svn-id: http://core.svn.wordpress.org/trunk@52890 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-04-28 09:54:16 +00:00
John Blackbourn
6aa053dc01 Docs: Various docblock improvements.
See #54729

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


git-svn-id: http://core.svn.wordpress.org/trunk@52888 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-04-28 09:46:21 +00:00
Sergey Biryukov
c2d8b48d97 Code Modernization: Check the return type of wp_parse_url() in wp_mail().
As per the PHP manual:
> If the `component` parameter is omitted, an associative array is returned.
> If the `component` parameter is specified, `parse_url()` returns a string (or an int, in the case of `PHP_URL_PORT`) instead of an array. If the requested component doesn't exist within the given URL, `null` will be returned.

Reference: [https://www.php.net/manual/en/function.parse-url.php#refsect1-function.parse-url-returnvalues PHP Manual: parse_url(): Return Values]

In PHP 8.1, if the home URL does not have a "host" component, it would lead to a `substr(): Passing null to parameter #1 ($string) of type string is deprecated` notice.

Changing the logic around and adding validation for the return type value of `wp_parse_url()` prevents that.

Follow-up to [48601], [51606], [51622], [51626], [51629], [51630].

Props dennisatyoast, jrf.
See #54730.
Built from https://develop.svn.wordpress.org/trunk@52799


git-svn-id: http://core.svn.wordpress.org/trunk@52388 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-02-25 13:48:00 +00:00
John Blackbourn
678f2ceb0d Docs: Miscellaneous inline documentation improvements.
See #53399

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


git-svn-id: http://core.svn.wordpress.org/trunk@52014 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-12-29 17:28:00 +00:00
audrasjb
1a02e65df9 Docs: Add missing null allowed type for the $id parameter of wp_set_current_user().
Props andy-schmidt.
See #53399.

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


git-svn-id: http://core.svn.wordpress.org/trunk@51800 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-11-18 16:04:00 +00:00
John Blackbourn
40626108d0 Docs: Corrections relating to types used in inline documentation for comment ID and site ID proprties.
Includes a correction for a typo introduced in [52204].

See #53399

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


git-svn-id: http://core.svn.wordpress.org/trunk@51797 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-11-18 13:57:01 +00:00
davidbaumwald
d6de0e4498 Mail: Add wp_mail_succeeded hook to wp_mail.
Adds a new `wp_mail_succeeded` action in `wp_mail` after the mail is sent.  Also, adds a disclaimer to the hook's docblock, clarifying that the hook's firing doesn't necessarily mean the recipient received the mail, only that the mail was processed without any errors.

Props birgire, donmhico, johnbillion.
Fixes #53826.
Built from https://develop.svn.wordpress.org/trunk@52083


git-svn-id: http://core.svn.wordpress.org/trunk@51675 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-11-09 22:27:59 +00:00
Felix Arntz
780b0399f7 Media: Refine the heuristics to exclude certain images and iframes from being lazy-loaded to improve performance.
This changeset implements the refined lazy-loading behavior outlined in https://make.wordpress.org/core/2021/07/15/refining-wordpress-cores-lazy-loading-implementation/ in order to improve the Largest Contentful Paint metric, which can see a regression from images or iframes above the fold being lazy-loaded. Adjusting this so far has been possible for developers via filters and still is, however this enhancement brings a more accurate behavior out of the box for the majority of themes.

Specifically, this changeset skips the very first "content image or iframe" on the page from being lazy-loaded. "Content image or iframe" denotes any image or iframe that is found within content of any post in the current main query loop as well as any featured image of such a post. This applies both to "singular" as well as "archive" content: On a "singular" page the first image/iframe of the post is not lazy-loaded, while on an "archive" page the first image/iframe of the _first_ post in the query is not lazy-loaded.

This approach refines the lazy-loading behavior correctly for the majority of themes, which use a single-column layout for post content. For themes with multi-column layouts, a new `wp_omit_loading_attr_threshold` filter can be used to change how many of the first images/iframes are being skipped from lazy-loaded (default is `1`). For example, a theme using a three-column grid of latest posts for archives could use the filter to override the threshold to `3` on archive pages, so that the first three content images/iframes would not be lazy-loaded.

Props adamsilverstein, azaozz, flixos90, hellofromtonya, jonoaldersonwp, mte90, rviscomi, tweetythierry, westonruter.
Fixes #53675. See #50425.

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


git-svn-id: http://core.svn.wordpress.org/trunk@51657 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-11-09 00:36:01 +00:00
John Blackbourn
e4cfebe92e Docs: Undo the accidental revert of [51299] made in [51300].
See #53399

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


git-svn-id: http://core.svn.wordpress.org/trunk@50910 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-01 21:29:56 +00:00
John Blackbourn
ea60cd8191 Docs: Descriptive improvements and corrections for various docblocks.
See #53399

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


git-svn-id: http://core.svn.wordpress.org/trunk@50909 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-01 21:12:58 +00:00
John Blackbourn
9146628ae1 Docs: Miscellaneous formatting corrections for docblocks.
See #53399

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


git-svn-id: http://core.svn.wordpress.org/trunk@50908 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-01 21:10:56 +00:00
Sergey Biryukov
1e02e0f049 Docs: Use 3-digit, x.x.x-style semantic versioning for two _doing_it_wrong() calls.
Follow-up to [37985], [38420], [39021].

See #52628.
Built from https://develop.svn.wordpress.org/trunk@50952


git-svn-id: http://core.svn.wordpress.org/trunk@50561 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-05-22 13:09:56 +00:00
Sergey Biryukov
977e81b1a1 Text Changes: Improve the wording of some error messages.
Props dartiss, williampatton, johnbillion, SergeyBiryukov.
Fixes #50382.
Built from https://develop.svn.wordpress.org/trunk@50947


git-svn-id: http://core.svn.wordpress.org/trunk@50556 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-05-21 10:49:57 +00:00
Sergey Biryukov
cbfa060298 Docs: Document the usage of $current_user global in get_user_by().
Follow-up to [50790].

Props paaggeli, mukesh27.
Fixes #53088.
Built from https://develop.svn.wordpress.org/trunk@50792


git-svn-id: http://core.svn.wordpress.org/trunk@50401 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-04-27 17:49:06 +00:00
Peter Wilson
de519f9dfe Users: Share current user instance across functions.
Share the `WP_User` instance for the current user between the functions `get_userdata()` and `wp_get_current_user()`. Both functions return the `$current_user` global for the current user.

Force refresh the `$current_user` global within `clean_user_cache()` by immediately re-calling `wp_set_current_user()` with the current user's ID. This ensures any changes to the current user's permissions or other settings are reflected in the global. As a side-effect this immediately rewarms the current user's cache.

Props chaion07, chriscct7, donmhico, hellofromtonya, lukecarbis, peterwilsoncc, rmccue, TimothyBlynJacobs.
Fixes #28020.

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


git-svn-id: http://core.svn.wordpress.org/trunk@50399 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-04-26 01:03:59 +00:00
Sergey Biryukov
aa3d0715ab Docs: Add a @since note to wp_mail() about using is_email() for validation.
Follow-up to [48645].

See #52628.
Built from https://develop.svn.wordpress.org/trunk@50781


git-svn-id: http://core.svn.wordpress.org/trunk@50390 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-04-21 19:47:01 +00:00
joedolson
35aaaacc04 Revisions: Generate correct number of columns in wp_text_diff.
The function `wp_text_diff` generated an invalid table structure if the $args parameter contained any values. This patch corrects the structure generated by `wp_text_diff` and related usages so that the column count matches the data generated. Additionally, this patch passes arguments to the Revisions screen so that the screen has column headings that reflect the content in each column. Improves the accessibility and usability of the Revisions table.

Props joedolson, mehulkaklotar, afercia, adamsilverstein, zodiac1978, jeremyfelt
Fixes #25473
Built from https://develop.svn.wordpress.org/trunk@50034


git-svn-id: http://core.svn.wordpress.org/trunk@49735 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-01-27 21:53:58 +00:00
John Blackbourn
f0d44a3402 Mail: Introduce a pre_wp_mail filter to allow short-circuiting the wp_mail() function without having to override the pluggable function.
Props DvanKooten, swissspidy, SergeyBiryukov, jtsternberg, ericlewis, Mte90, birgire, ayeshrajans

Fixes #35069

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


git-svn-id: http://core.svn.wordpress.org/trunk@49563 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-12-20 15:09:06 +00:00
John Blackbourn
780cdb5eb5 Docs: Various docblock corrections relating to parameter types.
See #51800

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


git-svn-id: http://core.svn.wordpress.org/trunk@49415 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-11-24 21:22:04 +00:00
Sergey Biryukov
0e3147c40e Coding Standards: Replace alias PHP functions with the canonical names.
Using the canonical function name for PHP functions is strongly recommended, as aliases may be deprecated or removed without (much) warning.

This replaces all uses of the following:
* `join()` with `implode()`
* `sizeof()` with `count()`
* `is_writeable()` with `is_writable()`
* `doubleval()` with a `(float)` cast

In part, this is a follow-up to #47746.

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


git-svn-id: http://core.svn.wordpress.org/trunk@48955 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-10-18 17:27:06 +00:00
Sergey Biryukov
897f004a9c General: Replace older-style PHP type conversion functions with type casts.
This improves performance, readability, and consistency throughout core.

* `intval()` → `(int)`
* `strval()` → `(string)`
* `floatval()` → `(float)`

Props ayeshrajans.
Fixes #42918.
Built from https://develop.svn.wordpress.org/trunk@49108


git-svn-id: http://core.svn.wordpress.org/trunk@48870 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-10-08 21:15:13 +00:00
whyisjake
53c909a825 Mail: PHPMailer swap to use is_email for the default validator.
Prior to the PHPMailer update in 5.5, old version of the PHPMailer was setting the validator to 'auto' resulting in a sophisticated logic for determining what email address validation should be used. But the new version defaults to 'php', possibly leading to rejection of email addresses which were fine prior to the upgrade. Let's use the WordPress core function `is_email()` so that it can be fully pluggable.

Fixes #50720.
Props david.binda, ayeshrajans, Synchro, SergeyBiryukov, whyisjake.

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


git-svn-id: http://core.svn.wordpress.org/trunk@48407 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-07-27 20:19:05 +00:00
whyisjake
d7453598b3 Mail: Ensure that a server hostname can be set by using network_home_url().
Due to the varying server setups, `$_SERVER['SERVER_NAME'];` can't reliably ensure that there will be a relevant host that could be used as the hostname in an email. Since the `network_home_url()` is set at this point, and is filterable, this should better enable emails to be sent from the server.

Fixes #25239.
Props layotte, SergeyBiryukov, nacin, sreedoap, szepe.viktor, jesin, kitchin, mensmaximus, mt8.biz, Grzegorz.Janoszka, cbutlerjr, dd32, BjornW, neodjandre, BjornW, Ipstenu, ocean90, danielbachhuber, desmith, joemcgill, jdgrimes, riasat, derekakelly, swissspidy, lilmike, tsimmons, robert.peake, DavidAnderson, cloudstek, pigdog234, BjornW, rawrly, pessoft, RedSand, seayou, dvershinin, bastho, chesio, Starbuck, afragen, ocean90, whyisjake.

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


git-svn-id: http://core.svn.wordpress.org/trunk@48363 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-07-24 17:40:06 +00:00
John Blackbourn
9bc7d0a776 Docs: Another pass at some inline docs fixes mostly made by PHPCBF.
See #49572, #50744
Built from https://develop.svn.wordpress.org/trunk@48590


git-svn-id: http://core.svn.wordpress.org/trunk@48352 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-07-23 21:11:05 +00:00
desrosj
4b60af1a6a General: Remove “whitelist” and “blacklist” in favor of more clear and inclusive language.
“The WordPress open source community cares about diversity. We strive to maintain a welcoming environment where everyone can feel included.”

With this commit, all occurrences of “whitelist” and “blacklist” (with the single exception of the `$new_whitelist_options` global variable) are removed. A new ticket has been opened to explore renaming the `$new_whitelist_options` variable (#50434).

Changing to more specific names or rewording sentences containing these terms not only makes the code more inclusive, but also helps provide clarity. These terms are often ambiguous. What is being blocked or allowed is not always immediately clear. This can make it more difficult for non-native English speakers to read through the codebase.

Words matter. If one contributor feels more welcome because these terms are removed, this was worth the effort.

Props strangerstudios, jorbin, desrosj, joemcgill, timothyblynjacobs, ocean90, ayeshrajans, davidbaumwald, earnjam.
See #48900, #50434.
Fixes #50413.
Built from https://develop.svn.wordpress.org/trunk@48121


git-svn-id: http://core.svn.wordpress.org/trunk@47890 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-06-22 17:26:13 +00:00
Andrea Fercia
ae447adaf4 I18N: Restore the "Error:" prefix for error messages.
Partially reverts [48059] as there's no full consensus on the removal of the text prefix. Further actions should be taken to improve consistency and accessibility of the admin notices. Keeps some improvements to the translatable strings from [48059].

Fixes #47656.

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


git-svn-id: http://core.svn.wordpress.org/trunk@47884 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-06-21 14:00:09 +00:00