Commit Graph

249 Commits

Author SHA1 Message Date
hellofromTonya 2128238311 Bootstrap/Load: Check `$_SERVER['SCRIPT_NAME']` exists before passing to `strpos()` in `wp_fix_server_vars()`.
If `SCRIPT_NAME'` does not exist (which can happen in cron jobs), the following happens:

* PHP 8.1+:
    * `Warning: Undefined array key "SCRIPT_NAME"`
    * `Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated` 
* PHP 8.0: `Warning: Undefined array key "SCRIPT_NAME"`
* PHP 5.6-7.4: No warning or notice

This commit checks if the key exists before passing it to `strpos()`. This resolves the warning, notice, and future error.

Follow-up to [3034], [3069], [12732].

Props audrasjb, costdev, hellofromTonya, karpstrucking, mcjambi, sergeybiryukov.
Fixes #54142.
Built from https://develop.svn.wordpress.org/trunk@52144


git-svn-id: http://core.svn.wordpress.org/trunk@51736 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-11-12 01:10:01 +00:00
davidbaumwald d5f7417686 Bootstrap/Load: Add `HTTP/3` as a valid HTTP protocol.
As of November 2021, the `HTTP/3` protocol is still officially an Internet Draft, but is already supported by 74% of running web browsers and, according to W3Techs, 23% of the top 10 million websites. It has been supported by Google Chrome (including Chrome for Android, and Microsoft Edge, which is based on it) since April 2020 and by Mozilla Firefox since May 2021. Safari 14 (on macOS Big Sur and iOS 14) has also implemented the protocol but support is hidden behind a feature flag.

Based on the wide support, this change adds `HTTP/3` as a valid HTTP protocol.

Props malthert.
Fixes #54404.
Built from https://develop.svn.wordpress.org/trunk@52087


git-svn-id: http://core.svn.wordpress.org/trunk@51679 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-11-09 23:07:01 +00:00
iandunn 8b025acd61 Multisite: Log error/warnings/notices from `ms-files.php`.
Previously errors were not displayed or logged, but the original intention was only to prevent them from being displayed. Hiding them from logs makes problems like #53492 much harder to debug.

This makes the handling of errors in `ms-files` consistent with the REST API, `admin-ajax`, and XML-RPC.

Props iandunn, johnjamesjacoby.
Fixes #53493.

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


git-svn-id: http://core.svn.wordpress.org/trunk@50967 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-07-06 20:21:57 +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
desrosj fccc020d29 Docs: Various docblock corrections for code added in 5.8.
Props johnbillion.
See #53461.
Built from https://develop.svn.wordpress.org/trunk@51221


git-svn-id: http://core.svn.wordpress.org/trunk@50830 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-06-23 19:05:57 +00:00
Aaron Jorbin f3dc033350 Boostrap/Load: Add filter to allow disabling of object cache
In [37626] a filter was added to allow disabling the advanced cache dropin, but no similar filter was added for the object cache dropin. This corrects that oversight.

Fixes #53322.

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


git-svn-id: http://core.svn.wordpress.org/trunk@50696 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-06-08 01:45:57 +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
Aaron Jorbin 926cd0afee Bootstrap/Load: Add Function for reliable timing data
Adds timer_float which can be used to get the time elapsed so far during the PHP script. Should make it easier to display the page generation time in the footer of admin.

WordPress should expose timing data as a float in the most accurate manner possible. timer_stop() has two problems: it uses an initial timestamp generated later than it needs to be and its formatted return value can not reliably be used as a number (some locales swap commas and periods, for example).

Props andy, matt, jorbin.
Fixes #39163.


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


git-svn-id: http://core.svn.wordpress.org/trunk@50395 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-04-23 19:49:05 +00:00
Sergey Biryukov ddca2ed164 Docs: Document the usage of `$pagenow` global in a few functions.
See #51800.
Built from https://develop.svn.wordpress.org/trunk@50407


git-svn-id: http://core.svn.wordpress.org/trunk@50018 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-02-22 19:18:12 +00:00
John Blackbourn 391fc25eed Docs: Various docblock corrections and improvements.
See #51800

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


git-svn-id: http://core.svn.wordpress.org/trunk@50006 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-02-20 17:10:11 +00:00
Sergey Biryukov 7f7c0914af Docs: Update documentation for `wp_is_site_protected_by_basic_auth()` per the documentation standards.
Follow-up to [49752], [50006].

See #52066.
Built from https://develop.svn.wordpress.org/trunk@50053


