Commit Graph

602 Commits

Author SHA1 Message Date
Sergey Biryukov 665719b9de Docs: Revise comments using “we” in WordPress root directory files.
This updates some inline comments to better match the guidelines and recommendations set forth in the make/core and make/docs handbooks:

> In general, use second person in your documentation. Second person depicts a friendly tone, with a perfect focus on the reader. In addition to this, directly addressing the reader helps avoid passive voice; thereby preventing unwanted confusion.
> ...
> the word “we” should be avoided (...) unless its made very clear which group is speaking.

Includes:
* Replacing first-person usage of "we" with second person point of view.
* Making small clarification adjustments where the voice is much too casual or lacks clear context, especially for non-native English speakers.

References:
* [https://make.wordpress.org/docs/style-guide/language-grammar/grammatical-person/ Style Guide: Grammatical person]
* [https://make.wordpress.org/docs/handbook/documentation-team-handbook/handbooks-style-and-formatting-guide/ Handbooks & HelpHub Style and Formatting Guide]
* [https://make.wordpress.org/core/handbook/best-practices/post-comment-guidelines/#style-and-substance Post & Comment Guidelines: Style and Substance]

Follow-up to [2176], [3430], [4676], [6009], [7991], [12688], [12762], [26008], [28978], [44488], [44962], [51979], [53131], [53132], [53156], [53131], [54200].

Props ironprogrammer, costdev, jorbin, SergeyBiryukov.
See #57052.
Built from https://develop.svn.wordpress.org/trunk@54866


git-svn-id: http://core.svn.wordpress.org/trunk@54418 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-11-23 15:43:13 +00:00
jorgefilipecosta 5e32e7de29 Fix: Revert [54305].
This commit caused an incompatibility with the latest released Gutenberg version.

Props bernhard-reiter.
Built from https://develop.svn.wordpress.org/trunk@54306


git-svn-id: http://core.svn.wordpress.org/trunk@53865 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-26 10:17:11 +00:00
jorgefilipecosta 7882623807 Editor: Fix missing frontend section presets output.
Backports PHP changes in WordPress/gutenberg#42124 to the core. Adds the missing mechanism to output frontend styles of block level presets to the core.

Props mcsf, oandregal, dmsnell, draganescu.
See #56467.
Built from https://develop.svn.wordpress.org/trunk@54305


git-svn-id: http://core.svn.wordpress.org/trunk@53864 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-26 09:08:21 +00:00
audrasjb fa4cc8f69d Editor: Backport hooks to filter `theme.json` data from Gutenberg to 6.1.
This changeset ports the work done in Gutenberg (released in 14.1) to add hooks to filter the `theme.json` data. Specifically, it adds the following filters: `theme_json_default`, `theme_json_blocks`, `theme_json_theme`, and `theme_json_user`.

For more details, see the following Gutenberg pull requests:

- [https://github.com/WordPress/gutenberg/pull/44015 gutenberg#44015]: Make global styles data filterable
- [https://github.com/WordPress/gutenberg/pull/44109 gutenberg#44109]: Prepare `WP_Theme_JSON_Data` class for backporting
- [https://github.com/WordPress/gutenberg/pull/44159 gutenberg#44159]: Update hook's names from `global_styles_*` to `theme_json_*`

Props oandregal, czapla, gziolo, bernhard-reiter.
See #56467.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53810 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-20 13:13:21 +00:00
audrasjb 1e791f041d Editor: Backport Style Engine API functions, classes and tests.
This PR migrates the Style Engine PHP functions, classes and tests into Core for 6.1. It backports the original [WordPress/gutenberg#40260 PR #40260] from Gutenberg repository.

Props ramonopoly, bernhard-reiter, costdev, azaozz, andrewserong, mukesh27, aristath.
See #56467.

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


git-svn-id: http://core.svn.wordpress.org/trunk@53715 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-14 12:48:16 +00:00
Pascal Birchler bb9f57429a I18N: Introduce `WP_Textdomain_Registry` to store text domains and their language directory paths.
Previously, when using `switch_to_locale()` all current loaded text domains were unloaded and added to the `$l10n_unloaded` global. This prevented the just-in-time loading for text domains after a switch. The just-in-time loading was also only possible if the translations were stored in `WP_LANG_DIR`. Both issues have been fixed.

* Adds `WP_Textdomain_Registry` to keep track of the language directory paths for all plugins and themes.
* Updates all `load_*_textdomain()`  functions to store the path in `WP_Textdomain_Registry`.
* Adds `$locale` parameter to `load_textdomain()` to specify the locale the translation file is for.
* Adds `$reloadable` parameter to `unload_textdomain()` to define whether a text domain can be loaded just-in-time again. This is used by `WP_Locale_Switcher::load_translations()`.
* Extends `_load_textdomain_just_in_time()` to also support text domains of plugins and themes with custom language directories.
* Fixes the incorrect `test_plugin_translation_after_switching_locale_twice()` test which should have caught this issue earlier.
* Adds a new test plugin and theme to test the loading of translations with a custom language directory.
* Deprecates the now unused and private `_get_path_to_translation()` and `_get_path_to_translation_from_lang_dir()` functions.

Previously added in [49236] and reverted in [49236] to investigate concerns which are now addressed here.

Props yoavf, swissspidy, dd32, ocean90.
See #26511.
Fixes #39210.
Built from https://develop.svn.wordpress.org/trunk@53874


git-svn-id: http://core.svn.wordpress.org/trunk@53433 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-08-11 12:39:12 +00:00
gziolo 68a36de460 REST API: Bring new endpoints for Block Patterns from Gutenberg plugin
Related Gutenberg issue: https://github.com/WordPress/gutenberg/issues/39889.

Backporting changes from the Gutenberg plugin:
- new Block Patterns REST API endpoint
- new Block Pattern Categories REST API endpoint
- updates to Query Loop related patterns
- support for custom taxonomies in Query Loop block

Props hellofromtonya, peterwilsoncc, ntsekouras, zieladam, ironprogrammer, spacedmonkey, timothyblynjacobs, antonvlasenko, jsnajdr.
See #55505.



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


git-svn-id: http://core.svn.wordpress.org/trunk@52741 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-04-12 09:26:16 +00:00
gziolo c5360263ed Editor: Backport block support changes from the Gutenberg plugin
Migrate spacing, border, color, dimensions, elements and typography and associated tests for block supports in the block editor.

Related changes in Gutenberg:
- Include individual serialization changes from 6de16981c7
- Skip Style Engine integration from 44925a947f%60

Props ramonopoly, aaronrobertshaw.
See #55505.


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


git-svn-id: http://core.svn.wordpress.org/trunk@52665 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-04-05 12:08:02 +00:00
audrasjb 1c07680a7a Plugins: Avoid stomping of some variables in `wp-settings.php`.
This changeset decreases the chance of accidentally overwriting some variables located in `wp-settings.php`, as the chance of overriding a variable called `$_wp_plugin_file` would be lower than for `$plugin`, `$mu_plugin` or `$network_plugin`.

Props stevegrunwell, joyously, peterwilsoncc, ocean90, SergeyBiryukov, jrf, azouamauriac.
Fixes #55432.

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


git-svn-id: http://core.svn.wordpress.org/trunk@52593 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-03-28 13:59:02 +00:00
spacedmonkey 13c5637263 Site Editor: Add site export REST API endpoint.
Add a REST API to export site templates and template part as html files. When the REST API is requested, it responds by downloading a single ZIP file and exits early, without completing full request.  To create the exported zip, the ZipArchive class is required. If this class is not present then the export will gracefully fail, returning a `WP_Error` object and 500 status error code. 

Props spacedmonkey, youknowriad, Mamaduka, walbo, peterwilsoncc. 
Fixes #54448 .


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


git-svn-id: http://core.svn.wordpress.org/trunk@51878 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-11-30 17:32:02 +00:00
spacedmonkey ebf7eb50dc Editor: Remove Navigation Areas
Navigation area were merged as part of full site editing and the new navigation block. This functionality is experimental and not currently used in WordPress core, so should be removed.

Props noisysocks, spacedmonkey, get_dave, zieladam.
Fixes #54506.


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


git-svn-id: http://core.svn.wordpress.org/trunk@51864 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-11-29 22:06:01 +00:00
noisysocks 449f1bb07a REST API: Add /wp/v2/block-navigation-areas endpoint
Copies WP_REST_Block_Navigation_Areas_Controller from the Gutenberg plugin. This
provides the /wp/v2/block-navigation-areas endpoint used by the Navigation
block.

Props antonvlasenko, TimothyBlynJacobs.
Fixes #54393.

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


git-svn-id: http://core.svn.wordpress.org/trunk@51725 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-11-11 03:52:00 +00:00
TimothyBlynJacobs e2d4385a4f REST API: Introduce Menu management endpoints.
This commit introduces the `/wp/v2/menus`, `/wp/v2/menu-items` and `/wp/v2/menu-locations` REST API endpoints. These endpoints are fully available to users with the `edit_theme_options` capability, but can be read by any user who can edit a REST API available post type.

The `nav_menu` taxonomy and `nav_menu_item` post type now map their capabilities to the `edit_theme_options` primitive capability. This allows developers to provide more fine-grained access control. However, if a developer is currently dynamically removing the `edit_theme_options` capability using `map_meta_cap`, they should use the `user_has_cap` filter instead.

The `wp_update_nav_menu_item()` function has been adjusted to return an error if saving the menu item post or assigning the menu item to a menu generate an error.

Lastly, a new menu item type is introduced, `block`, that can be used to store a Block as a menu item.

Props andraganescu, antonvlasenko, dingo_d, dlh, isabel_brison, kadamwhite, Mamaduka, NateWr, noisysocks, peterwilsoncc, ryelle, schlessera, soean, Spacedmonkey, talldanwp, TimothyBlynJacobs, tobifjellner, westonruter, wpscholar, zieladam.
Fixes #40878.

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


git-svn-id: http://core.svn.wordpress.org/trunk@51671 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-11-09 19:00:01 +00:00
noisysocks c421e9b34a Add Site Editor and PHP changes from Gutenberg 10.1 - 11.9
- First pass at adding the site editor from the Gutenberg plugin to
  wp-admin/site-editor.php.
- Adds miscellaneous PHP changes from Gutenberg 10.1 - 11.9.

Follows [52042].
See #54337.
Props youknowriad, aristath, hellofromtonya, gziolo.

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


git-svn-id: http://core.svn.wordpress.org/trunk@51661 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-11-09 02:17:17 +00:00
jorgefilipecosta d8fe393934 Add: Public functions for interacting with global styles & settings.
This commit ports the public functions to interact with the global styles & settings.

See #54336.
Props oandregal.
Built from https://develop.svn.wordpress.org/trunk@52054


git-svn-id: http://core.svn.wordpress.org/trunk@51646 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-11-08 21:45:58 +00:00
jorgefilipecosta db5d8b5e03 Add: Global Styles Rest endpoints.
This commit ports the global styles rest endpoints from the Gutenberg plugin into the core.

See #54336.
Props oandregal, aristath, timothyblynjacobs, spacedmonkey, youknowriad.
Built from https://develop.svn.wordpress.org/trunk@52051


git-svn-id: http://core.svn.wordpress.org/trunk@51643 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-11-08 21:00:07 +00:00
jorgefilipecosta 065c639a2a Update theme.json classes for WordPress 5.9.
This commit ports to core the changes to the classes that deal with theme.json code.

See #54336.
Props oandregal, spacedmonkey, noisysocks, hellofromtonya, youknowriad.
Built from https://develop.svn.wordpress.org/trunk@52049


git-svn-id: http://core.svn.wordpress.org/trunk@51641 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-11-08 19:19:58 +00:00
Sergey Biryukov 107d13bc28 Coding Standards: Move `wp-includes/class-http.php` to `wp-includes/class-wp-http.php`.
This renames the file containing the `WP_Http` class to conform to the coding standards.

This commit also includes:

- A new `class-http.php` that includes the new file, for anyone that may've been including the file directly.
- Replaces references to the old filename with the new filename.

Follow-up to [8516], [13274], [33748].

Fixes #54389. See #53359.
Built from https://develop.svn.wordpress.org/trunk@52026


git-svn-id: http://core.svn.wordpress.org/trunk@51618 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-11-07 01:36:57 +00:00
hellofromTonya cf0274e1ca REST API: Add URL Details endpoint.
Adds a new REST API endpoint (`/wp-block-editor/v1/url-details`) for retrieving information from an external URL.

Information retrieved:

* Title: content of the `<title>` element
* Icon: favicon image link
* Description: content of the `description` or `og:description` meta element
* Image: OG image link

This endpoint is used by the block editor for link previews.

Props get_dave, aduth, andraganescu, beaulebens, hellofromTonya, kevin940726, mamaduka, marekhrabe, mnelson4, noisysocks, obenland, ocean90, retrofox, shaunandrews, spacedmonkey, swissspidy, timothyblynjacobs, xknown, youknowriad.
Fixes #54358.
Built from https://develop.svn.wordpress.org/trunk@51973


git-svn-id: http://core.svn.wordpress.org/trunk@51562 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-11-02 12:48:00 +00:00
Sergey Biryukov 033c742a4e Block Editor: Load the `WP_Theme_JSON_Resolver` class in `wp-admin/load-styles.php`.
This ensures correct load order when style concatenation is used, e.g. when `SCRIPT_DEBUG` is off.

Additionally, make sure the `WP_CONTENT_DIR` constant is defined for use in `get_theme_root()` via `get_stylesheet_directory()`.

Follow-up to [50992], [51001], [51013].

Props nosolosw.
See #53175.
Built from https://develop.svn.wordpress.org/trunk@51056


git-svn-id: http://core.svn.wordpress.org/trunk@50665 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-06-01 23:09:58 +00:00
ryelle 56ca42b5d9 Block Editor: Add support for the pattern directory.
Add an endpoint for fetching block patterns from WordPress.org, and load the block patterns from this new API. Remove the block patterns that have already been moved to WordPress.org/patterns.

Props ryelle, iandunn, youknowriad, timothyblynjacobs.
Fixes #53246.


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


git-svn-id: http://core.svn.wordpress.org/trunk@50630 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-05-26 01:11:59 +00:00
Sergey Biryukov 3c3a18a957 Block Editor: Only load the `WP_Theme_JSON_Resolver` class once.
Since the class is now loaded via `wp-includes/script-loader.php`, which is required earlier in `wp-settings.php`, loading it again in `wp-settings.php` is redundant.

Follow-up to [50992], [51001].

See #53175.
Built from https://develop.svn.wordpress.org/trunk@51013


git-svn-id: http://core.svn.wordpress.org/trunk@50622 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-05-25 21:40:57 +00:00
youknowriad 4ae0e4220f Block Editor: Introduce block templates for classic themes.
With this patch, users will be able to create custom block based templates
and assign them to specific pages/posts.

Themes can also opt-out of this feature

Props bernhard-reiter, carlomanf.
Fixes #53176.

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


git-svn-id: http://core.svn.wordpress.org/trunk@50612 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-05-25 14:20:57 +00:00
youknowriad f6af848c72 Block Editor: Load theme resolver class in script loader.
script-loader.php is sometimes called directly and in these situations, the Theme_JSON_Resolver class was not defined.

Props nosolosw, noisysocks.
Fixes #53175.

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


git-svn-id: http://core.svn.wordpress.org/trunk@50610 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-05-25 13:42:58 +00:00
noisysocks 1314542c50 REST API: Add widget endpoints
Adds the sidebars, widgets and widget-types REST API endpoints from the
Gutenberg plugin.

Fixes #41683.
Props TimothyBlynJacobs, spacedmonkey, zieladam, jorgefilipecosta, youknowriad, kevin940726.

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


git-svn-id: http://core.svn.wordpress.org/trunk@50604 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-05-25 08:27:57 +00:00
noisysocks ed195fbd89 REST API: Revert widget endpoints
Reverts [50993] as it has missing props.

Reverts [50993].
See #41683.

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


git-svn-id: http://core.svn.wordpress.org/trunk@50603 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-05-25 08:22:56 +00:00
noisysocks 2a4e1e0c04 REST API: Add widget endpoints
Adds the sidebars, widgets and widget-types REST API endpoints from the
Gutenberg plugin.

Fixes #41683.
Props TimothyBlynJacobs.

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


git-svn-id: http://core.svn.wordpress.org/trunk@50602 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-05-25 07:52:55 +00:00
youknowriad 4e1dc7a28c Block Editor: Add Global Settings support using theme.json file.
This is the first piece of landing the theme.json processing in WordPress core. 
It allows themes to configure the different editor settings, allow cusomizations and define presets in theme.json file.
 
Props jorgefilipecosta, nosolosw.
See #53175.

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


git-svn-id: http://core.svn.wordpress.org/trunk@50568 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-05-24 08:37:55 +00:00
gziolo 4ae98860b9 Editor: Extract `block_editor_rest_api_preload` method for use with different editor screens
It is going to be used on the new widgets editor screen. This patch also introduced a new class WP_Block_Editor_Context that is going to be used with revised block editor filters to let extenders to keep their existing behavior. It should also allow to provide more settings through the context class as new screens get introduced like the navigation editor.

Props azaozz, chrisvanpatten, timothyblynjacobs, youknowriad.
Fixes #52920.



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


git-svn-id: http://core.svn.wordpress.org/trunk@50565 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-05-24 07:32:55 +00:00
youknowriad a225c5cdc6 Block Editor: Updated the WordPress packages from Gutenberg 10.7.0 RC.
This also includes:

 - The removal of the Post Author block.
 - Renaming build_query_vars_from_query_block function.
 - Update the block supports.

Props gziolo.
See #52991. 
-This line, and those below, will be ignored--

M    package-lock.json
M    package.json
M    src/wp-includes/assets/script-loader-packages.php
M    src/wp-includes/block-supports/colors.php
AM   src/wp-includes/block-supports/elements.php
D    src/wp-includes/block-supports/padding.php
AM   src/wp-includes/block-supports/spacing.php
M    src/wp-includes/block-supports/typography.php
M    src/wp-includes/blocks/column/block.json
M    src/wp-includes/blocks/index.php
D    src/wp-includes/blocks/post-author
D    src/wp-includes/blocks/post-author.php
M    src/wp-includes/blocks/post-content.php
M    src/wp-includes/blocks/post-featured-image.php
M    src/wp-includes/blocks/query/block.json
M    src/wp-includes/blocks/query-loop/block.json
M    src/wp-includes/blocks/query-loop.php
M    src/wp-includes/blocks/query-pagination/block.json
M    src/wp-includes/blocks/query-pagination-next.php
M    src/wp-includes/blocks/query-pagination-numbers.php
M    src/wp-includes/blocks/site-tagline/block.json
M    src/wp-includes/blocks/site-title/block.json
M    src/wp-includes/blocks.php
M    src/wp-settings.php
M    tests/phpunit/tests/blocks/block.php
M    tools/webpack/packages.js

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


git-svn-id: http://core.svn.wordpress.org/trunk@50554 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-05-21 10:14:23 +00:00
gziolo c3ea09ebb8 Editor: Update WordPress packages published for Gutenberg 10.6
It contains several changes in addition to regular update to WordPress packages:
- All newly exposed blocks are now registered on the server.
- Dutone block support was added.
- Border block support was updated.
- New shared function `construct_wp_query_args` was added for the family of Query blocks - it might need some further work.

Props youknowriad.
See #52991.



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


git-svn-id: http://core.svn.wordpress.org/trunk@50538 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-05-19 15:09:27 +00:00
gziolo f4f125b869 Editor: Abstract block editor configuration
There are several WordPress hooks defined on the server that depend on $post object that isn’t present on the new screens like edit site, edit widgets, or edit navigation. This patch deprecates existing filters and introduces replacements that are context-aware.

Props azaozz, andraganescu, jeremyfelt, nosolosw, youknowriad.
See #52920.




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


git-svn-id: http://core.svn.wordpress.org/trunk@50385 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-04-21 05:12:05 +00:00
gziolo ad48a15387 Editor: Update WordPress packages to use with WordPress 5.8
In the response to the discussion during the Dev Chat, I'm doing a first pass to keep WordPress packages up to date in the WordPress 5.8 release cycle.

See https://github.com/WordPress/wordpress-develop/pull/1176 for more details.

Props youknowriad, aristath, andraganescu.
See #52991.


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


git-svn-id: http://core.svn.wordpress.org/trunk@50370 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-04-15 15:19:43 +00:00
Felix Arntz dbfbf5501a Security, Site Health: Make migrating a site to HTTPS a one-click interaction.
Switching a WordPress site from HTTP to HTTPS has historically been a tedious task. While on the surface the Site Address and WordPress Address have to be updated, existing content still remains using HTTP URLs where hard-coded in the database. Furthermore, updating _two_ URLs to migrate to HTTPS is still a fairly unintuitive step which is not clearly explained.

This changeset simplifies migration from HTTP to HTTPS and, where possible, makes it a one-click interaction.

* Automatically replace insecure versions of the Site Address (`home_url()`) with its HTTPS counterpart on the fly if the site has been migrated from HTTP to HTTPS. This is accomplished by introducing a `https_migration_required` option and enabling it when the `home_url()` is accordingly changed.
    * A new `wp_replace_insecure_home_url()` function is hooked into various pieces of content to replace URLs accordingly.
    * The migration only kicks in when the Site Address (`home_url()`) and WordPress Address (`site_url()`) match, which is the widely common case. Configurations where these differ are often maintained by more advanced users, where this migration routine would be less essential - something to potentially iterate on in the future though.
    * The migration does not actually update content in the database. More savvy users that prefer to do that can prevent the migration logic from running by either deleting the `https_migration_required` option or using the new `wp_should_replace_insecure_home_url` filter.
    * For fresh sites that do not have any content yet at the point of changing the URLs to HTTPS, the migration will also be skipped since it would not be relevant.
* Expose a primary action in the Site Health recommendation, if HTTPS is already supported by the environment, built on top of the HTTPS detection mechanism from [49904]. When clicked, the default behavior is to update `home_url()` and `site_url()` in one go to their HTTPS counterpart.
    * A new `wp_update_urls_to_https()` function takes care of the update routine.
    * A new `update_https` meta capability is introduced to control access.
    * If the site's URLs are controlled by constants, this update is not automatically possible, so in these scenarios the user is informed about that in the HTTPS status check in Site Health.
* Allow hosting providers to modify the URLs linked to in the HTTPS status check in Site Health, similar to how that is possible for the URLs around updating the PHP version.
    * A `WP_UPDATE_HTTPS_URL` environment variable or `wp_update_https_url` filter can be used to provide a custom URL with guidance about updating the site to use HTTPS.
    * A `WP_DIRECT_UPDATE_HTTPS_URL` environment variable or `wp_direct_update_https_url` filter can be used to provide a custom URL for the primary CTA to update the site to use HTTPS.

Props flixos90, timothyblynjacobs.
Fixes #51437.

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


git-svn-id: http://core.svn.wordpress.org/trunk@49810 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-02-02 00:10:01 +00:00
Felix Arntz 3716c8c20f Robots: Introduce Robots API.
This changeset introduces a filter-based Robots API, providing central control over the `robots` meta tag.

* Introduces `wp_robots()` function which should be called anywhere a `robots` meta tag should be included.
* Introduces `wp_robots` filter which allows adding or modifying directives for the `robots` meta tag. The `wp_robots()` function is entirely filter-based, i.e. if no filter is added to `wp_robots`, no directives will be present, and therefore the entire `robots` meta tag will be omitted.
* Introduces the following `wp_robots` filter functions which replace similar existing functions that were manually rendering a `robots` meta tag:
    * `wp_robots_noindex()` replaces `noindex()`, which has been deprecated.
    * `wp_robots_no_robots()` replaces `wp_no_robots()`, which has been deprecated.
    * `wp_robots_sensitive_page()` replaces `wp_sensitive_page_meta()`, which has been deprecated. Its rendering of the `referrer` meta tag has been moved to another new function `wp_strict_cross_origin_referrer()`.

Migration to the new functions is straightforward. For example, a call to `add_action( 'wp_head', 'wp_no_robots' )` should be replaced with `add_filter( 'wp_robots', 'wp_robots_no_robots' )`.

Plugins and themes that render their own `robots` meta tags are encouraged to switch to rely on the `wp_robots` filter in order to use the central management layer now provided by WordPress core.

Props adamsilverstein, flixos90, timothyblynjacobs, westonruter.
See #51511.

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


git-svn-id: http://core.svn.wordpress.org/trunk@49693 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-01-21 01:37:00 +00:00
Felix Arntz c81db1f6e6 Security, Site Health: Detect HTTPS support and encourage switching.
This changeset modifies the Site Health panel for HTTPS to provide more accurate recommendations based on whether the environment is already set up for HTTPS.

* Introduces `wp_is_using_https()` to check whether the site is configured to use HTTPS (via its Site Address and WordPress Address).
* Introduces `wp_is_https_supported()` to check whether the environment supports HTTPS. This relies on a cron job which periodically checks support using a loopback request.

Props Clorith, flixos90, miinasikk, westonruter.
Fixes #47577.

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


git-svn-id: http://core.svn.wordpress.org/trunk@49603 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-12-23 19:13:04 +00:00
Dominik Schilling abc9d961d5 I18N: Revert [49236] for now to investigate alternative implementations.
See #39210, #51678, #26511.
Built from https://develop.svn.wordpress.org/trunk@49566


git-svn-id: http://core.svn.wordpress.org/trunk@49304 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-11-12 14:43:09 +00:00
Dominik Schilling 173b9aa122 I18N: Introduce `WP_Textdomain_Registry` to store text domains and their language directory paths.
Previously, when using `switch_to_locale()` all current loaded text domains were unloaded and added to the `$l10n_unloaded` global. This prevented the just-in-time loading for text domains after a switch. The just-in-time loading was also only possible if the translations were stored in `WP_LANG_DIR`. Both issues have been fixed.

* Adds `WP_Textdomain_Registry` to keep track of the language directory paths for all plugins and themes.
* Updates all `load_*_textdomain()`  functions to store the path in `WP_Textdomain_Registry`.
* Adds `$reloadable` parameter to `unload_textdomain()` to define whether a text domain can be loaded just-in-time again. This is used by `WP_Locale_Switcher::load_translations()`.
* Extends `_load_textdomain_just_in_time()` to also support text domains of plugins and themes with custom language directories.
* Fixes the incorrect `test_plugin_translation_after_switching_locale_twice()` test which should have catch this issue earlier.
* Adds a new test plugin/theme to test the loading of translations with a custom language directory.
* Deprecates the now unused and private `_get_path_to_translation()` and `_get_path_to_translation_from_lang_dir()` functions.

Props yoavf, swissspidy, dd32, ocean90.
See #26511.
Fixes #39210.
Built from https://develop.svn.wordpress.org/trunk@49236


git-svn-id: http://core.svn.wordpress.org/trunk@48998 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-10-20 16:05:07 +00:00
youknowriad d6cff7965a Block Editor: Update the WordPress Packages to the latest version.
This includes the packages that match the Gutenberg 9.2 Release.
It is going to be the last block-editor features update for WordPress 5.6.
It also updates the block-supports code base to the latest APIs.

Props isabel_brison, noisysocks, desrosj.
Fixes #51570.

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


git-svn-id: http://core.svn.wordpress.org/trunk@48988 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-10-20 13:36:16 +00:00
TimothyBlynJacobs 039ce3f16f Site Health, REST API: Move async tests to REST API endpoints.
This provides more flexibility when writing tests and benefits from running in a front-end context which is necessary for some tests like checking that updates are supported. Additionally, this provides a more robust interface for developers who want to integrate with Site Health tests.

Because the `wp/v2` endpoint is reserved for modeling core entities, site health is registered in its own `wp-site-health/v1` namespace.

The existing ajax actions have been maintained for backward compatibility.

Props Clorith, chrisvanpatten, afragen, pokhriyal, TimothyBlynJacobs.
Fixes #48105.

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


git-svn-id: http://core.svn.wordpress.org/trunk@48916 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-10-15 02:00:08 +00:00
Sergey Biryukov 620c069fe8 General: Move `wp_array_get()` from a separate file to `wp-includes/functions.php`, for consistency.
Add missing `@since` tag, adjust the DocBlock per the documentation standards.

Follow-up to [49135].

Props isabel_brison, ocean90.
Fixes #51461.
Built from https://develop.svn.wordpress.org/trunk@49143


git-svn-id: http://core.svn.wordpress.org/trunk@48905 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-10-14 02:10:04 +00:00
jorgefilipecosta b667105f60 Editor: update packages; Port block supports to WordPress core.
The following package versions were changed:
@wordpress/a11y: 2.11.0 -> 2.13.0
@wordpress/annotations: 1.20.4 -> 1.22.0
@wordpress/api-fetch: 3.18.0 -> 3.20.0
@wordpress/autop: 2.9.0 -> 2.10.0
@wordpress/blob: 2.9.0 -> 2.10.0
@wordpress/block-directory: 1.13.7 -> 1.16.0
@wordpress/block-editor: 4.3.7 -> 5.0.0
@wordpress/block-library: 2.22.7 -> 2.25.0
@wordpress/block-serialization-default-parser: 3.7.0 -> 3.8.0
@wordpress/blocks: 6.20.3 -> 6.23.0
@wordpress/components: 10.0.6 -> 11.0.0
@wordpress/compose: 3.19.3 -> 3.21.0
@wordpress/core-data: 2.20.3 -> 2.23.0
@wordpress/data: 4.22.3 -> 4.24.0
@wordpress/data-controls: 1.16.3 -> 1.18.0
@wordpress/date: 3.10.0 -> 3.12.0
@wordpress/deprecated: 2.9.0 -> 2.10.0
@wordpress/dom: 2.13.1 -> 2.15.0
@wordpress/dom-ready: 2.10.0 -> 2.11.0
@wordpress/e2e-test-utils: 4.11.2 -> 4.14.0
@wordpress/edit-post: 3.21.7 -> 3.24.0
@wordpress/editor: 9.20.7 -> 9.23.0
@wordpress/element: 2.16.0 -> 2.18.0
@wordpress/escape-html: 1.9.0 -> 1.10.0
@wordpress/format-library: 1.22.7 -> 1.24.0
@wordpress/hooks: 2.9.0 -> 2.10.0
@wordpress/html-entities: 2.8.0 -> 2.9.0
@wordpress/i18n: 3.14.0 -> 3.16.0
@wordpress/icons: 2.4.0 -> 2.7.0
@wordpress/is-shallow-equal: 2.1.0 -> 2.3.0
@wordpress/keyboard-shortcuts: 1.9.3 -> 1.11.0
@wordpress/keycodes: 2.14.0 -> 2.16.0
@wordpress/library-export-default-webpack-plugin: 1.7.0 -> 1.9.0
@wordpress/list-reusable-blocks: 1.21.6 -> 1.23.0
@wordpress/media-utils: 1.15.0 -> 1.17.0
@wordpress/notices: 2.8.3 -> 2.10.0
@wordpress/nux: 3.20.6 -> 3.22.0
@wordpress/plugins: 2.20.3 -> 2.22.0
@wordpress/primitives: 1.7.0 -> 1.9.0
@wordpress/priority-queue: 1.7.0 -> 1.9.0
@wordpress/redux-routine: 3.10.0 -> 3.12.0
@wordpress/rich-text: 3.20.4 -> 3.22.0
@wordpress/scripts: 12.1.1 -> 12.3.0
@wordpress/server-side-render: 1.16.6 -> 1.18.0
@wordpress/shortcode: 2.9.0 -> 2.11.0
@wordpress/token-list: 1.11.0 -> 1.13.0
@wordpress/url: 2.17.0 -> 2.19.0
@wordpress/viewport: 2.21.3 -> 2.23.0
@wordpress/warning: 1.2.0 -> 1.3.0
@wordpress/wordcount: 2.10.0 -> 2.12.0

Props isabel_brison, youknowriad, mcsf.
Fixes #51461.
Built from https://develop.svn.wordpress.org/trunk@49135


git-svn-id: http://core.svn.wordpress.org/trunk@48897 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-10-13 13:10:30 +00:00
TimothyBlynJacobs 49a399db05 REST API: Introduce search post format handler.
This allows for clients to search the used post formats via the /wp/v2/search endpoint by using a type=post-format query parameter.
Fixes #51459.
Props andraganescu, zieladam, noisysocks, TimothyBlynJacobs.

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


git-svn-id: http://core.svn.wordpress.org/trunk@48894 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-10-12 19:54:05 +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
TimothyBlynJacobs f5c67c386f REST API: Introduce search term handler.
This allows for clients to search the available terms via the `/wp/v2/search` endpoint by using a `type=term` query parameter.

Fixes #51458.
Props andraganescu, zieladam, noisysocks, TimothyBlynJacobs.

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


git-svn-id: http://core.svn.wordpress.org/trunk@48865 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-10-08 01:32:05 +00:00
youknowriad 777872bdb1 Block Editor: Add the initial set of block patterns.
Included patterns:

text-two-columns
two-buttons
two-images
text-two-columns-with-images
text-three-columns-buttons
large-header
large-header-paragraph
three-buttons
quote
testimonials

Props mcsf, nrqsnchz.
See #50550.

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


git-svn-id: http://core.svn.wordpress.org/trunk@48103 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-07-06 10:50:02 +00:00
gziolo eafcf52d18 Editor: Register core blocks on the server
Exposes all core blocks (excluding embeds) on the server to be used with the REST API block types endpoint.

Props spacedmonkey, timothyblynjacobs.
Fixes #50263.


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


git-svn-id: http://core.svn.wordpress.org/trunk@48031 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-07-01 12:29:03 +00:00
TimothyBlynJacobs 083134f694 REST API: Introduce plugin management and block directory endpoints.
These endpoints facilitate the Block Directory Inserter feature in Gutenberg. Users can now install, activate, deactivate, and delete plugins over the REST API. The block directoryendpoint allows searching for available blocks from the WordPress.org block directory.

Props cklee, talldanwp, noisysocks, joen, soean, youknowriad, dufresnesteven, gziolo, dd32, tellyworth, ryelle, spacedmonkey, TimothyBlynJacobs.
Fixes #50321.


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


git-svn-id: http://core.svn.wordpress.org/trunk@48011 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-07-01 04:24:03 +00:00
TimothyBlynJacobs 9f14967ff0 REST API: Introduce Block Types endpoint.
This endpoint allows a user to retrieve the block type definition for all server-side registered block types.

Props spacedmonkey, aduth, gziolo, ocean90, TimothyBlynJacobs.
Fixes #47620.

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


git-svn-id: http://core.svn.wordpress.org/trunk@47942 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-06-26 00:46:07 +00:00
gziolo 3f2e7804c4 Editor: Introduce WP_Block and WP_Block_List classes
Backports functionality added in Gutenberg in the following PRs:
- https://github.com/WordPress/gutenberg/pull/21467
- https://github.com/WordPress/gutenberg/pull/21925
It's a few ideas related to block rendering and the provided block value, which is particularly impactful for work around block context.

Props aduth, TimothyBJacobs, noisysocks, epiqueras, youknowriad, talldanwp, zebulan.
Fixes #49926.


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


git-svn-id: http://core.svn.wordpress.org/trunk@47928 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-06-25 05:16:11 +00:00
youknowriad 6d927e494c Block Editor: Add the Block Patterns API.
Backport WP_Block_Pattern_Categories_Registry, WP_Block_Patterns_Registry
and block patterns registration functions from the Gutenberg repository.

Props ocean90, ellatrix
Fixes #50445.

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


git-svn-id: http://core.svn.wordpress.org/trunk@47925 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-06-24 12:59:11 +00:00
Pascal Birchler 609dd1d14f Sitemaps: Add XML sitemaps functionality to WordPress.
While web crawlers are able to discover pages from links within the site and from other sites, XML sitemaps supplement this approach by allowing crawlers to quickly and comprehensively identify all URLs included in the sitemap and learn other signals about those URLs using the associated metadata.

See https://make.wordpress.org/core/2020/06/10/merge-announcement-extensible-core-sitemaps/ for more details.

This feature exposes the sitemap index via `/wp-sitemap.xml` and exposes a variety of new filters and hooks for developers to modify the behavior. Users can disable sitemaps completely by turning off search engine visibility in WordPress admin.

This change also introduces a new `esc_xml()` function to escape strings for output in XML, as well as XML support to `wp_kses_normalize_entities()`.

Props Adrian McShane, afragen, adamsilverstein, casiepa, flixos90, garrett-eclipse, joemcgill, kburgoine, kraftbj, milana_cap, pacifika, pbiron, pfefferle, Ruxandra Gradina, swissspidy, szepeviktor, tangrufus, tweetythierry.
Fixes #50117.
See #3670. See #19998.

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


git-svn-id: http://core.svn.wordpress.org/trunk@47839 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-06-17 15:24: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
whyisjake 92636d716a Site Health instantiation prevents use of some hooks by plugins.
As the WP_Site_Health class is instantiated prior to plugins being required and the `plugins_loaded` hook being fired, it prevents plugins from using the following hooks in the functions called by `maybe_create_scheduled_event()`.

Fixes #49824.
Props peterwilsoncc, whyisjake.


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


git-svn-id: http://core.svn.wordpress.org/trunk@47343 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-04-10 03:57:08 +00:00
Sergey Biryukov 78e62aa3e4 Coding Standards: Whitelist `date_default_timezone_set()` usage in `wp-settings.php`.
See #49542.
Built from https://develop.svn.wordpress.org/trunk@47552


git-svn-id: http://core.svn.wordpress.org/trunk@47327 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-04-06 09:06:12 +00:00
jorgefilipecosta 56906bcf59 Block Editor: Update WordPress Packages; Remove navigation block; Add social links block
The following package versions were changed:
@wordpress/annotations: 1.11.0 -> 1.12.0
@wordpress/api-fetch: 3.10.0 -> 3.11.0
@wordpress/block-directory: 1.4.0 -> 1.5.0
@wordpress/block-editor: 3.6.0 -> 3.7.0
@wordpress/block-library: 2.13.0 -> 2.14.0
@wordpress/blocks: 6.11.0 -> 6.12.0
@wordpress/components: 9.1.0 -> 9.2.0
@wordpress/core-data: 2.11.0 -> 2.12.0
@wordpress/data: 4.13.0 -> 4.14.0
@wordpress/data-controls: 1.7.0 -> 1.8.0
@wordpress/e2e-test-utils: 4.2.0 -> 4.3.0
@wordpress/edit-post: 3.12.0 -> 3.13.0
@wordpress/editor: 9.11.0 -> 9.12.0
@wordpress/format-library: 1.13.0 -> 1.14.0
@wordpress/icons: 1.0.0 -> 1.1.0
@wordpress/keyboard-shortcuts: 1.0.0 -> 1.1.0
@wordpress/list-reusable-blocks: 1.12.0 -> 1.13.0
@wordpress/media-utils: 1.6.0 -> 1.7.0
@wordpress/notices: 1.12.0 -> 2.0.0
@wordpress/nux: 3.11.0 -> 3.12.0
@wordpress/plugins: 2.11.0 -> 2.12.0
@wordpress/primitives: 1.0.0 -> 1.1.0
@wordpress/rich-text: 3.11.0 -> 3.12.0
@wordpress/server-side-render: 1.7.0 -> 1.8.0
@wordpress/url: 2.10.0 -> 2.11.0
@wordpress/viewport: 2.12.0 -> 2.13.0
The navigation block inclusion was reverted.
The social links block was included.

Props gziolo, youknowriad, mcsf, noisysocks.
Fixes #49397.
Built from https://develop.svn.wordpress.org/trunk@47250


git-svn-id: http://core.svn.wordpress.org/trunk@47050 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-02-10 22:33:27 +00:00
Sergey Biryukov c1fb007ff3 Docs: Add documentation for globals in `wp-settings.php`.
Props chinteshprajapati.
Fixes #46253.
Built from https://develop.svn.wordpress.org/trunk@47231


git-svn-id: http://core.svn.wordpress.org/trunk@47031 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-02-10 03:34:05 +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
jorgefilipecosta d7e321c7c7 Block Editor: Include navigation block server logic.
Core did not include the navigation block PHP files.
This commit fixes the issue referred, and now the navigation block is executed on the frontend. The block still does not work as expected and throws an error during frontend execution. That problem is going to be fixed on the next WordPress package update.
This commit adds the file as it is on the npm package used.

Props gziolo.
Fixes #49348.
Built from https://develop.svn.wordpress.org/trunk@47176


git-svn-id: http://core.svn.wordpress.org/trunk@46976 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-02-04 20:16:04 +00:00
Sergey Biryukov 0aff1cf6bd Site Health: Rename `WP_Site_Health::initialize()` introduced in [47063] to `::get_instance()`, for clarity and consistency with other core classes.
Use `WP_Site_Health::get_instance()` where it's needed, instead of creating multiple instances of the class.

Props afercia, xkon, Clorith, SergeyBiryukov.
See #47606.
Built from https://develop.svn.wordpress.org/trunk@47149


git-svn-id: http://core.svn.wordpress.org/trunk@46949 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-02-01 00:39:09 +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 2c4480958b Site Health: Introduce Site Health Status dashboard widget.
The widget informs administrators of any potential issues that should be addressed to improve the performance or security of their website, and directs them to the Site Health screen for more details.

Props Clorith, hedgefield, guddu1315.
See #47606.
Built from https://develop.svn.wordpress.org/trunk@47063


git-svn-id: http://core.svn.wordpress.org/trunk@46863 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2020-01-12 13:33: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
gziolo aca0d9968f Block Editor: Remove experimental Social Links blocks
We decided to mark Social Links block as an experimental feature in Gutenberg. In effect, we are moving all related code from WordPress 5.3 release.

Props youknowriad.

Fixes #48263.


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


git-svn-id: http://core.svn.wordpress.org/trunk@46340 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-10-15 15:37:08 +00:00
gziolo 03390f00c5 Block Editor: Update the WordPress Packages to the ones used in the Gutenberg 6.5 release
Updated Packages:

In version 6.2:

@wordpress/a11y@2.5.0
@wordpress/annotations@1.5.0
@wordpress/api-fetch@3.4.0
@wordpress/autop@2.4.0
@wordpress/babel-plugin-import-jsx-pragma@2.3.0
@wordpress/babel-plugin-makepot@3.2.0
@wordpress/babel-preset-default@4.4.0
@wordpress/blob@2.5.0
@wordpress/block-editor@3.0.0
@wordpress/block-library@2.7.0
@wordpress/block-serialization-default-parser@3.3.0
@wordpress/block-serialization-spec-parser@3.2.0
@wordpress/blocks@6.5.0
@wordpress/browserslist-config@2.6.0
@wordpress/components@8.1.0
@wordpress/compose@3.5.0
@wordpress/core-data@2.5.0
@wordpress/custom-templated-path-webpack-plugin@1.5.0
@wordpress/data-controls@1.1.0
@wordpress/data@4.7.0
@wordpress/date@3.4.0
@wordpress/dependency-extraction-webpack-plugin@1.1.0
@wordpress/deprecated@2.5.0
@wordpress/docgen@1.3.0
@wordpress/dom-ready@2.5.0
@wordpress/dom@2.4.0
@wordpress/e2e-test-utils@2.2.0
@wordpress/e2e-tests@1.4.0
@wordpress/edit-post@3.6.0
@wordpress/editor@9.5.0
@wordpress/element@2.6.0
@wordpress/escape-html@1.5.0
@wordpress/eslint-plugin@2.4.0
@wordpress/format-library@1.7.0
@wordpress/hooks@2.5.0
@wordpress/html-entities@2.5.0
@wordpress/i18n@3.6.0
@wordpress/is-shallow-equal@1.5.0
@wordpress/jest-console@3.2.0
@wordpress/jest-preset-default@4.3.0
@wordpress/jest-puppeteer-axe@1.2.0
@wordpress/keycodes@2.5.0
@wordpress/library-export-default-webpack-plugin@1.4.0
@wordpress/list-reusable-blocks@1.6.0
@wordpress/media-utils@1.0.0
@wordpress/notices@1.6.0
@wordpress/npm-package-json-lint-config@2.1.0
@wordpress/nux@3.5.0
@wordpress/plugins@2.5.0
@wordpress/postcss-themes@2.2.0
@wordpress/priority-queue@1.3.0
@wordpress/redux-routine@3.5.0
@wordpress/rich-text@3.5.0
@wordpress/scripts@3.4.0
@wordpress/server-side-render@1.1.0
@wordpress/shortcode@2.4.0
@wordpress/token-list@1.5.0
@wordpress/url@2.7.0
@wordpress/viewport@2.6.0
@wordpress/wordcount@2.5.0

In version 6.4:
@wordpress/annotations@1.6.0
@wordpress/api-fetch@3.5.0
@wordpress/autop@2.5.0
@wordpress/babel-preset-default@4.5.0
@wordpress/block-editor@3.1.0
@wordpress/block-library@2.8.0
@wordpress/block-serialization-default-parser@3.4.0
@wordpress/block-serialization-spec-parser@3.3.0
@wordpress/blocks@6.6.0
@wordpress/components@8.2.0
@wordpress/compose@3.6.0
@wordpress/core-data@2.6.0
@wordpress/data-controls@1.2.0
@wordpress/data@4.8.0
@wordpress/date@3.5.0
@wordpress/dependency-extraction-webpack-plugin@1.2.0
@wordpress/deprecated@2.6.0
@wordpress/docgen@1.4.0
@wordpress/dom@2.5.0
@wordpress/e2e-test-utils@2.3.0
@wordpress/e2e-tests@1.5.0
@wordpress/edit-post@3.7.0
@wordpress/editor@9.6.0
@wordpress/element@2.7.0
@wordpress/eslint-plugin@3.0.0
@wordpress/format-library@1.8.0
@wordpress/hooks@2.6.0
@wordpress/is-shallow-equal@1.6.0
@wordpress/jest-console@3.3.0
@wordpress/jest-preset-default@5.0.0
@wordpress/jest-puppeteer-axe@1.3.0
@wordpress/keycodes@2.6.0
@wordpress/list-reusable-blocks@1.7.0
@wordpress/media-utils@1.1.0
@wordpress/notices@1.7.0
@wordpress/nux@3.6.0
@wordpress/plugins@2.6.0
@wordpress/project-management-automation@1.0.0
@wordpress/redux-routine@3.6.0
@wordpress/rich-text@3.6.0
@wordpress/scripts@4.0.0
@wordpress/server-side-render@1.2.0
@wordpress/token-list@1.6.0
@wordpress/viewport@2.7.0
@wordpress/wordcount@2.6.0

In version 6.5:
@wordpress/annotations@1.7.0
@wordpress/api-fetch@3.6.0
@wordpress/babel-preset-default@4.6.0
@wordpress/block-directory@1.0.0
@wordpress/block-editor@3.2.0
@wordpress/block-library@2.9.0
@wordpress/blocks@6.7.0
@wordpress/components@8.3.0
@wordpress/compose@3.7.0
@wordpress/core-data@2.7.0
@wordpress/data-controls@1.3.0
@wordpress/data@4.9.0
@wordpress/dependency-extraction-webpack-plugin@2.0.0
@wordpress/e2e-test-utils@2.4.0
@wordpress/e2e-tests@1.7.0
@wordpress/edit-post@3.8.0
@wordpress/editor@9.7.0
@wordpress/element@2.8.0
@wordpress/eslint-plugin@3.1.0
@wordpress/format-library@1.9.0
@wordpress/list-reusable-blocks@1.8.0
@wordpress/media-utils@1.2.0
@wordpress/notices@1.8.0
@wordpress/nux@3.7.0
@wordpress/plugins@2.7.0
@wordpress/rich-text@3.7.0
@wordpress/scripts@5.0.0
@wordpress/server-side-render@1.3.0
@wordpress/url@2.8.0
@wordpress/viewport@2.8.0

Props youknowriad desrosj noisysocks pento jorgefilipecosta iseulde

Fixes: #47843


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


git-svn-id: http://core.svn.wordpress.org/trunk@46001 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-09-19 15:19:18 +00:00
Sergey Biryukov 7c9d4950b7 Bootstrap/Load: Reorganize the initialization flow so that the check for PHP and MySQL requirements could run as early as possible.
This allows us to use PHP 5.6+ syntax in more files, and display a proper error message on older PHP versions, instead of causing a parse error.

Fixes #48059.
Built from https://develop.svn.wordpress.org/trunk@46183


git-svn-id: http://core.svn.wordpress.org/trunk@45995 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-09-19 12:02:58 +00:00
jorgefilipecosta b7fbf7d373 Block Editor: Backport block styles server functions from block editor.
This commit backports the block styles functionality added to the block editor in https://github.com/WordPress/gutenberg/pull/16356.

Props: youknowriad, aduth, swissspidy.
Fixes #48039.
Built from https://develop.svn.wordpress.org/trunk@46111


git-svn-id: http://core.svn.wordpress.org/trunk@45923 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-09-14 18:21:54 +00:00
Sergey Biryukov 7f7480cb2a Docs: Add missing description for `$wp_query` and `$wp_the_query` globals.
Props mukesh27.
See #45604, #47110.
Built from https://develop.svn.wordpress.org/trunk@45739


git-svn-id: http://core.svn.wordpress.org/trunk@45550 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-08-04 01:59:56 +00:00
Sergey Biryukov e0311b76c7 Docs: Add missing description for `$wp_locale` global.
Props mukesh27.
See #45604, #47110.
Built from https://develop.svn.wordpress.org/trunk@45737


git-svn-id: http://core.svn.wordpress.org/trunk@45548 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-08-04 01:46:55 +00:00
Sergey Biryukov ea606165a5 Docs: Add missing description for `$wp` global.
See #45604, #47110.
Built from https://develop.svn.wordpress.org/trunk@45736


git-svn-id: http://core.svn.wordpress.org/trunk@45547 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-08-04 01:28:55 +00:00
Sergey Biryukov b1e34ccc1f Docs: Add missing description for `$wp_rewrite` global.
See #45604, #47110.
Built from https://develop.svn.wordpress.org/trunk@45735


git-svn-id: http://core.svn.wordpress.org/trunk@45546 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-08-04 01:19:56 +00:00
Sergey Biryukov 29b072e706 Docs: Add missing description for `$wpdb`, `$wp_db_version`, and `$wp_current_db_version` globals.
Props mukesh27, utsav72640, immeet94, SergeyBiryukov.
See #45604.
Built from https://develop.svn.wordpress.org/trunk@45734


git-svn-id: http://core.svn.wordpress.org/trunk@45545 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-08-04 01:12:56 +00:00
Sergey Biryukov cff445d55f Coding Standards: Move `wp-includes/date.php` to `wp-includes/class-wp-date-query.php`.
This renames the file containing the `WP_Date_Query` class to conform to the coding standards.

This commit also includes:

- A new `date.php` that includes the new file, for anyone that may've been including the file directly.
- Replaces references to the old filename with the new filename.

Fixes #47775. See #47632.
Built from https://develop.svn.wordpress.org/trunk@45678


git-svn-id: http://core.svn.wordpress.org/trunk@45489 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-07-25 23:31:56 +00:00
Gary Pendergast af0a914d14 Coding Standards: Move `wp-includes/class-oembed.php` to `wp-includes/class-wp-oembed.php`.
This renames the file containing the `WP_oEmbed` class to conform to the coding standards.

This commit also includes:

- A new `class-oembed.php` that includes the new file, for anyone that may've been including the file directly.
- Replaces references to the old filename with the new filename.

See #47632.


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


git-svn-id: http://core.svn.wordpress.org/trunk@45474 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-07-19 04:32:57 +00:00
Gary Pendergast abcbee954f Coding Standards: Fix instances of `WordPress.PHP.NoSilencedErrors.Discouraged`.
Noteable changes:
- The `magic_quotes_runtime` and `magic_quotes_sybase` settings were removed in PHP 5.4, so no longer need to be set.
- Some functions that use external libraries can generate errors that can't be tested for, so are globally allowed to silence errors.
- Quite a few functions would cause errors if `safe_mode` was set. This setting was removed in PHP 5.4.
- Only a handful of `header()` calls needed corresponding `headers_sent()` checks for unit tests to pass, but more may need to be added as the nightlies builds are tested.

See #46732.

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


git-svn-id: http://core.svn.wordpress.org/trunk@45422 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-07-09 05:45:58 +00:00
Gary Pendergast b2d5a4216c Coding Standards: Fix the `Squiz.PHP.DisallowMultipleAssignments` violations in the base directory.
See #47632.


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


git-svn-id: http://core.svn.wordpress.org/trunk@45393 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-07-01 08:27:58 +00:00
Andrew Ozz d0c1b77cda Privacy tools:
- Move the (remaining) privacy tools related functions from `wp-admin/includes/file.php` to `wp-admin/includes/privacy-tools.php`.
- Move the `WP_User_Request` class to a separate file.

See #43895.
Built from https://develop.svn.wordpress.org/trunk@45519


git-svn-id: http://core.svn.wordpress.org/trunk@45330 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-06-10 23:54:53 +00:00
Sergey Biryukov 4e4e8fa110 Bootstrap/Load: Ensure the fatal error handler is registered after `WP_CONTENT_DIR` is defined, so the custom error handler drop-in could be properly loaded.
Props sebastian.pisula, diddledan.
Fixes #46069.
Built from https://develop.svn.wordpress.org/trunk@45056


git-svn-id: http://core.svn.wordpress.org/trunk@44865 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-28 19:04:51 +00:00
Sergey Biryukov 3f6a9eb0e3 Bootstrap/Load: Always run the fatal error handler at shutdown, but don't display the PHP error template once headers are sent.
If a fatal error occurs midway through a page load, or in a REST API request, it still needs to be handled internally for the recovery mode, but the custom message may conflict with already rendered output, e.g. by displaying HTML markup in an XML or JSON request.

Props spacedmonkey, flixos90, TimothyBlynJacobs.
Fixes #45989. See #44458.
Built from https://develop.svn.wordpress.org/trunk@45014


git-svn-id: http://core.svn.wordpress.org/trunk@44823 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-26 20:30:53 +00:00
Felix Arntz 3a77265148 Bootstrap/Load: Introduce a recovery mode for fixing fatal errors.
Using the new fatal handler introduced in [44962], an email is sent to the admin when a fatal error occurs. This email includes a secret link to enter recovery mode. When clicked, the link will be validated and on success a cookie will be placed on the client, enabling recovery mode for that user. This functionality is executed early before plugins and themes are loaded, in order to be unaffected by potential fatal errors these might be causing.

When in recovery mode, broken plugins and themes will be paused for that client, so that they are able to access the admin backend despite of these errors. They are notified about the broken extensions and the errors caused, and can then decide whether they would like to temporarily deactivate the extension or fix the problem and resume the extension.

A link in the admin bar allows the client to exit recovery mode.

Props timothyblynjacobs, afragen, flixos90, nerrad, miss_jwo, schlessera, spacedmonkey, swissspidy.
Fixes #46130, #44458.

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


git-svn-id: http://core.svn.wordpress.org/trunk@44804 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-21 21:53:51 +00:00
Felix Arntz dcb9d7cc7b Bootstrap/Load: Introduce fatal error handler.
This changeset introduces a `WP_Fatal_Error_Handler` class that detects fatal errors and displays a more user-friendly message about the site experiencing technical difficulties.

Websites that have custom requirements in that regard can implement their own fatal error handler by adding a `fatal-error-handler.php` drop-in that returns the handler instance to use, which must be based on a class that inherits `WP_Fatal_Error_Handler`. That handler will then be used in place of the default one. Alternatively, the fatal error handler feature can be completely disable through a constant `WP_DISABLE_FATAL_ERROR_HANDLER`.

Websites that would like to modify specifically the error template displayed in the frontend can add a `php-error.php` drop-in that works similarly to the existing `db-error.php` drop-in. For more granular customization, the fatal error handler also includes new filters `wp_should_handle_php_error`, `wp_php_error_message` and `wp_php_error_args`.

Props afragen, bradleyt, flixos90, ocean90, schlessera, SergeyBiryukov, spacedmonkey, timothyblynjacobs.
See #46130, #44458.

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


git-svn-id: http://core.svn.wordpress.org/trunk@44793 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-21 16:03:51 +00:00
youknowriad 2d58d57e38 Block Editor: Update the WordPress Packages from Gutenberg 5.2.
Updated Packages:

 - @wordpress/a11y@2.1.0
 - @wordpress/annotations@1.1.0
 - @wordpress/api-fetch@3.0.0
 - @wordpress/autop@2.1.0
 - @wordpress/babel-plugin-import-jsx-pragma@2.0.0
 - @wordpress/babel-plugin-makepot@3.0.0
 - @wordpress/babel-preset-default@4.0.0
 - @wordpress/blob@2.2.0
 - @wordpress/block-editor@1.0.0
 - @wordpress/block-library@2.3.0
 - @wordpress/block-serialization-default-parser@3.0.0
 - @wordpress/block-serialization-spec-parser@3.0.0
 - @wordpress/blocks@6.1.0
 - @wordpress/browserslist-config@2.3.0
 - @wordpress/components@7.1.0
 - @wordpress/compose@3.1.0
 - @wordpress/core-data@2.1.0
 - @wordpress/custom-templated-path-webpack-plugin@1.2.0
 - @wordpress/data@4.3.0
 - @wordpress/date@3.1.0
 - @wordpress/deprecated@2.1.0
 - @wordpress/docgen@1.0.0
 - @wordpress/dom-ready@2.1.0
 - @wordpress/dom@2.1.0
 - @wordpress/e2e-test-utils@1.0.0
 - @wordpress/e2e-tests@1.0.0
 - @wordpress/edit-post@3.2.0
 - @wordpress/editor@9.1.0
 - @wordpress/element@2.2.0
 - @wordpress/escape-html@1.1.0
 - @wordpress/eslint-plugin@2.0.0
 - @wordpress/format-library@1.3.0
 - @wordpress/hooks@2.1.0
 - @wordpress/html-entities@2.1.0
 - @wordpress/i18n@3.2.0
 - @wordpress/is-shallow-equal@1.2.0
 - @wordpress/jest-console@3.0.0
 - @wordpress/jest-preset-default@4.0.0
 - @wordpress/jest-puppeteer-axe@1.0.0
 - @wordpress/keycodes@2.1.0
 - @wordpress/library-export-default-webpack-plugin@1.1.0
 - @wordpress/list-reusable-blocks@1.2.0
 - @wordpress/notices@1.2.0
 - @wordpress/npm-package-json-lint-config@1.2.0
 - @wordpress/nux@3.1.0
 - @wordpress/plugins@2.1.0
 - @wordpress/postcss-themes@2.0.0
 - @wordpress/priority-queue@1.0.0
 - @wordpress/redux-routine@3.1.0
 - @wordpress/rich-text@3.1.0
 - @wordpress/scripts@3.0.0
 - @wordpress/shortcode@2.1.0
 - @wordpress/token-list@1.2.0
 - @wordpress/url@2.4.0
 - @wordpress/viewport@2.2.0
 - @wordpress/wordcount@2.1.0

This also includes the update to the scripts dependencies and the new widgets php files.

Props iseulde.
Fixes #46429.

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


git-svn-id: http://core.svn.wordpress.org/trunk@44640 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-03-07 09:09:59 +00:00
Felix Arntz 92c3c46abe Bootstrap/Load: Revert fatal error recovery mechanism from 5.1 to polish for 5.2.
Due to the high number of follow-up tickets and associated security concerns, it was decided to reschedule the fatal error recovery feature for WordPress 5.2, in order to address these issues properly. The feature will continue to be developed, with iterations being merged into trunk early in the 5.2 release cycle.

Fixes #46141. See #44458, #45932, #45940, #46038, #46047, #46068.

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


git-svn-id: http://core.svn.wordpress.org/trunk@44548 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-01-30 11:01:52 +00:00
Peter Wilson cccba7e224 Plugins: Update docs for individual plugin loaded actions.
Corrects documentation to indicate the full path is passed to each action.

Fixes #41346.

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


git-svn-id: http://core.svn.wordpress.org/trunk@44523 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-01-23 03:39:51 +00:00
Felix Arntz 7daa39eb1d Bootstrap/Load: Change `shutdown handler` naming to final `fatal error handler` and allow disabling the handler entirely via a constant.
The `WP_Shutdown_Handler` name plus related function names were premature when originally committed, as there can be multiple shutdown handlers in PHP, and WordPress makes use of that feature. This changeset modifies the name to a more appropriate `WP_Fatal_Error_Handler`, and related to that changes the following names:

* The drop-in to override the handler is now called `fatal-error-handler.php`.
* The internal function `wp_register_premature_shutdown_handler` is now called `wp_register_fatal_error_handler()`.

In addition to these naming changes, a new constant `WP_DISABLE_FATAL_ERROR_HANDLER` is introduced that can be set in `wp-config.php` to entirely disable the fatal error handler. That constant's value is and should be accessed indirectly via a new `wp_is_fatal_error_handler_enabled()` function and is filterable via a new `wp_fatal_error_handler_enabled` hook. Note that disabling the fatal error handler will skip the new functionality entirely, including the potentially used `fatal-error-handler.php` drop-in.

The new set of constant, filter and function provide for an easier-to-use mechanism to disable the fatal error handler altogether, rather than requiring developers to implement a drop-in for purely that purpose.

Props afragen, flixos90, joyously, knutsp, markjaquith, ocean90, schlessera, spacedmonkey.
Fixes #46047. See #44458.

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


git-svn-id: http://core.svn.wordpress.org/trunk@44505 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-01-21 20:15:50 +00:00
Felix Arntz 1e4088fc98 Bootstrap/Load: Introduce fatal error recovery mechanism allowing users to still log in to their admin dashboard.
This changeset introduces a `WP_Shutdown_Handler` class that detects fatal errors and which extension (plugin or theme) causes them. Such an error is then recorded, and an error message is displayed. Subsequently, in certain protected areas, for example the admin, the broken extension will be paused, ensuring that the website is still usable in the respective area. The major benefit is that this mechanism allows site owners to still log in to their website, to fix the problem by either disabling the extension or solving the bug and then resuming the extension.

Extensions are only paused in certain designated areas. The frontend for example stays unaffected, as it is impossible to know what pausing the extension would cause to be missing, so it might be preferrable to clearly see that the website is temporarily not accessible instead.

The fatal error recovery is especially important in scope of encouraging the switch to a maintained PHP version, as not necessarily every WordPress extension is compatible with all PHP versions. If problems occur now, non-technical site owners that do not have immediate access to the codebase are not locked out of their site and can at least temporarily solve the problem quickly.

Websites that have custom requirements in that regard can implement their own shutdown handler by adding a `shutdown-handler.php` drop-in that returns the handler instance to use, which must be based on a class that inherits `WP_Shutdown_Handler`. That handler will then be used in place of the default one.

Websites that would like to modify specifically the error template displayed in the frontend can add a `php-error.php` drop-in that works similarly to the existing `db-error.php` drop-in.

Props afragen, bradleyt, flixos90, ocean90, schlessera, SergeyBiryukov, spacedmonkey.
Fixes #44458.

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


git-svn-id: http://core.svn.wordpress.org/trunk@44355 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2019-01-09 20:05:49 +00:00
Sergey Biryukov e3bb408fbd Plugins: Introduce actions for individual plugin load events:
* `plugin_loaded`: Fires once a single activated plugin has loaded.
* `mu_plugin_loaded`: Fires once a single must-use plugin has loaded.
* `network_plugin_loaded`: Fires once a single network-activated plugin has loaded.

Props Rarst, schlessera.
Fixes #41346.
Built from https://develop.svn.wordpress.org/trunk@44344


git-svn-id: http://core.svn.wordpress.org/trunk@44174 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-12-20 00:52:48 +00:00
Jeremy Felt c3e927d2c8 REST API: Add endpoints for blocks.
`WP_REST_Block_Renderer_Controller` allows rendering of server-side rendered blocks, whilst `WP_REST_Blocks_Controller` allows retrieving of reusable blocks.

Merges [43805] and [43806] from the 5.0 branch to trunk.

Props desrosj, danielbachhuber, pento, Presskopp, swissspidy.
See #45065, #45098.

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


git-svn-id: http://core.svn.wordpress.org/trunk@43980 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-12-14 02:35:38 +00:00
desrosj d4d16ec083 REST API: Introduce Autosaves controller and endpoint.
- Adds `WP_REST_Autosaves_Controller` which extends `WP_REST_Revisions_Controller`.
- Autosaves endpoint is registered for all post types except attachment because even post types without revisions enabled are expected to autosave.
- Because setting the `DOING_AUTOSAVE` constant pollutes the test suite, autosaves tests are run last. We may want to improve upon this later. 

Also, use a truly impossibly high number in User Controller tests. The number `100`, (or `7777` in `trunk`), could be valid in certain test run configurations. The `REST_TESTS_IMPOSSIBLY_HIGH_NUMBER` constant is impossibly high for this very reason.

Finally, Skip Autosaves controller test for multisite. There's a PHP 5.2 edge case where paths calculated differently, possibly caused by differing version of PHPUnit.

Props adamsilverstein, aduth, azaozz, danielbachhuber, rmccue, danielbachhuber.

Merges [43767], [43768], [43769] to trunk.

See #45132, #45131.
Fixes #45128, #43316.
Built from https://develop.svn.wordpress.org/trunk@44126


git-svn-id: http://core.svn.wordpress.org/trunk@43956 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-12-13 22:42:38 +00:00
desrosj c2f3636e4a Blocks: Parse blocks when displaying posts.
Posts containing blocks are now correctly handled when displaying on the front end, including dynamic blocks and nested blocks.

Props pento.

Merges [43752] to trunk.

See #45109.
Built from https://develop.svn.wordpress.org/trunk@44118


git-svn-id: http://core.svn.wordpress.org/trunk@43948 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-12-13 22:22:38 +00:00
desrosj 24f247267f Blocks: Introduce the block parser.
The `WP_Block_Parser` class, and the accompanying `parse_blocks()` helper function, can be used to parse an array of blocks out of a content string.

`WP_Block_Parser` is copied from the `@wordpress/block-serialization-default-parser` package. To ensure it stays in sync with the JavaScript parser, changes should be implemented in the package first, then the package version should be upgraded to include the changes.

Props pento.

Merges [43751] to trunk.

See #45109.
Built from https://develop.svn.wordpress.org/trunk@44116


git-svn-id: http://core.svn.wordpress.org/trunk@43946 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-12-13 17:40:39 +00:00
Gary Pendergast 2d3f734847 Blocks: Introduce `WP_Block_Type` and `WP_Block_Type_Registry` classes.
These are the foundational classes allowing blocks to be registered and used throughout WordPress.

This commit also includes the `has_block()` and `has_blocks()` functions, which are required for unit testing these classes.

Merges [43742] from the 5.0 branch to trunk.

Props adamsilverstein, danielbachhuber, desrosj.
Fixes #45097.
See #45109.

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


git-svn-id: http://core.svn.wordpress.org/trunk@43938 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-12-13 09:44:23 +00:00
Gary Pendergast 6cbb6f9bd2 REST API: Introduce controller for searching across post types.
Introduces a `WP_REST_Search_Controller` class which registers a `/wp/v2/search` endpoint. Search types are handled by extending `WP_REST_Search_Handler`. The default search type is `WP_REST_Post_Search_Handler` but can be filtered by plugins or a theme.

Merges [43739,43741] from the 5.0 branch to trunk.

Props danielbachhuber, flixos90, pento, rmccue, joehoyle.
Fixes #39965.


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


git-svn-id: http://core.svn.wordpress.org/trunk@43937 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-12-13 09:38:25 +00:00
Jeremy Felt c108cbfa52 REST API: Introduce themes endpoint to expose theme-supports values for the active theme.
In order to correctly render parts of its UI, the new editor needs to be aware of the active theme's post-formats and post-thumbnails support. This data is exposed by querying for the active theme on a new /wp/v2/themes endpoint for sufficiently privileged users.

Merges [43734], [43735] to trunk.

props desrosj.
Fixes #45016.

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


git-svn-id: http://core.svn.wordpress.org/trunk@43817 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-12-12 03:33:24 +00:00
Felix Arntz a11d2f6a76 Bootstrap: Load `class-wp-meta-query.php` earlier in `wp-settings.php`.
This change is necessary to enable multisite-specific meta query functionality during the multisite bootstrap process.

Fixes #40948. See #40229.

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


git-svn-id: http://core.svn.wordpress.org/trunk@42838 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-04-27 11:37:21 +00:00
Felix Arntz eda5ab56af Bootstrap: Load `formatting.php` and `meta.php` earlier in `wp-settings.php`.
This change is necessary to enable multisite-specific metadata functionality during the multisite bootstrap process.

See #40948.

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


git-svn-id: http://core.svn.wordpress.org/trunk@42665 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2018-03-16 02:01:33 +00:00
Gary Pendergast aaf99e6913 Code is Poetry.
WordPress' code just... wasn't.
This is now dealt with.

Props jrf, pento, netweb, GaryJ, jdgrimes, westonruter, Greg Sherwood from PHPCS, and everyone who's ever contributed to WPCS and PHPCS.
Fixes #41057.


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


git-svn-id: http://core.svn.wordpress.org/trunk@42172 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-11-30 23:11:00 +00:00
Weston Ruter 5f7a5c1246 File Editors: Introduce sandboxed live editing of PHP files with rollbacks for both themes and plugins.
* Edits to active plugins which cause PHP fatal errors will no longer auto-deactivate the plugin. Supersedes #39766.
* Introduce sandboxed PHP file edits for active themes, preventing accidental whitescreening of a user's site when introducing a fatal error.
* After writing a change to a PHP file for an active theme or plugin, perform loopback requests on the file editor admin screens and the homepage to check for fatal errors. If a fatal error is encountered, roll back the edited file and display the error to the user to fix and try again.
* Introduce a secure way to scrape PHP fatal errors from a site via `wp_start_scraping_edited_file_errors()` and `wp_finalize_scraping_edited_file_errors()`.
* Moves file modifications from `theme-editor.php` and `plugin-editor.php` to common `wp_edit_theme_plugin_file()` function.
* Refactor themes and plugin editors to submit file changes via Ajax instead of doing full page refreshes when JS is available.
* Use `get` method for theme/plugin dropdowns.
* Improve styling of plugin editors, including width of plugin/theme dropdowns.
* Improve notices API for theme/plugin editor JS component.
* Strip common base directory from plugin file list. See #24048.
* Factor out functions to list editable file types in `wp_get_theme_file_editable_extensions()` and `wp_get_plugin_file_editable_extensions()`.
* Scroll to line in editor that has linting error when attempting to save. See #41886.
* Add checkbox to dismiss lint errors to proceed with saving. See #41887.
* Only style the Update File button as disabled instead of actually disabling it for accessibility reasons.
* Ensure that value from CodeMirror is used instead of `textarea` when CodeMirror is present.
* Add "Are you sure?" check when leaving editor when there are unsaved changes.

Supersedes [41560].
See #39766, #24048, #41886.
Props westonruter, Clorith, melchoyce, johnbillion, jjj, jdgrimes, azaozz.
Fixes #21622, #41887.

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


git-svn-id: http://core.svn.wordpress.org/trunk@41555 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-10-04 00:20:45 +00:00
John Blackbourn 28eda6f4bc General: Improve terminology used when referring to installations of WordPress and its extensions.
"Install" is not a noun, and while it might be acceptable to use the verb as a noun, it is not correct. Using the correct
noun, "installation", increases clarity, especially for non-native English speakers.

This change fixes the usage in user-facing text and in developer documentation.

Fixes #41620

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


git-svn-id: http://core.svn.wordpress.org/trunk@41129 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-08-22 11:52:48 +00:00
Pascal Birchler 72c19648bc Load: Only load `PasswordHash` class when needed.
This reverts [38371] which loaded `class-phpass.php` early in `wp-settings.php` and in turn caused backward compatibility problems.

Props DavidAnderson, ketuchetan.
Fixes #39445.

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


git-svn-id: http://core.svn.wordpress.org/trunk@40294 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2017-04-06 18:01:42 +00:00