git-svn-id: http://core.svn.wordpress.org/trunk@49754 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-01-28 11:05:58 +00:00
TimothyBlynJacobs 6a8a83ea09 App Passwords: Extract Basic Auth check into a reusable filterable function.
In [49752] a check was added to prevent creating new Application Passwords if Basic Auth credentials were detected to prevent conflicts. This check takes place in WP-Admin, though a conflict would only arise if Basic Auth was used on the website's front-end.

This commit extracts the Basic Auth check into a reusable function, `wp_is_site_protected_by_basic_auth()`, which can be adjusted using a filter of the same name. This way, a site that uses Basic Auth to protect WP-Admin can still use the Application Passwords feature.

In the future, instead of requiring the use of a filter, WordPress could make a loopback request and check for a `WWW-Authenticate` header to make this detection more robust out of the box.

Props SeBsZ, archon810, aaroncampbell, ocean90, SergeyBiryukov, TimothyBlynJacobs.
Fixes #52066.

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


git-svn-id: http://core.svn.wordpress.org/trunk@49707 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-01-24 02:57:59 +00:00
Sergey Biryukov dfc3eeff10 General: Rename the `wp_error_checked` action to `is_wp_error_instance` for clarity.
Follow-up to [49022], [49023].

Props johnbillion, helen, johnjamesjacoby, Mte90, alexstandiford, hellofromTonya, jnylen0, SergeyBiryukov.
Fixes #40568.
Built from https://develop.svn.wordpress.org/trunk@49635


git-svn-id: http://core.svn.wordpress.org/trunk@49373 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-11-17 19:21:05 +00:00
TimothyBlynJacobs 5df8bf60aa REST API: Support a broader range of JSON media types.
Previously, we only supported `application/json` which prevented using subtypes like `application/activity+json`. This allows for the REST API to `json_decode` the body of requests using a JSON subtype `Content-Type`. Additionally, `wp_die()` now properly sends the error as JSON when a JSON subtype is specified in the `Accept` header.

Props pfefferle.
Fixes #49404.

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


git-svn-id: http://core.svn.wordpress.org/trunk@49090 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-10-27 16:44:06 +00:00
Sergey Biryukov 82e4f7ed8f Bootstrap/Load: Don't assume `WP_CONTENT_DIR` is defined.
When the `mysql` extention isn't loaded and a custom db dropin is not in place, we give folks a nice error. However, we can't assume that the `WP_CONTENT_DIR` constant is set yet since this runs before we define default constants.

This fixes a PHP 8 error.

Props jorbin.
Merges [49161] to trunk.
See #50913.
Built from https://develop.svn.wordpress.org/trunk@49163


git-svn-id: http://core.svn.wordpress.org/trunk@48925 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-10-15 21:16:10 +00:00
TimothyBlynJacobs d5ebe12f11 REST API: Introduce Application Passwords for API authentication.
In WordPress 4.4 the REST API was first introduced. A few releases later in WordPress 4.7, the Content API endpoints were added, paving the way for Gutenberg and countless in-site experiences. In the intervening years, numerous plugins have built on top of the REST API. Many developers shared a common frustration, the lack of external authentication to the REST API.

This commit introduces Application Passwords to allow users to connect to external applications to their WordPress website. Users can generate individual passwords for each application, allowing for easy revocation and activity monitoring. An authorization flow is introduced to make the connection flow simple for users and application developers.

Application Passwords uses Basic Authentication, and by default is only available over an SSL connection.

Props georgestephanis, kasparsd, timothyblynjacobs, afercia, akkspro, andraganescu, arippberger, aristath, austyfrosty, ayesh, batmoo, bradyvercher, brianhenryie, helen, ipstenu, jeffmatson, jeffpaul, joostdevalk, joshlevinson, kadamwhite, kjbenk, koke, michael-arestad, Otto42, pekz0r, salzano, spacedmonkey, valendesigns.
Fixes #42790.

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


git-svn-id: http://core.svn.wordpress.org/trunk@48871 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-10-08 22:14:06 +00:00
Sergey Biryukov 6e5ca746e1 General: Give the `$is` variable in `is_wp_error()` a more descriptive name.
Follow-up to [49022].

See #40568.
Built from https://develop.svn.wordpress.org/trunk@49023


git-svn-id: http://core.svn.wordpress.org/trunk@48785 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-21 11:13:05 +00:00
John Blackbourn 964d0784be General: Introduce the `wp_error_added` and `wp_error_checked` actions.
These actions allow debugging tools to track `WP_Error` instances as they're created and subsequently passed between functions which check for error objects.

Props Shelob9, Mte90, TimothyBlynJacobs, johnbillion

Fixes #40568


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


git-svn-id: http://core.svn.wordpress.org/trunk@48784 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-20 17:44:07 +00:00
John Blackbourn d0a32c5111 Docs: Various docblock corrections and improvements.
See #50768
Built from https://develop.svn.wordpress.org/trunk@48941


git-svn-id: http://core.svn.wordpress.org/trunk@48703 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-09-04 20:41:07 +00:00
Sergey Biryukov c19f5ae907 Bootstrap/Load: Check if the `__()` function is available in `wp_get_environment_type()`.
The function would not exist in `SHORTINIT` mode.

Follow-up to [48894].

See #50992.
Built from https://develop.svn.wordpress.org/trunk@48895


git-svn-id: http://core.svn.wordpress.org/trunk@48657 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-08-27 21:39:05 +00:00
Sergey Biryukov da19724be9 Bootstrap/Load: Remove the ability to alter the list of environment types in `wp_get_environment_type()`.
The intention of `wp_get_environment_type()` is to provide a consistent means of identifying the environment type, not of identifying a specific environment.

Actual environments should fit within one of the existing types: `local`, `development`, `staging`, or `production`. That should cover the types that plugins and themes might be concerned about when toggling functionality. 

Props johnbillion, joostdevalk, TimothyBlynJacobs, jeremyfelt, batmoo, claytoncollie, Clorith, markjaquith, garrett-eclipse, GaryJ, elrae.
Fixes #50992.
Built from https://develop.svn.wordpress.org/trunk@48894


git-svn-id: http://core.svn.wordpress.org/trunk@48656 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-08-27 21:32:08 +00:00
Sergey Biryukov 8169ae35a0 Bootstrap/Load: Add `local` environment type to `wp_get_environment_type()`.
This gives developers a better control over their existing development workflow and ensures that `local` is not the exact same as `development` if it does not need to be.

Props claytoncollie, johnbillion, jeremyfelt, kreppar, dushakov, TimothyBlynJacobs, Ipstenu, khag7, knutsp, Clorith, markjaquith, joostdevalk, SergeyBiryukov.
Fixes #51064.
Built from https://develop.svn.wordpress.org/trunk@48856


git-svn-id: http://core.svn.wordpress.org/trunk@48618 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-08-24 22:32:05 +00:00
Sergey Biryukov fbebb744b0 Bootstrap/Load: Remove the `wp_environment_type` and `wp_get_environment_type` filters.
Since `wp_get_environment_type()` runs too early for plugins to hook these filters, and the result is then cached in a static variable and cannot be changed later, the filters are not that useful.

The `WP_ENVIRONMENT_TYPES` and `WP_ENVIRONMENT_TYPE` constants and environment variables should be enough for now.

Follow-up to [47919], [48188], [48372].

Props Clorith, SergeyBiryukov.
Fixes #33161.
Built from https://develop.svn.wordpress.org/trunk@48662


git-svn-id: http://core.svn.wordpress.org/trunk@48424 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-07-28 12:10:05 +00:00
Sergey Biryukov 8d7a19cdc2 Bootstrap/Load: Remove special handling for `REQUEST_TIME` and `REQUEST_TIME_FLOAT` server values in `wp_magic_quotes()`.
This was intended as a temporary fix until `add_magic_quotes()` is modified to leave non-string values untouched, which has now been done.

Follow-up to [47370], [48205].

See #48605.
Built from https://develop.svn.wordpress.org/trunk@48206


git-svn-id: http://core.svn.wordpress.org/trunk@47975 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-06-28 21:09:05 +00:00
Sergey Biryukov 5771b7dff9 Bootstrap/Load: Make some adjustments to `wp_get_environment_type()`:
* Rename the `wp_approved_environment_types` filter to `wp_environment_types`.
* Introduce `WP_ENVIRONMENT_TYPES` system variable and constant to complement the filter.
* Correct the argument type for the `wp_environment_types` filter.
* Cache the result in a static variable to ensure consistent return value.
* Rename the `stage` type to `staging`.

Follow-up to [47919].

Props dlh, dd32, TimothyBlynJacobs, johnbillion, pbiron.
See #33161.
Built from https://develop.svn.wordpress.org/trunk@48188


git-svn-id: http://core.svn.wordpress.org/trunk@47957 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-06-27 10:36:06 +00:00
Sergey Biryukov 56342b8e8f Docs: Replace "AJAX" with "Ajax" in DocBlocks and comments, per the spelling glossary.
Props mukesh27, sabernhardt, SergeyBiryukov.
Fixes #50064.
Built from https://develop.svn.wordpress.org/trunk@48168


git-svn-id: http://core.svn.wordpress.org/trunk@47937 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-06-25 12:43:07 +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
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
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
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
desrosj 38352d2c7a Coding Standards: Cleans up some PHPCS issues introduced in [47938].
See #20875.
Built from https://develop.svn.wordpress.org/trunk@47942


git-svn-id: http://core.svn.wordpress.org/trunk@47715 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-06-09 22:42:12 +00:00
whyisjake 3e2b649351 Cache API: Introduce `wp_cache_get_multi()`.
Many caching backend have support for multiple gets in a single request. This brings that support to core, with a compatability fallback that will loop over requests if needed.

Fixes: #20875.
Props: nacin, tollmanz, wonderboymusic, ryan, jeremyfelt, spacedmonkey, boonebgorges, dd32, rmccue, ocean90, jipmoors, johnjamesjacoby, tillkruess, donmhico, davidbaumwald, SergeyBiryukov, whyisjake.


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


git-svn-id: http://core.svn.wordpress.org/trunk@47711 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-06-09 19:47:13 +00:00
Sergey Biryukov b19c1627e5 Bootstrap/Load: Introduce `wp_get_environment_type()` to retrieve the current environment type.
The type can be set via the `WP_ENVIRONMENT_TYPE` global system variable, a constant of the same name, or the `wp_get_environment_type` filter.

Possible values include `development`, `stage`, `production'. If not set, the type defaults to `production`.

Props Clorith, krogsgard, joostdevalk, frank-klein, Maelacuna, nathanrice, grierson, jchristopher, davidvee, jackfungi, johnbillion, tabrisrp, knutsp, ev3rywh3re, Rastaban, danielbachhuber, pfefferle, audrasjb, SergeyBiryukov.
Fixes #33161.
Built from https://develop.svn.wordpress.org/trunk@47919


git-svn-id: http://core.svn.wordpress.org/trunk@47693 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-06-06 11:07:12 +00:00
Sergey Biryukov f7da44c8d2 Upgrade/Install: Rename `wp_in_maintenance_mode()` to `wp_is_maintenance_mode()`, for consistency with `wp_is_recovery_mode()`.
While the former name might be a bit more accurate, the latter matches the existing naming pattern.

Follow-up to [47623].

Fixes #49959.
Built from https://develop.svn.wordpress.org/trunk@47871


git-svn-id: http://core.svn.wordpress.org/trunk@47646 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-05-31 19:54:24 +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 77eb929b52 Upgrade/Install: Introduce `wp_in_maintenance_mode()`, a helper function to check if WordPress is currently in maintenance mode.
Props Clorith.
Fixes #49959.
Built from https://develop.svn.wordpress.org/trunk@47623


git-svn-id: http://core.svn.wordpress.org/trunk@47398 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-04-25 20:19:07 +00:00
desrosj a753e44d4e Bootstrap/Load: Deprecate `wp_unregister_GLOBALS()`.
The `register_globals` directive in PHP was deprecated in version 5.3 and removed entirely in 5.4.

Now that WordPress only supports PHP 5.6.20 and newer, the `wp_unregister_GLOBALS()` function can be deprecated.

Props ayeshrajans, desrosj, SergeyBiryukov.
Fixes #49938.
Built from https://develop.svn.wordpress.org/trunk@47612


git-svn-id: http://core.svn.wordpress.org/trunk@47387 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-04-22 15:42:09 +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
Sergey Biryukov 00f110740b Bootstrap/Load: In `wp_magic_quotes()`, revert the type change to string for `REQUEST_TIME` and `REQUEST_TIME_FLOAT` values, which should retain their proper type.
Among other things, this preserves compatibility of WP with PHPUnit Code Coverage generation.

Props jrf, Veraxus, Rarst.
See #48605.
Built from https://develop.svn.wordpress.org/trunk@47370


git-svn-id: http://core.svn.wordpress.org/trunk@47157 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-02-25 18:33: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 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 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 58aa1cc8c5 Docs: Adjust `wp_is_json_request()` and `wp_is_xml_request()` return value descriptions for consistency.
See #48771, #48303.
Built from https://develop.svn.wordpress.org/trunk@46760


git-svn-id: http://core.svn.wordpress.org/trunk@46560 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-11-22 18:28:04 +00:00
Sergey Biryukov 597b22c99c Docs: Correct spelling and capitalization in `wp-includes/load.php`:
* Fix typo in `is_blog_admin()` description.
* Capitalize PHP correctly in `enable_wp_debug_mode_checks` filter description.
* Capitalize XML correctly in `wp_is_xml_request()` return value description.

Props stevegrunwell.
Fixes #48771.
Built from https://develop.svn.wordpress.org/trunk@46759


git-svn-id: http://core.svn.wordpress.org/trunk@46559 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-11-22 18:16:03 +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 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